[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Possible targets for ad-hoc ports operations?



The way bsd.port.mk is written makes it fairly easy to implement
the following for-{all,build,run}-depends target(s) to do ad-hoc
operations with the ports infrastructure.  Just pass in a statement
to be executed within the context of the makefile target.

For example:

(cd to port dir)
make for-all-depends='make fetch || true'
make for-all-depends='make checksum'
make for-all-depends='make clean=packages'

make for-all-depends='make show="PKGNAME MULTI_PACKAGES FLAVORS"'
make for-all-depends='make show="FULLPKGNAME MAINTAINER"' | xargs -L2
make for-all-depends='make print-package-signature'

find `make for-all-depends=pwd` ! -path '*CVS*' -type f -mtime -10
make for-all-depends='printf "%s\t%s\t%s\n" $$dir $$multi $$flavor'

Any good?
Brad Ely

Index: bsd.port.mk
===================================================================
RCS file: /CVSROOT/ports/infrastructure/mk/bsd.port.mk,v
retrieving revision 1.712
diff -u -r1.712 bsd.port.mk
--- bsd.port.mk	25 Sep 2005 09:43:09 -0000	1.712
+++ bsd.port.mk	26 Sep 2005 17:33:32 -0000
@@ -158,16 +158,27 @@
 
 .if defined(show)
 .MAIN: show
-
 show:
 .  for _s in ${show}
 	@echo ${${_s}:Q}
 .  endfor
+
 .elif defined(clean)
 .MAIN: clean
+
 .elif defined(_internal-clean)
 clean=${_internal-clean}
 .MAIN: _internal-clean
+
+.elif defined(for-build-depends)
+.MAIN: for-build-depends
+
+.elif defined(for-all-depends)
+.MAIN: for-all-depends
+
+.elif defined(for-run-depends)
+.MAIN: for-run-depends
+
 .else
 .MAIN: all
 .endif
@@ -2362,6 +2373,15 @@
 	done
 .endfor
 
+.for _i in build all run
+for-${_i}-depends:
+	@${MAKE} ${_i}-dir-depends|tsort -r|while read dir; do \
+		unset FLAVOR SUBPACKAGE || true; \
+		${_flavor_fragment}; \
+		eval $$toset ; ${for-${_i}-depends} ; \
+	done
+.endfor
+
 license-check:
 .if ${PERMIT_PACKAGE_CDROM:L} == "yes" || ${PERMIT_PACKAGE_FTP:L} == "yes"
 	@${MAKE} all-dir-depends|tsort -r|sed -e '$$d'|while read dir; do \
@@ -2693,9 +2713,10 @@
 	do-build do-configure do-distpatch \
 	do-extract do-fetch do-install \
 	do-package do-regress extract \
-	fake fetch fetch-all \
-	fetch-makefile full-all-depends full-build-depends \
-	full-run-depends homepage-links install \
+	fake fetch fetch-all fetch-makefile \
+	for-all-depends for-build-depends for-run-depends \
+	full-all-depends full-build-depends full-run-depends \
+	homepage-links install \
 	lib-depends lib-depends-check newlib-depends-check lib-depends-list \
 	link-categories makesum manpages-check \
 	package patch \