ports/55841: [patch] Mk/bsd.port.mk: add routines to use ${PORTSDIR}/MOVED to find moved dependencies.

Clement Laforet sheepkiller at cultdeadsheep.org
Thu Aug 21 17:00:45 UTC 2003


>Number:         55841
>Category:       ports
>Synopsis:       [patch] Mk/bsd.port.mk: add routines to use ${PORTSDIR}/MOVED to find moved dependencies.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Aug 21 10:00:31 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator:     Clement Laforet
>Release:        FreeBSD 5.1-CURRENT i386
>Organization:
cotds.org
>Environment:
System: FreeBSD lucifer.cultdeadsheep.org 5.1-CURRENT FreeBSD 5.1-CURRENT #1: Mon Aug 18 15:22:08 CEST 2003 clement at lucifer.cultdeadsheep.org:/usr/obj/usr/src/sys/LUCIFER i386


	
>Description:
        When a port is removed, renamed, moved or split, dependencies can be broken for a while.
        Usually Kris INDEX checker notifies ports@ that ports tree is broken, but optionnal knobs
        are ignored by make describe, so some dependency can remain broken until someone notifies it.
        First patch [1] prevents ports tree from being broken by obsolete dependencies changes, and then
        keeps its consistency. It uses MOVED file to find the new location.

        Second patch [2] just adds a verbose output to "make describe" for Kris INDEX checker.

>How-To-Repeat:
	N/A.
>Fix:

	

[1]
--- USE_MOVEDFILE-bsd.ports.mk.diff begins here ---
Index: bsd.port.mk
===================================================================
RCS file: /TESTBSD/REPO/ports/Mk/bsd.port.mk,v
retrieving revision 1.462
diff -u -r1.462 bsd.port.mk
--- bsd.port.mk	15 Aug 2003 22:57:58 -0000	1.462
+++ bsd.port.mk	21 Aug 2003 10:31:02 -0000
@@ -920,6 +920,7 @@
 .else
 INDEXFILE?=		INDEX
 .endif
+MOVEDFILE?=		MOVED
 .if defined(USE_BZIP2)
 EXTRACT_SUFX?=			.tar.bz2
 .elif defined(USE_ZIP)
@@ -3783,6 +3784,7 @@
 		fi; \
 		if [ $$notfound != 0 ]; then \
 			${ECHO_MSG} "===>    Verifying $$target for $$prog in $$dir"; \
+			${CHECK-MOVED-DEPENDS} ;\
 			if [ ! -d "$$dir" ]; then \
 				${ECHO_MSG} "     >> No directory for $$prog.  Skipping.."; \
 			else \
@@ -3839,8 +3841,30 @@
 		fi; \
 		if [ $$notfound != 0 ]; then \
 			${ECHO_MSG} "===>    Verifying $$target for $$lib in $$dir"; \
-			if [ ! -d "$$dir" ]; then \
-				${ECHO_MSG} "     >> No directory for $$lib.  Skipping.."; \
+			direxists=1; \
+			if [ ! -d $$dir ]; then \
+				newdir=`${EGREP} "^$${dir##${PORTSDIR}/}\|" ${PORTSDIR}/${MOVEDFILE} | \
+				${AWK} -F\| ' $$2 ~ /^$$/ {print $$1" has been removed on " $$3 ". reason: "$$4; exit }; \
+				{ print "${PORTSDIR}/" $$2};'` ;\
+				if ( [ `echo "$$newdir" | wc -w` -gt "1" ] ); then \
+					${ECHO_MSG} "     >> $$newdir"; \
+					${ECHO_MSG} "     >> Please informs the maintainer (${MAINTAINER})"; \
+				elif ( [  X$$newdir != "X" ] ) ; then \
+					dir=$$newdir; \
+					${ECHO_MSG} "     >> DEPENDENCY HAS MOVED to $$newdir";\
+					${ECHO_MSG} "     >> Please inform the maintainer (${MAINTAINER})"; \
+					if [ -d "$$newdir" ]; then \
+						${ECHO_MSG} "===>    Verifying $$target for $$lib in $$dir"; \
+						direxists=0; \
+					fi; \
+				else \
+						${ECHO_MSG} "     >> Can't find any informations in ${PORTSDIR}/${MOVEDFILE}"; \
+				fi;\
+			else \
+				direxists=0; \
+			fi; \
+			if [ ! "$$direxists" -eq "0" ]; then \
+				${ECHO_MSG} "     >> No directory for $$lib.  Skipping..."; \
 			else \
 				if [ X${USE_PACKAGE_DEPENDS} != "X" ]; then \
 					subpkgfile=`(cd $$dir; ${MAKE} $$depends_args -V PKGFILE)`; \
@@ -3891,6 +3915,12 @@
 .endif
 
 # Dependency lists: both build and runtime, recursive.  Print out directory names.
+CHECK-MOVED-DEPENDS= \
+		if [ ! -d $$dir ]; then \
+			newdir=`${EGREP} "^$${dir\#\#${PORTSDIR}/}\|" ${PORTSDIR}/${MOVEDFILE} | \
+			${AWK} -F\| ' $$2 ~ /^[a-z]+/ { print "${PORTSDIR}/" $$2};'`; \
+			[ X$${newdir} != "X" ] && [ -d $$newdir ] && dir=$$newdir; \
+		fi
 
 all-depends-list:
 	@${ALL-DEPENDS-LIST}
@@ -3898,6 +3928,7 @@
 ALL-DEPENDS-LIST= \
 	checked="${PARENT_CHECKED}"; \
 	for dir in $$(${ECHO_CMD} "${EXTRACT_DEPENDS} ${PATCH_DEPENDS} ${FETCH_DEPENDS} ${BUILD_DEPENDS} ${LIB_DEPENDS} ${RUN_DEPENDS}" | ${TR} '\040' '\012' | ${SED} -e 's/^[^:]*://' -e 's/:.*//') $$(${ECHO_CMD} ${DEPENDS} | ${TR} '\040' '\012' | ${SED} -e 's/:.*//'); do \
+		${CHECK-MOVED-DEPENDS} ;\
 		if [ -d $$dir ]; then \
 			if (${ECHO_CMD} $$checked | ${GREP} -qwv "$$dir"); then \
 				child=$$(cd $$dir; ${MAKE} PARENT_CHECKED="$$checked" all-depends-list); \
@@ -4011,6 +4042,7 @@
 
 BUILD-DEPENDS-LIST= \
 	for dir in $$(${ECHO_CMD} "${EXTRACT_DEPENDS} ${PATCH_DEPENDS} ${FETCH_DEPENDS} ${BUILD_DEPENDS} ${LIB_DEPENDS}" | ${TR} '\040' '\012' | ${SED} -e 's/^[^:]*://' -e 's/:.*//' | sort -u) $$(${ECHO_CMD} ${DEPENDS} | ${TR} '\040' '\012' | ${SED} -e 's/:.*//' | sort -u); do \
+		${CHECK-MOVED-DEPENDS} ;\
 		if [ -d $$dir ]; then \
 			${ECHO_CMD} $$dir; \
 		else \
@@ -4023,6 +4055,7 @@
 
 RUN-DEPENDS-LIST= \
 	for dir in $$(${ECHO_CMD} "${LIB_DEPENDS} ${RUN_DEPENDS}" | ${TR} '\040' '\012' | ${SED} -e 's/^[^:]*://' -e 's/:.*//' | sort -u) $$(${ECHO_CMD} ${DEPENDS} | ${TR} '\040' '\012' | ${SED} -e 's/:.*//' | sort -u); do \
+		${CHECK-MOVED-DEPENDS} ;\
 		if [ -d $$dir ]; then \
 			${ECHO_CMD} $$dir; \
 		else \
@@ -4053,6 +4086,7 @@
 	checked="${PARENT_CHECKED}"; \
 	for dir in $$(${ECHO_CMD} "${LIB_DEPENDS} ${RUN_DEPENDS}" | ${TR} '\040' '\012' | ${SED} -e 's/^[^:]*://' -e 's/:.*//') $$(${ECHO_CMD} ${DEPENDS} | ${TR} '\040' '\012' | ${SED} -e 's/:.*//'); do \
 		dir=$$(${REALPATH} $$dir); \
+		${CHECK-MOVED-DEPENDS} ;\
 		if [ -d $$dir ]; then \
 			if (${ECHO_CMD} $$checked | ${GREP} -qwv "$$dir"); then \
 				childout=$$(cd $$dir; ${MAKE} CHILD_DEPENDS=yes PARENT_CHECKED="$$checked" package-depends-list); \
@@ -4123,12 +4157,32 @@
 			my @dirs = @$$i; \
 			@$$i = (); \
 			for (@dirs) { \
-				if (-d $$_) { \
-					push @$$i, $$_; \
+				my $$portdir = $$_ ; \
+				my $$direxists = 1;\
+ 				if (-d $$_) { \
+					$$direxists = 0;\
 				} else { \
-					print STDERR qq{${PKGNAME}: \"$$_\" non-existent -- dependency list incomplete\n}; \
-				} \
-			} \
+					my $$portsdir="${PORTSDIR}"; \
+					$$_ =~ s/$$portsdir\///;\
+					my $$newdir = my $$cond = $$_ ; \
+					open(MIGRATE,"${PORTSDIR}/${MOVEDFILE}");\
+					while (<MIGRATE>) { \
+						if (/^$$cond\|/) { \
+							(my $$origdir, $$newdir, my $$date, my $$reason) = split (/\|/); \
+							if ( -d "$$portsdir/$$newdir" && ( $$newdir ne "")) { \
+								$$portdir = "$$portsdir/$$newdir"; \
+								$$direxists = 0;\
+							} \
+						} \
+					}\
+					close(MIGRATE);\
+				}\
+				if ($$direxists eq "0") { \
+					push @$$i, $$portdir;\
+ 				} else { \
+					print STDERR qq{${PKGNAME}: \"$$portdir\" non-existent -- dependency list incomplete\n}; \
+ 				} \
+ 			} \
 		} \
 		for (@bdirs, @mdirs) { \
 			$$x{$$_} = 1; \
--- USE_MOVEDFILE-bsd.ports.mk.diff ends here ---


[2]
--- add-make-describe-warn.diff begins here ---
--- bsd.port.mk.old	Thu Aug 21 15:54:12 2003
+++ bsd.port.mk	Thu Aug 21 15:58:14 2003
@@ -4171,6 +4171,7 @@
 							(my $$origdir, $$newdir, my $$date, my $$reason) = split (/\|/); \
 							if ( -d "$$portsdir/$$newdir" && ( $$newdir ne "")) { \
 								$$portdir = "$$portsdir/$$newdir"; \
+								print STDERR qq{${PKGNAME}: \"$$origdir\" moved to \"$$newdir\" on $$date\n}; \
 								$$direxists = 0;\
 							} \
 						} \
--- add-make-describe-warn.diff ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list