Created attachment 241559 [details] gitup_config v0 Current auto config feature detects osrel at build time what leads to an wrong setup if build machine has other version than system where it will be installed. Find osrel on install time through pkg-post-install.
Created attachment 241560 [details] gitup_config v1 Clean Makefile, delete reinplace comments
Created attachment 241561 [details] gitup_config v2 add PORTREVISION
TODO: - run on CURRENT and STABLE to check if gitup.conf generated values makes sense and if needed some tweaks.
(In reply to Nuno Teixeira from comment #3) (...) - should we use lua instead? pkg-script(5) pkg-lua-script(5)
(In reply to Nuno Teixeira from comment #4) > - should we use lua instead? pkg-script(5) pkg-lua-script(5) IMHO doesn't matter much here. It works fine in shell and isn't too complex either. I would certainly go for lua when more complex things must be accomplished... I'd probably remove all output, but that's just personal taste. But then, thinking about it for a while: What happens on updates? Will it automatically change an already installed config file? If so, this would be a POLA violation. Maybe doing the replacement on the .sample would be the better idea? I don't know whether this works before it is initially copied on first install though.
(In reply to Felix Palmen from comment #5) osrel detection: * old version: detection at build stage - reinplace is done in WRKSRC/gitup.conf - changed config is installed in PREFIX/etc/gitup.conf.sample and to PREFIX/etc/gitup.conf if it don't exist (@sample macro) * new version: detection at post-install stage -- reinplace is done in PREFIX/etc/gitup.conf (POLA) -+ reinplace should be done in PREFIX/etc/gitup.conf.sample It was nice that we have a PRE-INSTALL to check if there is a PREFIX/etc/gitup.conf present and if not, both .config and .config.sample could be changed to updated osrel. If it is present, then update only .config.sample. Do what @sample macro do. The problem that I found is that pkg-install runs 2 times: PRE-INSTALL and POST-INSTALL and I cannot send variables from one state to the other. So I'm still playing with pkg-post-install and I will try again @postexec in pkg-plist. I'm completly lost on how to find the best way to implement a osrel detection at install stage like an addon, without changing port, but I will need to think in other solutions.
(In reply to Nuno Teixeira from comment #6) (...) Also, it must exist a mechanism to check STABLE and CURRENT and do reinplace accordingly. To be done when I have a working setup. Resuming, I'd like to preserve what @sample macro do nicely by installing a fresh and updated gitup.conf and .sample for a fresh install/new user or only update .sample if gitup.conf is changed by user. Easy :)
(In reply to Nuno Teixeira from comment #7) (...) Found a way to have a working @postexec pkg-plist: bin/gitup share/man/man1/gitup.1.gz share/man/man5/gitup.conf.5.gz @sample etc/gitup.conf.sample @postexec sed -E -e "s,stable/[0-9]+,stable/$(freebsd-version -u|cut -c 1-2)," -e "s,releng/[0-9]+.[0-9]+,releng/$(freebsd-version -u|cut -c 1-4)," %%PREFIX%%/etc/gitup.conf.sample "branch" : "releng/13.2", "branch" : "stable/13", Same issue on how to interact with @preexec and with @sample macro.
(In reply to Nuno Teixeira from comment #8) > @postexec sed -E -e [...] TBH, I don't like this. IMHO, it's much too complex for a "command" in pkg-plist, this is just unreadable and should really better be handled by explicit scripts instead. On the general topic, kudos to your efforts! I see and understand the problem of course. And if there's a "good" solution (not violating POLA, but assisting the user by installing a sample matching their system), that would be great! But as soon as it gets just too complex and unreadable, I'd probably qualify it as "bikeshed" and rather opt for the users to fix their configuration themselves... Still, interesting issue. Maybe I'll find the time to experiment a bit myself!
(In reply to Felix Palmen from comment #9) Yes, I confess it's a big uggly cmd to put in pkg-plist :) But the fun is all mine! I did great and powerfull POLA violations in my testings lol Cheers
(In reply to Nuno Teixeira from comment #3) > TODO: > > - run on CURRENT and STABLE to check if gitup.conf generated values > makes sense and if needed some tweaks. Should I use the patch from comment 2? I'd like to test and feedback ASAP before releng/14.0 is created. Thanks
Created attachment 242051 [details] v3 - Find osrel on install time through pkg-post-install to get an updated match on gitup.conf.sample - Only install gitup.conf.sample - Add message on install with information about gitup.conf(5) and gitup.sample.
(In reply to Nuno Teixeira from comment #12) (...) While I'm here, move pkg-plist to PLIST_FILES
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=574c5c9142f39aea9da2ffccce25bbd8401242f9 commit 574c5c9142f39aea9da2ffccce25bbd8401242f9 Author: Nuno Teixeira <eduardo@FreeBSD.org> AuthorDate: 2023-06-03 12:02:06 +0000 Commit: Nuno Teixeira <eduardo@FreeBSD.org> CommitDate: 2023-06-03 12:06:38 +0000 net/gitup: Improve gitup.conf auto config - Find osrel on install time through pkg-post-install to get an updated match on gitup.conf.sample - Only install gitup.conf.sample - Add message on install with information about gitup.conf(5) and gitup.sample - Move pkg-plist to PLIST_FILES PR: 270911 net/gitup/Makefile | 12 ++++++------ net/gitup/files/pkg-message.in (new) | 12 ++++++++++++ net/gitup/pkg-plist (gone) | 4 ---- net/gitup/pkg-post-install (new) | 5 +++++ 4 files changed, 23 insertions(+), 10 deletions(-)
Committed.