Subject: Recent COMMENT changes in pkgsrc
To: None <tech-pkg@netbsd.org>
From: Alistair Crooks <agc@pkgsrc.org>
List: tech-pkg
Date: 02/17/2001 22:04:33
Some of you may have seen that we (by that, I mean Thomas Klausner)
have made changes to pkgsrc, and have moved the contents of the
pkg/COMMENT file into the package Makefile. This should make
operations much quicker - Thomas' early (rough) timings for an update
have sliced 10 minutes off the time for a pkgsrc update, from 60 to 50
minutes.
We have added backwards compatibility to bsd.pkg.mk, so that if your
packages rely on pkg/COMMENT files, they will continue to work. We
have also changed the package utilities: url2pkg, port2pkg, and
pkglint to prefer the COMMENT in the package Makefile. pkglocate has
recently been changed not to look for category pkg/COMMENT files (it's
also been changed to fall back to grep(1) if agrep, from the glimpse
package, is not installed, but I digress).
Thomas has been kind enough to forward me the Perl script he used to
do most of the conversion - it should be attached to this message.
This script can be used to convert your own packages to the new
style "COMMENT-in-package-Makefiles" packages.
I would like to thank Thomas for putting in a lot of work to make
a real difference to the pkgsrc update and extract times.
Regards,
Alistair
#!/usr/pkg/bin/perl
sub insertcomment {
local $_;
open CH, "pkg/COMMENT" or die "can't open pkg/COMMENT";
$_ = <CH>;
print ("COMMENT=$_[0]$_");
close(CH);
}
$state = 0;
$indent = "\t";
while (<>) {
if ($state > 1) {
# do nothing -- everything already done
}
elsif (/^MAINTAINER/) {
$state = 1;
/MAINTAINER\s*=(\s+)\S/;
$indent = $1;
}
elsif (/^HOMEPAGE/) {
print $_;
/HOMEPAGE\s*=(\s+)\S/;
insertcomment($1);
$state = 2;
next;
}
# no HOMEPAGE (and leaving MAINTAINER block)?
elsif ($state > 0 and $_ eq "\n" or $_ eq "\r") {
insertcomment($indent);
$indent = "\t";
$state = 2;
}
print $_;
}
if ($state < 2) {
print(STDERR "Correct place for adding COMMENT not found -- please handle manually!\n");
exit 1;
}