Subject: .packlist might be incorrect if DESTDIR is used for Perl modules
To: None <tech-pkg@NetBSD.org>
From: Klaus Heinz <k.heinz.mai.sieben@kh-22.de>
List: tech-pkg
Date: 05/19/2007 17:37:46
Hi,

the scenario is like this:

I have package p5-GD installed. When building p5-GD again using DESTDIR
the packlist from the _existing_ installation will be read and the new
files (recently installed under $DESTDIR) will be appended.

If I build the same version as the installed one, the temporary packlist
will effectively contain all the files twice, once without (the content
of the installed packlist) and once with $DESTDIR prepended.

This happens because the Makefile produced by ExtUtils::MakeMaker
looks like this

  pure_vendor_install ::
        $(NOECHO) $(MOD_INSTALL) \
                read $(VENDORARCHEXP)/auto/$(FULLEXT)/.packlist \
                write $(DESTINSTALLVENDORARCH)/auto/$(FULLEXT)/.packlist

This reads the installed packlist and writes a new packlist in the $DESTDIR
tree.

After the target "perl-packlist:" in lang/perl5/packlist.mk has been
built, the traces of $DESTDIR in .packlist are gone because
$_PERL5_PACKLIST_AWK_STRIP_DESTDIR strips them from the file.

The automatically generated (from the new packlist) PLIST for pkgsrc
is correct iff the set of files in the old packlist is a proper subset
of the set of new files. Only then can $PERL5_PLIST_FILES_CMD in
packlist.mk build a correct PLIST, due to "sort -u" eliminating the
duplicates.

I have verified this by appending a fictitious entry "Sometestfile" to
the old packlist which consequently appeared in WRKDIR/.PLIST.
During "make install" mk/check/check-files.mk complains about
  ERROR: ************************************************************
  ERROR: The following files are in the PLIST but not in /usr/pkg:
  ERROR: /scr/tmp//pkgsrc/graphics/p5-GD/work.i386/.destdir/usr/pkg/lib/perl5/vendor_perl/man/man3/Sometestfile

ciao
     Klaus