Change to INDEX format

Kris Kennaway kris at obsecurity.org
Sat Jun 19 02:17:09 GMT 2004


This patch extends the format of the INDEX file to separately list
FETCH_DEPENDS, EXTRACT_DEPENDS and PATCH_DEPENDS instead of lumping
them all together with BUILD_DEPENDS.  I need a version of this in
order to support recent changes to the package build cluster, which
adds the dependencies separately before the corresponding build stage,
to test for errors that would be seen on a clean system.

It's somewhat backwards-compatible since the new fields are appended
and do not reorder existing fields, but I suspect some tools like
portupgrade and porteasy that parse the INDEX will need to be taught
about the new fields.

(I've also removed the 'parallel' target since this is pretty much
specific to the package builds, and I can do a better job of it in the
Tools/portbuild/scripts/makeparallel script.)

Kris

Index: Makefile
===================================================================
RCS file: /c/pcvs/ports/Makefile,v
retrieving revision 1.85
diff -u -r1.85 Makefile
--- Makefile	11 Jun 2004 23:52:44 -0000	1.85
+++ Makefile	19 Jun 2004 00:17:02 -0000
@@ -122,18 +122,7 @@
 	echo " Done."
 
 print-index:	${.CURDIR}/${INDEXFILE}
-	@awk -F\| '{ printf("Port:\t%s\nPath:\t%s\nInfo:\t%s\nMaint:\t%s\nIndex:\t%s\nB-deps:\t%s\nR-deps:\t%s\n\n", $$1, $$2, $$4, $$6, $$7, $$8, $$9); }' < ${.CURDIR}/${INDEXFILE}
-
-parallel: ${.CURDIR}/${INDEXFILE}
-.if !defined(branch)
-	@echo "The parallel target requires a branch parameter,"
-	@echo "e.g.: \"make parallel branch=X\""
-	@false
-.endif
-.for dir in ${SUBDIR}
-	@[ -r ${dir}/Makefile ] && echo "all: ${dir}-all" || true
-.endfor
-	@awk -F '|' '{me=$$1; here=$$2; bdep=$$8; rdep=$$9; split(here, tmp, "/"); if (bdep != "") { gsub("$$", ".tgz", bdep); gsub(" ", ".tgz ", bdep); } if (rdep != "") { gsub("$$", ".tgz", rdep); gsub(" ", ".tgz ", rdep); } print tmp[4] "-all: " me ".tgz"; print me ": " me ".tgz"; print me ".tgz: " bdep " " rdep; printf("\t@/var/portbuild/scripts/pdispatch ${branch} /var/portbuild/scripts/portbuild %s.tgz %s", me, here); if (bdep != "") printf(" %s", bdep); if (rdep != "") printf(" %s", rdep); printf("\n")}' < ${.CURDIR}/${INDEXFILE}
+	@awk -F\| '{ printf("Port:\t%s\nPath:\t%s\nInfo:\t%s\nMaint:\t%s\nIndex:\t%s\nB-deps:\t%s\nR-deps:\t%s\nE-deps:\t%s\nP-deps:\t%s\nF-deps:\t%s\nWWW:\t%s\n\n", $$1, $$2, $$4, $$6, $$7, $$8, $$9, $$11, $$12, $$13, $$10); }' < ${.CURDIR}/${INDEXFILE}
 
 CVS?= cvs
 SUP?= cvsup
Index: Mk/bsd.port.mk
===================================================================
RCS file: /c/pcvs/ports/Mk/bsd.port.mk,v
retrieving revision 1.491
diff -u -r1.491 bsd.port.mk
--- Mk/bsd.port.mk	10 Jun 2004 07:30:19 -0000	1.491
+++ Mk/bsd.port.mk	11 Jun 2004 05:32:16 -0000
@@ -4386,13 +4386,14 @@
 			print q{|/dev/null}; \
 		} \
 		print q{|${MAINTAINER}|${CATEGORIES}|}; \
-		@bdirs = map((split /:/)[1], split(q{ }, q{${EXTRACT_DEPENDS} ${PATCH_DEPENDS} ${FETCH_DEPENDS} ${BUILD_DEPENDS}})); \
+		@edirs = map((split /:/)[1], split(q{ }, q{${EXTRACT_DEPENDS}})); \
+		@pdirs = map((split /:/)[1], split(q{ }, q{${PATCH_DEPENDS}})); \
+		@fdirs = map((split /:/)[1], split(q{ }, q{${FETCH_DEPENDS}})); \
+		@bdirs = map((split /:/)[1], split(q{ }, q{${BUILD_DEPENDS}})); \
 		@rdirs = map((split /:/)[1], split(q{ }, q{${RUN_DEPENDS}})); \
-		@mdirs = ( \
-			map((split /:/)[0], split(q{ }, q{${DEPENDS}})), \
-			map((split /:/)[1], split(q{ }, q{${LIB_DEPENDS}})) \
-		); \
-		for my $$i (\@bdirs, \@rdirs, \@mdirs) { \
+		@ddirs = map((split /:/)[0], split(q{ }, q{${DEPENDS}})); \
+		@ldirs = map((split /:/)[1], split(q{ }, q{${LIB_DEPENDS}})); \
+		for my $$i (\@edirs, \@pdirs, \@fdirs, \@bdirs, \@rdirs, \@ddirs, \@ldirs) { \
 			my @dirs = @$$i; \
 			@$$i = (); \
 			for (@dirs) { \
@@ -4404,14 +4405,26 @@
 				} \
 			} \
 		} \
-		for (@bdirs, @mdirs) { \
-			$$x{$$_} = 1; \
+		for (@edirs, @ddirs) { \
+			$$xe{$$_} = 1; \
 		} \
-		print join(q{ }, sort keys %x), q{|}; \
-		for (@rdirs, @mdirs) { \
-			$$y{$$_} = 1; \
+		print join(q{ }, sort keys %xe), q{|}; \
+		for (@pdirs, @ddirs) { \
+			$$xp{$$_} = 1; \
 		} \
-		print join(q{ }, sort keys %y), q{|}; \
+		print join(q{ }, sort keys %xp), q{|}; \
+		for (@fdirs, @ddirs) { \
+			$$xf{$$_} = 1; \
+		} \
+		print join(q{ }, sort keys %xf), q{|}; \
+		for (@bdirs, @ddirs, @ldirs) { \
+			$$xb{$$_} = 1; \
+		} \
+		print join(q{ }, sort keys %xb), q{|}; \
+		for (@rdirs, @ddirs, @ldirs) { \
+			$$xr{$$_} = 1; \
+		} \
+		print join(q{ }, sort keys %xr), q{|}; \
 		if (open(DESCR, q{${DESCR}})) { \
 			while (<DESCR>) { \
 				if (/^WWW:\s+(\S+)/) { \
Index: Tools/make_index
===================================================================
RCS file: /c/pcvs/ports/Tools/make_index,v
retrieving revision 1.10
diff -u -r1.10 make_index
--- Tools/make_index	24 Feb 2003 16:07:07 -0000	1.10
+++ Tools/make_index	18 Jun 2004 22:50:36 -0000
@@ -1,13 +1,11 @@
-#!/usr/bin/perl
+#!/usr/bin/perl5~
 #
 # $FreeBSD: ports/Tools/make_index,v 1.10 2003/02/24 16:07:07 steve Exp $
 #
-# Written to speed-up INDEX file generation.  The new scheme
-# basically visits each port once and writes out each port's
-# build-depends and run-depends as a list of directories.  This
+# INDEX builds visit each port once and write out each port's
+# *-depends as a list of directories, using 'make describe'.  This
 # script goes back in and maps the directories back to pkgnames,
-# fixes up the build-depends and run-depends list, and writes
-# out the new INDEX file.
+# fixes up the *-depends list, and writes out the new INDEX file.
 
 require 5.002;
 
@@ -38,14 +36,40 @@
     my $pkg = shift(@_);
     return if $pkg->{checked};
 
-  # build-depends = build-depends + recursive list of run-depends
-  #     for each build-depends
+  # extract-depends = extract-depends + recursive list of run-depends
+  #     for each extract-depends
     my @deps = ();
-    foreach $name (@{$pkg->{bdep}}) {
+    foreach $name (@{$pkg->{edep}}) {
         recurse($index{$name});
 	push(@deps, @{$index{$name}->{rdep}});
     }    
+    $pkg->{edep} = uniqify(@{$pkg->{edep}}, @deps);
+
+  # same as above except for patch-depends this time
+    @deps = ();
+    foreach $name (@{$pkg->{pdep}}) {
+	recurse($index{$name});
+	push(@deps, @{$index{$name}->{rdep}});
+    }
+    $pkg->{pdep} = uniqify(@{$pkg->{pdep}}, @deps);
+
+  # same as above except for fetch-depends this time
+    @deps = ();
+    foreach $name (@{$pkg->{fdep}}) {
+	recurse($index{$name});
+	push(@deps, @{$index{$name}->{rdep}});
+    }
+    $pkg->{fdep} = uniqify(@{$pkg->{fdep}}, @deps);
+    $pkg->{checked} = 1;
+
+  # same as above except for build-depends this time
+    @deps = ();
+    foreach $name (@{$pkg->{bdep}}) {
+	recurse($index{$name});
+	push(@deps, @{$index{$name}->{rdep}});
+    }
     $pkg->{bdep} = uniqify(@{$pkg->{bdep}}, @deps);
+    $pkg->{checked} = 1;
 
   # same as above except for run-depends this time
     @deps = ();
@@ -55,6 +79,7 @@
     }
     $pkg->{rdep} = uniqify(@{$pkg->{rdep}}, @deps);
     $pkg->{checked} = 1;
+
 }
 
 # Given one or more lists as arguments return the set
@@ -85,9 +110,12 @@
 
   # Create a hash table of the infomation we need about this port.
     my $pkg = {
-	'bdep'		=> [split(/ /, $f[7])],
-	'rdep'		=> [split(/ /, $f[8])],
-	'rest'		=> join('|', splice(@f, 9)),
+	'edep'		=> [split(/ /, $f[7])],
+	'pdep'		=> [split(/ /, $f[8])],
+	'fdep'		=> [split(/ /, $f[9])],
+	'bdep'		=> [split(/ /, $f[10])],
+	'rdep'		=> [split(/ /, $f[11])],
+	'rest'		=> join('|', splice(@f, 12)),
 	'text'		=> join('|', splice(@f, 0, 7))
     };
     $index{$name} = $pkg;
@@ -100,11 +128,26 @@
 foreach $name (keys %index) {
     my $pkg = $index{$name};
   # first the build dependencies
+    if (@{$pkg->{edep}}) {
+	my @edep = map { by_path($_, $name) } @{$pkg->{edep}};
+	$pkg->{edep} = \@edep;
+    }
+  # 
+    if (@{$pkg->{pdep}}) {
+	my @pdep = map { by_path($_, $name) } @{$pkg->{pdep}};
+	$pkg->{pdep} = \@pdep;
+    }
+  # first the build dependencies
+    if (@{$pkg->{fdep}}) {
+	my @fdep = map { by_path($_, $name) } @{$pkg->{fdep}};
+	$pkg->{fdep} = \@fdep;
+    }
+  # first the build dependencies
     if (@{$pkg->{bdep}}) {
 	my @bdep = map { by_path($_, $name) } @{$pkg->{bdep}};
 	$pkg->{bdep} = \@bdep;
     }
-  # and now the run dependencies
+  # first the build dependencies
     if (@{$pkg->{rdep}}) {
 	my @rdep = map { by_path($_, $name) } @{$pkg->{rdep}};
 	$pkg->{rdep} = \@rdep;
@@ -123,7 +166,13 @@
 	print join(' ', sort(@{$pkg->{bdep}})) if @{$pkg->{bdep}};
 	print "|";
 	print join(' ', sort(@{$pkg->{rdep}})) if @{$pkg->{rdep}};
-	print "|$pkg->{rest}\n";
+	print "|$pkg->{rest}|";
+	print join(' ', sort(@{$pkg->{edep}})) if @{$pkg->{edep}};
+	print "|";
+	print join(' ', sort(@{$pkg->{pdep}})) if @{$pkg->{pdep}};
+	print "|";
+	print join(' ', sort(@{$pkg->{fdep}})) if @{$pkg->{fdep}};
+	print "\n";
 	++$pkg->{'PRINTED'};
     }
 }

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-ports/attachments/20040618/5b818206/attachment.bin


More information about the freebsd-ports mailing list