On Mon, Jul 06, 2026 at 01:04:13PM +0100, Stuart Henderson wrote: > On 2026/06/30 18:37, Jeremie Courreges-Anglas wrote: > > On Tue, Jun 30, 2026 at 05:15:02PM +0100, Stuart Henderson wrote: > > > On 2026/06/30 18:02, Jeremie Courreges-Anglas wrote: > > [...] > > > > Index: portimport > > > > =================================================================== > > > > RCS file: /cvs/ports/infrastructure/bin/portimport,v > > > > diff -u -p -r1.10 portimport > > > > --- portimport 19 Feb 2020 17:53:18 -0000 1.10 > > > > +++ portimport 30 Jun 2026 15:26:34 -0000 > > > > @@ -29,7 +29,7 @@ usage() { > > > > } > > > > > > > > user=$(id -un) > > > > -portsdir= > > > > +portsdir=/usr/ports > > > ... > > > > -portsdir=${portsdir:-${PWD%"/$pkgpath"}} > > > > > > how about this? > > > > > > portsdir=${portsdir:-/usr/ports} > > > > What would be the indended difference in behavior? > > With the current code, a user could set portsdir in the environment and > portimport would use it instead of trying to figure it out based on the > current directory. I suspect you misread the diff, the script currently ~starts with: ... user=$(id -un) portsdir= ... so the value of an environment variable named portsdir can't leak into the script. > So my proposed change just maintains that, for anyone > who already figured it out and set in the environment. That would be a twisted way to avoid using documented options. Trying to keep such hacks working sends the wrong message IMO. ;) > > The proposed diff aligns the handling of $portsdir with the handling > > of $user. I strongly suspect that the lack of readability of > > constructs such as > > > > portsdir=${portsdir:-${PWD%"/$pkgpath"}} > > > > hindered our understanding of the script during all these years. > > "strip /$pkgpath off the end of the current directory name", which works > fine for /usr/ports/x/y, just omits dealing with /usr/ports/mystuff/x/y. You're just talking about ${var%suffix}. Anyway, I know what the line does and I still dislike its semantics-per-byte ratio. :P > > > > grep -q "^@new" pkg/P* && echo "New users/groups, remember to commit infrastructure/db/user.list!" > > > > cd "$portsdir/${pkgpath%/*}" > > > > - cvs -R -d$cvsroot update -AdP ${pkgpath##*/} > > > > + cvs -d$cvsroot update -AdP ${pkgpath##*/} > > > > > > agreed, -R makes no sense here. > > > > > > I suppose it could mv ${pkgpath} ${pkgpath}.bak or similar if run from > > > /usr/ports? > > > > That'd been an improvement for imports from /usr/ports, indeed... but > > I have no use case for this and it's not a new problem. Right now I'd > > like to fix that bloody error that pesters everybody since years. ;) > > yes... > > > PS: for users of non-default PORTSDIR, I suspect it would only be a matter of using > > > > make -f /etc/mk.conf -V PORTSDIR > > that would be a smarter way to do it. I've thought about it some more and I'm not sure my initial diff is the way to go anymore. Seems like zhuk@ made sure portimport and portcheck could be used from any valid ports tree checkout, not just whatever the user happens to be using for builds. So maybe dropping mystuff really is the simplest approach, but ENOTIME right now. -- jca
No comments:
Post a Comment