Subject: Recent COMMENT changes in pkgsrc
To: None <>
From: Alistair Crooks <>
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

We have added backwards compatibility to, 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.


sub insertcomment {
	local $_;
	open CH, "pkg/COMMENT" or die "can't open pkg/COMMENT";
	$_ = <CH>;
	print ("COMMENT=$_[0]$_");

$state = 0;
$indent = "\t";
while (<>) {
	if ($state > 1) {
		# do nothing -- everything already done
	elsif (/^MAINTAINER/) {
		$state = 1;
		$indent = $1;
	elsif (/^HOMEPAGE/) {
		print $_;
		$state = 2;
	# no HOMEPAGE (and leaving MAINTAINER block)?
	elsif ($state > 0 and $_ eq "\n" or $_ eq "\r") {
		$indent = "\t";
		$state = 2;
	print $_;

if ($state < 2) {
	print(STDERR "Correct place for adding COMMENT not found -- please handle manually!\n");
	exit 1;