www/nginx pkg-plist + pkgng (detectable?)

Michael Gmelin freebsd at grem.de
Sat Mar 30 13:30:46 UTC 2013


On Sat, 30 Mar 2013 05:39:21 -0500
Bryan Drewery <bdrewery at FreeBSD.org> wrote:

> On 3/29/2013 9:40 PM, Michael Gmelin wrote:
> > pkg-plist contains:
> > 
> > %%WWWDATA%%@exec mkdir -p -m 755 www/nginx-dist
> > %%WWWDATA%%@exec if [ ! -d %D/www/nginx/ ] ; then ln -fs
> > %D/www/nginx-dist %D/www/nginx; fi
> > %%WWWDATA%%www/nginx-dist/EXAMPLE_DIRECTORY-DONT_ADD_OR_TOUCH_ANYTHING
> > %%WWWDATA%%www/nginx-dist/index.html
> > %%WWWDATA%%www/nginx-dist/50x.html
> > %%WWWDATA%%@exec chmod a-w www/nginx-dist
> > %%WWWDATA%%@unexec if [ -L %D/www/nginx ]; then rm -f %D/www/nginx;
> > fi %%WWWDATA%%@dirrmtry www/nginx-dist
> > 
> > cd /usr/ports/www/nginx
> > make install clean
> > 
> > # pkg info -R nginx | grep www/nginx-dist
> > 
> >   /usr/local/www/nginx-dist/50x.html:
> > 3c264d74770fd706d59c68d90ca1eb893ac379a666ff136f9acc66ca01daec02 /usr/local/www/nginx-dist/EXAMPLE_DIRECTORY-DONT_ADD_OR_TOUCH_ANYTHING:
> > 01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b /usr/local/www/nginx-dist/index.html:
> > 38ffd4972ae513a0c79a8be4573403edcd709f0f572105362b08ff50cf6de521 /usr/local/www/nginx-dist/:
> > y mkdir -p -m 755 www/nginx-dist
> >     if [ ! -d /usr/local/www/nginx/ ] ; then ln
> > -fs /usr/local/www/nginx-dist /usr/local/www/nginx; fi chmod a-w
> > www/nginx-dist
> > 
> > This means in practice, once you create a binary package (pseudo
> > code): pkg create nginx
> > pkg repo .
> > ...
> > pkg install nginx
> > 
> > You'll be left with a www/nginx-dist relative to wherever you've
> > been in the file. I assume that pkg-plist should use %D/www/nginx
> > instead of www/nginx in mkdir and chmod. So it's probably a bug in
> > the port itself. Is this something that pkgng could potentially
> > catch in future?
> > 
> > Cheers,
> > Michael
> > 
> 
> What pkgng version is this? It should be fixed in 1.0.9 by
> https://github.com/pkgng/pkgng/issues/465
> 
> 

It is version 1.0.9 in fact.

Let me elaborate this with a complete test sequence (starting in a clean
jail):

# cd /usr/ports/ports-mgmt/pkg
# make install clean
# pkg -v
1.0.9
(which is port version 1.0.9_2)
# echo "WITH_PKGNG=1" >> /etc/make.conf
# pkg2ng
# cd /usr/ports/www/nginx
# make && make clean
(this is so only dependencies get installed)
# find /usr | sort | uniq >/tmp/beforeinstall
# make install clean
# find /usr | sort | uniq >/tmp/afterinstall
# diff /tmp/beforeinstall /tmp/afterinstall | wc -l
32
# pkg delete -y nginx
# find /usr | sort | uniq >/tmp/afterdelete
# diff /tmp/beforeinstall /tmp/afterdelete | wc -l
0

(At this point it's clear that the package cleans up after itself
ok after removal)

# make install clean
# mkdir /tmp/pkg
# cd /tmp/pkg
# pkg create nginx
# pkg repo .
# find .
.
./nginx-1.2.7_1,1.txz
./repo.txz
# pkg delete -y nginx
# PACKAGESITE=file:/tmp/pkg pkg update
# PACKAGESITE=file:/tmp/pkg pkg install -y nginx
# find .
.
./nginx-1.2.7_1,1.txz
./repo.txz
./www
./www/nginx-dist


I did the same procedure using pkg_* (starting from scratch):
# cd /usr/ports/www/nginx
# make install clean
# mkdir /tmp/pkg
# cd /tmp/pkg
# pkg_create -b nginx-\*
# find .
.
./nginx-1.2.7_1,1.tbz
# pkg_delete nginx-\*
# pkg_add nginx-*
# find .
.
./nginx-1.2.7_1,1.tbz
# pkg_info
nginx-1.2.7_1,1     Robust and small WWW server
pcre-8.32           Perl Compatible Regular Expressions library

So the problem only happens when using pkgng, not when using pkg_*. With
pkg_* it seems like "mkdir www/nginx-dist" is executed relative to
@cwd, while with pkgng it's executed relative to `pwd`.

On a different note, two things I noticed while playing with pkgng:
- The bootstrap code delivered with 9.1 installs pkg version 1.0.2,
  since pkg is still improved rapidly, wouldn't it make sense to
  bootstrap to the latest version from ports (or at least output a
  warning, that there might be a more recent version)?
- pkg2ng does not alter make.conf, nor tell the user to do so. If you
  assume that all users of pkg only use binary packages that might make
  sense. But since you'll see a lot of converting users (in
  the end this is what pkg2ng is for) either altering make.conf or at
  least giving a hint to the user (something like "Don't forget to
  add 'WITH_PKGNG=1' to your /etc/make.conf") would be nice. Even
  though I'm really should know that at this point, I forgot it
  several times, which puts the machines affected in a pretty ugly state
  after installing additional ports.

Cheers,
Michael

-- 
Michael Gmelin


More information about the freebsd-ports mailing list