Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 Jan 2013 23:41:20 +0000 (UTC)
From:      Brooks Davis <brooks@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r245516 - in projects/mtree: . cddl/lib/libdtrace etc lib/libmagic share/mk
Message-ID:  <201301162341.r0GNfKai006978@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: brooks
Date: Wed Jan 16 23:41:20 2013
New Revision: 245516
URL: http://svnweb.freebsd.org/changeset/base/245516

Log:
  Add directory metadata to the log in the NO_ROOT case.
  
  Fix creation of /sys and some manpage directory links.
  
  Alter the per-dist meta log creation to include only those directories
  that appear in the source directory.
  
  Introduce a new LIBRARIES_ONLY make variable and use it to supress the
  bogus duplicate addition of some files to the lib32 dist.

Modified:
  projects/mtree/Makefile.inc1
  projects/mtree/cddl/lib/libdtrace/Makefile
  projects/mtree/etc/Makefile
  projects/mtree/lib/libmagic/Makefile
  projects/mtree/share/mk/bsd.nls.mk

Modified: projects/mtree/Makefile.inc1
==============================================================================
--- projects/mtree/Makefile.inc1	Wed Jan 16 23:21:04 2013	(r245515)
+++ projects/mtree/Makefile.inc1	Wed Jan 16 23:41:20 2013	(r245516)
@@ -339,6 +339,7 @@ LIB32WMAKEFLAGS+=	\
 		CXX="${CXX} ${LIB32FLAGS}" \
 		DESTDIR=${LIB32TMP} \
 		-DCOMPAT_32BIT \
+		-DLIBRARIES_ONLY \
 		-DNO_CPU_CFLAGS \
 		-DNO_CTF \
 		-DNO_LINT
@@ -351,8 +352,16 @@ LIB32IMAKE=	${LIB32WMAKE:NINSTALL=*:NDES
 
 .if defined(NO_ROOT)
 METALOG?=	${DESTDIR}/${DISTDIR}/METALOG
+.if !defined(DISTDIR) 
+INSTALL_DDIR=	/${DESTDIR}
+.elif defined(DESTDIR) && ${DESTDIR:M${DISTDIR}$$}
+# Avoid adding ${DISTDIR} again when called recursively
+INSTALL_DDIR=	${DESTDIR}
+.else
 INSTALL_DDIR=	${DESTDIR}/${DISTDIR}
-INSTALLFLAGS=	-U -M ${METALOG} -D ${INSTALL_DDIR:S://:/:g}
+.endif
+# XXX: Removing DISTBASE for recursive calls during distributeworld
+INSTALLFLAGS=	-U -M ${METALOG} -D ${INSTALL_DDIR:S://:/:g:S:${DISTBASE}$$::}
 MTREEFLAGS=	-W
 .endif
 
@@ -367,6 +376,9 @@ IMAKE+=		__MAKE_SHELL=${INSTALLTMP}/sh
 .else
 IMAKEENV+=	PATH=${TMPPATH}:${INSTALLTMP}
 .endif
+.if defined(NO_ROOT)
+IMAKE+=		-DNO_ROOT METALOG=${METALOG}
+.endif
 .if defined(DB_FROM_SRC)
 IMAKE_INSTALL=	INSTALL="install -N ${.CURDIR}/etc ${INSTALLFLAGS}"
 IMAKE_MTREE=	MTREE_CMD="nmtree -N ${.CURDIR}/etc ${MTREEFLAGS}"
@@ -725,26 +737,35 @@ distributeworld installworld: installche
 	    -p ${DESTDIR}/${DISTDIR}/${dist}/usr >/dev/null
 	mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
 	    -p ${DESTDIR}/${DISTDIR}/${dist}/usr/include >/dev/null
+.if defined(NO_ROOT)
+	${IMAKEENV} nmtree -C -f ${.CURDIR}/etc/mtree/BSD.root.dist | \
+	    sed -e 's#^\./#./${dist}/#' >> ${METALOG}
+	${IMAKEENV} nmtree -C -f ${.CURDIR}/etc/mtree/BSD.usr.dist | \
+	    sed -e 's#^\./#./${dist}/usr/#' >> ${METALOG}
+	${IMAKEENV} nmtree -C -f ${.CURDIR}/etc/mtree/BSD.include.dist | \
+	    sed -e 's#^\./#./${dist}/usr/include/#' >> ${METALOG}
+.endif
 .endfor
 	-mkdir ${DESTDIR}/${DISTDIR}/base
-	${_+_}cd ${.CURDIR}; ${IMAKE} distrib-dirs \
-	    DESTDIR=${DESTDIR}/${DISTDIR}/base
+	${_+_}cd ${.CURDIR}; ${IMAKE} DISTBASE=/base \
+	    DESTDIR=${DESTDIR}/${DISTDIR}/base distrib-dirs
 .endif
 	${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}; \
 	    ${IMAKEENV} rm -rf ${INSTALLTMP}
 .if make(distributeworld)
 .for dist in ${EXTRA_DISTRIBUTIONS}
 	find ${DESTDIR}/${DISTDIR}/${dist} -empty -delete
-.endfor
 .if defined(NO_ROOT)
-.for dist in base ${EXTRA_DISTRIBUTIONS}
-	#echo "#mtree 2.0" > ${DESTDIR}/${DISTDIR}/${dist}.meta
-	#grep ./${dist}/ ${METALOG} | sed -e s#^./${dist}/#./# >> \
-	#    ${DESTDIR}/${DISTDIR}/${dist}.meta
-	awk 'BEGIN { print "#mtree 2.0" } /^\.\/${dist}\// {sub(/^\.\/${dist}\//, "./"); print}' < \
-	    ${METALOG} > ${DESTDIR}/${DISTDIR}/${dist}.meta
-.endfor
+	@# For each file that exists in this dist, print the corresponding
+	@# line from the METALOG.  This relies on the fact that
+	@# a line containing only the filename will sort immediatly before
+	@# the relevent mtree line.
+	cd ${DESTDIR}/${DISTDIR}; \
+	find ./${dist} | sort -u ${METALOG} - | \
+	awk 'BEGIN { print "#mtree 2.0" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}\//, "./"); print } }' > \
+	${DESTDIR}/${DISTDIR}/${dist}.meta
 .endif
+.endfor
 .endif
 
 packageworld:
@@ -792,8 +813,10 @@ redistribute:
 .endif
 
 distrib-dirs distribution:
+	echo ====== ${DESTDIR}
 	cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \
-	    ${IMAKE_INSTALL} ${.TARGET}
+	    ${IMAKE_INSTALL} ${IMAKE_MTREE} DISTBASE=${DISTBASE} \
+	    METALOG=${METALOG} ${.TARGET}
 
 #
 # buildkernel and installkernel
@@ -1275,11 +1298,12 @@ cross-tools:
 # hierarchy - ensure that all the needed directories are present
 #
 hierarchy hier:
-	cd ${.CURDIR}/etc;		${MAKE} distrib-dirs
-.for _mtree in ${LOCAL_MTREE}
-	mtree -eU ${MTREE_FOLLOWS_SYMLINKS} -f ${.CURDIR}/${_mtree} \
-	    -p ${DESTDIR}/
-.endfor
+.if defined(NO_ROOT)
+	cd ${.CURDIR}/etc; ${MAKE} LOCAL_MTREE=${LOCAL_MTREE} \
+	    -DNO_ROOT METALOG=${METALOG} distrib-dirs
+.else
+	cd ${.CURDIR}/etc; ${MAKE} LOCAL_MTREE=${LOCAL_MTREE} distrib-dirs
+.endif
 
 #
 # libraries - build all libraries, and install them under ${DESTDIR}.

Modified: projects/mtree/cddl/lib/libdtrace/Makefile
==============================================================================
--- projects/mtree/cddl/lib/libdtrace/Makefile	Wed Jan 16 23:21:04 2013	(r245515)
+++ projects/mtree/cddl/lib/libdtrace/Makefile	Wed Jan 16 23:41:20 2013	(r245516)
@@ -103,7 +103,7 @@ dt_names.c:
 beforedepend:	dt_errtags.c dt_names.c
 
 beforeinstall:
-.if exists(${DESTDIR}/usr/lib/dtrace)
+.if !defined(LIBRARIES_ONLY) && exists(${DESTDIR}/usr/lib/dtrace)
 .for file in ${DSRCS}
 	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} ${.CURDIR}/${file} ${DESTDIR}/usr/lib/dtrace
 .endfor

Modified: projects/mtree/etc/Makefile
==============================================================================
--- projects/mtree/etc/Makefile	Wed Jan 16 23:21:04 2013	(r245515)
+++ projects/mtree/etc/Makefile	Wed Jan 16 23:41:20 2013	(r245516)
@@ -293,52 +293,80 @@ distribution:
 
 MTREE_CMD?=	mtree
 
-distrib-dirs:
-	${MTREE_CMD} -eU ${MTREE_FOLLOWS_SYMLINKS} -f ${.CURDIR}/mtree/BSD.root.dist -p ${DESTDIR}/
-	${MTREE_CMD} -eU ${MTREE_FOLLOWS_SYMLINKS} -f ${.CURDIR}/mtree/BSD.var.dist -p ${DESTDIR}/var
-	${MTREE_CMD} -eU ${MTREE_FOLLOWS_SYMLINKS} -f ${.CURDIR}/mtree/BSD.usr.dist -p ${DESTDIR}/usr
-	${MTREE_CMD} -eU ${MTREE_FOLLOWS_SYMLINKS} -f ${.CURDIR}/mtree/BSD.include.dist \
-		-p ${DESTDIR}/usr/include
+MTREES=		mtree/BSD.root.dist		/ \
+		mtree/BSD.var.dist		/var \
+		mtree/BSD.usr.dist		/usr \
+		mtree/BSD.include.dist		/usr/include
 .if ${MK_BIND_LIBS} != "no"
-	${MTREE_CMD} -deU ${MTREE_FOLLOWS_SYMLINKS} -f ${.CURDIR}/mtree/BIND.include.dist \
-	    -p ${DESTDIR}/usr/include
+MTREES+=	mtree/BIND.include.dist		/usr/include
 .endif
 .if ${MK_BIND_MTREE} != "no"
-	${MTREE_CMD} -deU ${MTREE_FOLLOWS_SYMLINKS} -f ${.CURDIR}/mtree/BIND.chroot.dist \
-	    -p ${DESTDIR}/var/named
+MTREES+=	mtree/BIND.chroot.dist		/var/named
 .endif
 .if ${MK_GROFF} != "no"
-	${MTREE_CMD} -deU ${MTREE_FOLLOWS_SYMLINKS} -f ${.CURDIR}/mtree/BSD.groff.dist -p ${DESTDIR}/usr
+MTREES+=	mtree/BSD.groff.dist		/usr
 .endif
 .if ${MK_SENDMAIL} != "no"
-	${MTREE_CMD} -deU ${MTREE_FOLLOWS_SYMLINKS} -f ${.CURDIR}/mtree/BSD.sendmail.dist -p ${DESTDIR}/
+MTREES+=	mtree/BSD.sendmail.dist		/
 .endif
-	cd ${DESTDIR}/; rm -f ${DESTDIR}/sys; ln -s usr/src/sys sys
-	cd ${DESTDIR}/usr/share/man/en.ISO8859-1; ln -sf ../man* .
-	cd ${DESTDIR}/usr/share/man/en.UTF-8; ln -sf ../man* .
+.for mtree in ${LOCAL_MTREE}
+MTREES+=	../${mtree}			/
+.endfor
+
+distrib-dirs:
+	@set ${MTREES}; \
+	while test $$# -ge 2; do \
+		m=${.CURDIR}/$$1; \
+		shift; \
+		d=${DESTDIR}$$1; \
+		shift; \
+		${ECHO} ${MTREE_CMD} -deU ${MTREE_FOLLOWS_SYMLINKS} \
+		    -f $$m -p $$d; \
+		${MTREE_CMD} -deU ${MTREE_FOLLOWS_SYMLINKS} -f $$m -p $$d; \
+	done; true
+.if defined(NO_ROOT)
+	${ECHO} DISTBASE=${DISTBASE}
+	@set ${MTREES}; \
+	while test $$# -ge 2; do \
+		m=${.CURDIR}/$$1; \
+		shift; \
+		d=$$1; \
+		test "$$d" == "/" && d=""; \
+		d=${DISTBASE}$$d; \
+		shift; \
+		${ECHO} "${MTREE_CMD} -C -f $$m | sed s#^\.#.$$d# >>" \
+		    "${METALOG}" ; \
+		${MTREE_CMD} -C -f $$m | sed s#^\.#.$$d# >> ${METALOG} ; \
+	done; true
+.endif
+	${INSTALL_SYMLINK} usr/src/sys ${DESTDIR:S#//#/#}/sys
 	cd ${DESTDIR}/usr/share/man; \
-	set - `grep "^[a-zA-Z]" ${.CURDIR}/man.alias`; \
-	while [ $$# -gt 0 ] ; \
-	do \
-		rm -rf "$$1"; \
-		ln -s "$$2" "$$1"; \
-		shift; shift; \
+	for mandir in man*; do \
+		${INSTALL_SYMLINK} ../$$mandir \
+		    ${DESTDIR}/usr/share/man/en.ISO8859-1; \
+		${INSTALL_SYMLINK} ../$$mandir \
+		    ${DESTDIR}/usr/share/man/en.UTF-8; \
 	done
 	cd ${DESTDIR}/usr/share/openssl/man; \
+	for mandir in man*; do \
+		${INSTALL_SYMLINK} ../$$mandir \
+		    ${DESTDIR}/usr/share/openssl/man/en.ISO8859-1; \
+	done
 	set - `grep "^[a-zA-Z]" ${.CURDIR}/man.alias`; \
 	while [ $$# -gt 0 ] ; \
 	do \
-		rm -rf "$$1"; \
-		ln -s "$$2" "$$1"; \
+		rm -rf "${DESTDIR}/usr/share/man/$$1"; \
+		${INSTALL_SYMLINK} "$$2" "${DESTDIR}/usr/share/man/$$1"; \
+		rm -rf "${DESTDIR}/usr/share/openssl/man/$$1"; \
+		${INSTALL_SYMLINK} "$$2" \
+		    "${DESTDIR}/usr/share/openssl/man/$$1"; \
 		shift; shift; \
 	done
-	cd ${DESTDIR}/usr/share/openssl/man/en.ISO8859-1; ln -sf ../man* .
-	cd ${DESTDIR}/usr/share/nls; \
 	set - `grep "^[a-zA-Z]" ${.CURDIR}/nls.alias`; \
 	while [ $$# -gt 0 ] ; \
 	do \
-		rm -rf "$$1"; \
-		ln -s "$$2" "$$1"; \
+		rm -rf "${DESTDIR}/usr/share/nls/$$1"; \
+		${INSTALL_SYMLINK} "$$2" "${DESTDIR}/usr/share/nls/$$1"; \
 		shift; shift; \
 	done
 

Modified: projects/mtree/lib/libmagic/Makefile
==============================================================================
--- projects/mtree/lib/libmagic/Makefile	Wed Jan 16 23:21:04 2013	(r245515)
+++ projects/mtree/lib/libmagic/Makefile	Wed Jan 16 23:41:20 2013	(r245516)
@@ -22,6 +22,7 @@ CFLAGS+= -I${.CURDIR} -I${CONTRDIR}
 
 WARNS?=		3
 
+.if !defined(LIBRARIES_ONLY)
 CLEANFILES+=	magic magic.mgc
 
 FILES=		magic magic.mgc
@@ -52,5 +53,6 @@ ${mp}: ${mp:C/[0-9]/man/}
 		-e 's/__VERSION__/${FILEVER}/g' \
 		-e 's,__MAGIC__,${MAGICPATH}/magic,g' ${.ALLSRC} > ${.TARGET}
 .endfor
+.endif
 
 .include <bsd.lib.mk>

Modified: projects/mtree/share/mk/bsd.nls.mk
==============================================================================
--- projects/mtree/share/mk/bsd.nls.mk	Wed Jan 16 23:21:04 2013	(r245515)
+++ projects/mtree/share/mk/bsd.nls.mk	Wed Jan 16 23:41:20 2013	(r245516)
@@ -30,7 +30,7 @@ GENCAT?=	gencat
 .msg.cat:
 	${GENCAT} ${.TARGET} ${.IMPSRC}
 
-.if defined(NLS) && !empty(NLS) && ${MK_NLS} != "no"
+.if defined(NLS) && !empty(NLS) && ${MK_NLS} != "no" && !defined(LIBRARIES_ONLY)
 
 #
 # .msg file pre-build rules



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201301162341.r0GNfKai006978>