Expanding on NO_ROOT: Categorizing installed files
Brooks Davis
brooks at freebsd.org
Thu Jul 10 15:35:33 UTC 2014
On Wed, Jul 09, 2014 at 04:33:42PM -0700, Sean Fagan wrote:
> We've been looking at some significant changes to how we distribute and update FreeNAS; one of the things I've done is take the NO_ROOT build changes, and expand upon them to have categories.
>
> I'd like to say I went for minimal changes here, but mostly what I was going for was minimal work on my part. However, this seems to mostly work; the METALOG that gets generated has lines such as
>
> ./bin/cat type=file uname=root gname=wheel mode=0555 size=11520 category=base
>
> and I've written a python script that will take that METALOG, and create PKGNG-style packages from it. (This may be more useful for things like "category=dev", or "secure".) I did have to change xinstall a bit to handle this, and I also changed how it handled hard links for the metalog.
>
> Any comments on this? More importantly, any interest in it?
I very much like the functionalty and think it's a good idea. I don't
understand why you didn't use the existing -T/tags= mechanism in
install which we're already using for debug info.
A other comments inline below.
Thanks for doing this!
-- Brooks
> (Note that I am not subscribed to the list from this address, so if you respond to the list, I may follow up from a different address :).)
>
> diff --git a/Makefile.inc1 b/Makefile.inc1
> index c0591b6..b9edd0d 100644
> --- a/Makefile.inc1
> +++ b/Makefile.inc1
> @@ -14,6 +14,7 @@
> # -DNO_KERNELOBJ do not run ${MAKE} obj in ${MAKE} buildkernel
> # -DNO_PORTSUPDATE do not update ports in ${MAKE} update
> # -DNO_ROOT install without using root privilege
> +# -DLOG_META_INFO Log metadata about installed files
I don't see much value in supporting the metadata log in the install as
root case. Is there are reason it's needed?
> # -DNO_DOCUPDATE do not update doc in ${MAKE} update
> # -DNO_CTF do not run the DTrace CTF conversion tools on built objects
> # LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
> @@ -271,7 +272,7 @@ WMAKEENV= ${CROSSENV} \
>
> # make hierarchy
> HMAKE= PATH=${TMPPATH} ${MAKE} LOCAL_MTREE=${LOCAL_MTREE}
> -.if defined(NO_ROOT)
> +.if defined(NO_ROOT) || defined(LOG_META_INFO)
> HMAKE+= PATH=${TMPPATH} METALOG=${METALOG} -DNO_ROOT
> .endif
>
> @@ -333,6 +334,10 @@ LIB32WMAKEENV+= MAKEOBJDIRPREFIX=${OBJTREE}/lib32 \
> LIBDIR=/usr/lib32 \
> SHLIBDIR=/usr/lib32 \
> COMPILER_TYPE=${WMAKE_COMPILER_TYPE}
> +.if defined(LOG_META_INFO) || defined(NO_ROOT)
> +LIB32WMAKEENV+= META_CATEGORY=compat32
> +.endif
> +
> LIB32WMAKEFLAGS+= \
> CC="${CC} ${LIB32FLAGS}" \
> CXX="${CXX} ${LIB32FLAGS}" \
> @@ -364,14 +369,21 @@ IMAKEENV+= PATH=${TMPPATH}:${INSTALLTMP}
> INSTALLFLAGS+= -N ${.CURDIR}/etc
> MTREEFLAGS+= -N ${.CURDIR}/etc
> .endif
> -.if defined(NO_ROOT)
> +.if defined(NO_ROOT) || defined(LOG_META_INFO)
> METALOG?= ${DESTDIR}/${DISTDIR}/METALOG
> -IMAKE+= -DNO_ROOT METALOG=${METALOG}
> -INSTALL_DDIR= ${DESTDIR}/${DISTDIR}
> -INSTALLFLAGS+= -U -M ${METALOG} -D ${INSTALL_DDIR:S://:/:g:C:/$::}
> +. if defined(NO_ROOT)
> +IMAKE+= -DNO_ROOT
> +INSTALLFLAGS+= -U
> MTREEFLAGS+= -W
> +. endif
> +. if defined(LOG_META_INFO)
> +IMAKE+= -DLOG_META_INFO
> +. endif
> +IMAKE+= METALOG=${METALOG}
> +INSTALL_DDIR= ${DESTDIR}/${DISTDIR}
> +INSTALLFLAGS+= -M ${METALOG} -D ${INSTALL_DDIR:S://:/:g:C:/$::}
> .endif
> -.if defined(DB_FROM_SRC) || defined(NO_ROOT)
> +.if defined(DB_FROM_SRC) || defined(NO_ROOT) || defined(LOG_META_INFO)
> IMAKE_INSTALL= INSTALL="install ${INSTALLFLAGS}"
> IMAKE_MTREE= MTREE_CMD="nmtree ${MTREEFLAGS}"
> .endif
> @@ -739,7 +751,7 @@ distributeworld installworld: installcheck installcheck_UGID
> done); \
> cp $$libs $$progs ${INSTALLTMP}
> cp -R $${PATH_LOCALE:-"/usr/share/locale"} ${INSTALLTMP}/locale
> -.if defined(NO_ROOT)
> +.if defined(NO_ROOT) || defined(LOG_META_INFO)
> echo "#${MTREE_MAGIC}" > ${METALOG}
> .endif
> .if make(distributeworld)
> @@ -755,7 +767,8 @@ distributeworld installworld: installcheck installcheck_UGID
> mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
> -p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib >/dev/null
> .endif
> -.if defined(NO_ROOT)
> +.if defined(NO_ROOT) || defined(LOG_META_INFO)
> + echo bar
> ${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 | \
> @@ -766,7 +779,7 @@ distributeworld installworld: installcheck installcheck_UGID
> .endfor
> -mkdir ${DESTDIR}/${DISTDIR}/base
> cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \
> - METALOG=${METALOG} ${IMAKE_INSTALL} ${IMAKE_MTREE} \
> + METALOG=${METALOG} META_CATEGORY=base ${IMAKE_INSTALL} ${IMAKE_MTREE} \
> DISTBASE=/base DESTDIR=${DESTDIR}/${DISTDIR}/base \
> LOCAL_MTREE=${LOCAL_MTREE} distrib-dirs
> .endif
> @@ -987,7 +1000,7 @@ reinstallkernel reinstallkernel.debug: installcheck
> @echo ">>> Installing kernel ${INSTALLKERNEL}"
> @echo "--------------------------------------------------------------"
> cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
> - ${CROSSENV} PATH=${TMPPATH} \
> + ${CROSSENV} PATH=${TMPPATH} META_CATEGORY="kernel" \
> ${MAKE} ${IMAKE_INSTALL} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//}
>
> distributekernel distributekernel.debug:
> diff --git a/bin/Makefile b/bin/Makefile
> index e5052ca..ca218ac 100644
> --- a/bin/Makefile
> +++ b/bin/Makefile
> @@ -1,6 +1,9 @@
> # From: @(#)Makefile 8.1 (Berkeley) 5/31/93
> # $FreeBSD$
>
> +META_CATEGORY= base
I belive this should be in bin/Makefile.inc which will eliminate the need
for .EXPORTVAR.
> +.EXPORTVAR: META_CATEGORY
> +
> .include <bsd.own.mk>
>
> SUBDIR= cat \
> diff --git a/etc/Makefile b/etc/Makefile
> index 7a805ae..5284d29 100644
> --- a/etc/Makefile
> +++ b/etc/Makefile
> @@ -1,6 +1,9 @@
> # from: @(#)Makefile 5.11 (Berkeley) 5/21/91
> # $FreeBSD$
>
> +META_CATEGORY=base
> +.EXPORTVAR: META_CATEGORY
> +
> .include <bsd.own.mk>
>
> .if ${MK_SENDMAIL} != "no"
> @@ -209,12 +212,12 @@ distribution:
> .endif
> pwd_mkdb ${PWD_MKDB_ENDIAN} -i -p -d ${DESTDIR}/etc \
> ${DESTDIR}/etc/master.passwd
> -.if defined(NO_ROOT)
> +.if defined(NO_ROOT) || defined(LOG_META_INFO)
> ( \
> - echo "./etc/login.conf.db type=file mode=0644 uname=root gname=wheel"; \
> - echo "./etc/passwd type=file mode=0644 uname=root gname=wheel"; \
> - echo "./etc/pwd.db type=file mode=0644 uname=root gname=wheel"; \
> - echo "./etc/spwd.db type=file mode=0600 uname=root gname=wheel"; \
> + echo "./etc/login.conf.db type=file mode=0644 uname=root gname=wheel category=base"; \
> + echo "./etc/passwd type=file mode=0644 uname=root gname=wheel category=base"; \
> + echo "./etc/pwd.db type=file mode=0644 uname=root gname=wheel category=base"; \
> + echo "./etc/spwd.db type=file mode=0600 uname=root gname=wheel category=base"; \
> ) | ${METALOG.add}
> .endif
> .if ${MK_BLUETOOTH} != "no"
> @@ -346,6 +349,9 @@ distrib-dirs: ${MTREES:N/*}
> .if defined(NO_ROOT)
> @set ${MTREES}; \
> while test $$# -ge 2; do \
> + p="category=base"; \
> + test "$$1" == BSD.include.dist && p="category=dev" ; \
> + test "$$1" == BSD.groff.dist && p="category=doc" ; \
> m=${.CURDIR}/$$1; \
> shift; \
> d=$$1; \
> @@ -353,8 +359,8 @@ distrib-dirs: ${MTREES:N/*}
> d=${DISTBASE}$$d; \
> shift; \
> ${ECHO} "${MTREE_CMD:N-W} -C -f $$m -K uname,gname | " \
> - "sed s#^\.#.$$d# | ${METALOG.add}" ; \
> - ${MTREE_CMD:N-W} -C -f $$m -K uname,gname | sed s#^\.#.$$d# | \
> + "sed -e s#^\.#.$$d# -e \"s#\$$# $$p#\" | ${METALOG.add}" ; \
> + ${MTREE_CMD:N-W} -C -f $$m -K uname,gname | sed -e s#^\.#.$$d# -e "s#\$$# $$p#" | \
> ${METALOG.add} ; \
> done; true
> .endif
> diff --git a/gnu/lib/Makefile b/gnu/lib/Makefile
> index c33cef6..c2a6af4 100644
> --- a/gnu/lib/Makefile
> +++ b/gnu/lib/Makefile
> @@ -1,5 +1,8 @@
> # $FreeBSD$
>
> +META_CATEGORY= base
> +.EXPORTVAR: META_CATEGORY
> +
> .include <bsd.own.mk>
>
> SUBDIR= csu libgcc libgcov libdialog libgomp libodialog libregex libreadline \
> diff --git a/gnu/usr.bin/cc/Makefile b/gnu/usr.bin/cc/Makefile
> index efb548a..be673bc 100644
> --- a/gnu/usr.bin/cc/Makefile
> +++ b/gnu/usr.bin/cc/Makefile
> @@ -1,5 +1,8 @@
> # $FreeBSD$
>
> +META_CATEGORY=dev
> +.EXPORTVAR: META_CATEGORY
> +
> .include <bsd.own.mk>
>
> # The order of some of these are rather important. Some depend on previous
> diff --git a/include/Makefile b/include/Makefile
> index 0328e70..1c924bf 100644
> --- a/include/Makefile
> +++ b/include/Makefile
> @@ -3,6 +3,9 @@
> #
> # Doing a "make install" builds /usr/include.
>
> +META_CATEGORY= dev
> +.EXPORTVAR: META_CATEGORY
> +
> .include <bsd.own.mk>
>
> CLEANFILES= osreldate.h version vers.c
> diff --git a/lib/Makefile b/lib/Makefile
> index 32a620d..aacc93b 100644
> --- a/lib/Makefile
> +++ b/lib/Makefile
> @@ -1,6 +1,9 @@
> # @(#)Makefile 8.1 (Berkeley) 6/4/93
> # $FreeBSD$
>
> +META_CATEGORY= base
> +.EXPORTVAR: META_CATEGORY
> +
> .include <bsd.own.mk>
>
> # To satisfy shared library or ELF linkage when only the libraries being
> diff --git a/lib/clang/Makefile b/lib/clang/Makefile
> index 6bc9552..e80193a 100644
> --- a/lib/clang/Makefile
> +++ b/lib/clang/Makefile
> @@ -1,5 +1,8 @@
> # $FreeBSD$
>
> +META_CATEGORY=dev
> +.EXPORT_VAR: META_CATEGORY
> +
> .include <bsd.own.mk>
>
> .if !make(install)
> diff --git a/lib/csu/amd64/Makefile b/lib/csu/amd64/Makefile
> index afe7fe6..5616e04 100644
> --- a/lib/csu/amd64/Makefile
> +++ b/lib/csu/amd64/Makefile
> @@ -9,6 +9,9 @@ CFLAGS+= -I${.CURDIR}/../common \
> -I${.CURDIR}/../../libc/include
> CFLAGS+= -fno-omit-frame-pointer
>
> +META_CATEGORY= base
> +.EXPORTVAR: META_CATEGORY
> +
I think the .EXPORTVAR is gratutious here and in the other
lib/*/Makefiles. For that matter, I don't understand why it's needed at
all given the presence of META_CATEGORY in lib/Makefile.
> all: ${OBJS}
>
> CLEANFILES= ${OBJS}
> @@ -39,7 +42,7 @@ Scrt1.o: Scrt1.s
> ${CC} ${ACFLAGS} -c -o ${.TARGET} Scrt1.s
>
> realinstall:
> - ${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
> + ${INSTALL} -P ${META_CATEGORY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
> ${OBJS} ${DESTDIR}${LIBDIR}
>
> .include <bsd.lib.mk>
> diff --git a/lib/libc/Makefile b/lib/libc/Makefile
> index 77c7ce0..ad27971 100644
> --- a/lib/libc/Makefile
> +++ b/lib/libc/Makefile
> @@ -1,6 +1,9 @@
> # @(#)Makefile 8.2 (Berkeley) 2/3/94
> # $FreeBSD$
>
> +META_CATEGORY?= base
> +.EXPORTVAR: META_CATEGORY
> +
> SHLIBDIR?= /lib
>
> .include <bsd.own.mk>
> @@ -9,6 +12,7 @@ SHLIBDIR?= /lib
> # named MACHINE_CPUARCH, but some ABIs are different enough to require
> # their own libc, so allow a directory named MACHINE_ARCH to override this.
>
> +
> .if exists(${.CURDIR}/${MACHINE_ARCH})
> LIBC_ARCH=${MACHINE_ARCH}
> .else
> diff --git a/lib/libelf/Makefile b/lib/libelf/Makefile
> index fe921cb..9178c36 100644
> --- a/lib/libelf/Makefile
> +++ b/lib/libelf/Makefile
> @@ -1,5 +1,8 @@
> # $FreeBSD$
>
> +META_CATEGORY= base
> +.EXPORTVAR: META_CATEGORY
> +
> LIB= elf
>
> SRCS= elf_begin.c \
> diff --git a/lib/libkvm/Makefile b/lib/libkvm/Makefile
> index 1250bf7..a611a5f 100644
> --- a/lib/libkvm/Makefile
> +++ b/lib/libkvm/Makefile
> @@ -1,6 +1,9 @@
> # @(#)Makefile 8.1 (Berkeley) 6/4/93
> # $FreeBSD$
>
> +META_CATEGORY= base
> +.EXPORTVAR: META_CATEGORY
> +
> LIB= kvm
> SHLIBDIR?= /lib
> CFLAGS+=-DLIBC_SCCS -I${.CURDIR}
> diff --git a/libexec/Makefile b/libexec/Makefile
> index 78953b4..4d43a92 100644
> --- a/libexec/Makefile
> +++ b/libexec/Makefile
> @@ -1,6 +1,9 @@
> # @(#)Makefile 8.1 (Berkeley) 6/4/93
> # $FreeBSD$
>
> +META_CATEGORY=base
> +.EXPORTVAR: META_CATEGORY
> +
> .include <bsd.own.mk>
>
> SUBDIR= ${_atrun} \
> diff --git a/rescue/Makefile b/rescue/Makefile
> index 0945ed3..685af4d 100644
> --- a/rescue/Makefile
> +++ b/rescue/Makefile
> @@ -1,5 +1,8 @@
> # $FreeBSD$
>
> +META_CATEGORY=rescue
> +.EXPORTVAR: META_CATEGORY
> +
> SUBDIR= librescue \
> rescue
>
> diff --git a/sbin/Makefile b/sbin/Makefile
> index f9ba4ca..33603cf 100644
> --- a/sbin/Makefile
> +++ b/sbin/Makefile
> @@ -1,6 +1,9 @@
> # @(#)Makefile 8.5 (Berkeley) 3/31/94
> # $FreeBSD$
>
> +META_CATEGORY= base
> +.EXPORTVAR: META_CATEGORY
> +
> .include <bsd.own.mk>
>
> # XXX MISSING: icheck ncheck
> diff --git a/secure/Makefile b/secure/Makefile
> index 7342709..d870cc0 100644
> --- a/secure/Makefile
> +++ b/secure/Makefile
> @@ -1,5 +1,8 @@
> # $FreeBSD$
>
> +META_CATEGORY= secure
> +.EXPORTVAR: META_CATEGORY
> +
> .include <bsd.own.mk>
>
> SUBDIR= lib libexec usr.bin usr.sbin
> diff --git a/share/Makefile b/share/Makefile
> index 3e613d6..8b51bd2 100644
> --- a/share/Makefile
> +++ b/share/Makefile
> @@ -1,6 +1,9 @@
> # @(#)Makefile 8.1 (Berkeley) 6/5/93
> # $FreeBSD$
>
> +META_CATEGORY=base
> +.EXPORTVAR: META_CATEGORY
> +
> .include <bsd.own.mk>
>
> # Do not include `info' in the SUBDIR list, it is handled separately.
> diff --git a/share/dtrace/Makefile b/share/dtrace/Makefile
> index adbdc84..44514c0 100644
> --- a/share/dtrace/Makefile
> +++ b/share/dtrace/Makefile
> @@ -4,6 +4,9 @@
> # the DTraceToolkit.
> #
>
> +META_CATEGORY=dtrace
> +.EXPORTVAR: META_CATEGORY
> +
> .include <bsd.own.mk>
>
> SUBDIR= ${_toolkit}
> diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile
> index dfa450e8..268ce8a 100644
> --- a/share/man/man9/Makefile
> +++ b/share/man/man9/Makefile
> @@ -1,5 +1,8 @@
> # $FreeBSD$
>
> +META_CATEGORY= kernel
I can see some loging in this, but it seems like a somewhat odd choice.
> +.EXPORTVAR: META_CATEGORY
> +
> MAN= accept_filter.9 \
> accf_data.9 \
> accf_dns.9 \
> diff --git a/share/mk/bsd.incs.mk b/share/mk/bsd.incs.mk
> index 74c378b..24559d6 100644
> --- a/share/mk/bsd.incs.mk
> +++ b/share/mk/bsd.incs.mk
> @@ -8,6 +8,14 @@
>
> INCSGROUPS?= INCS
>
> +.if defined(NO_ROOT) || defined(LOG_META_INFO)
> +.if defined(META_CATEGORY)
> +_META_INC= -P ${META_CATEGORY}:dev
> +.else
> +_META_INC= -P dev
> +.endif
> +.endif
> +
> .if !target(buildincludes)
> .for group in ${INCSGROUPS}
> buildincludes: ${${group}}
> @@ -39,9 +47,10 @@ ${group}NAME_${header:T}?= ${${group}NAME}
> .else
> ${group}NAME_${header:T}?= ${header:T}
> .endif
> +
> installincludes: _${group}INS_${header:T}
> _${group}INS_${header:T}: ${header}
> - ${INSTALL} -C -o ${${group}OWN_${.ALLSRC:T}} \
> + ${INSTALL} ${_META_INC} -C -o ${${group}OWN_${.ALLSRC:T}} \
> -g ${${group}GRP_${.ALLSRC:T}} -m ${${group}MODE_${.ALLSRC:T}} \
> ${.ALLSRC} \
> ${DESTDIR}${${group}DIR_${.ALLSRC:T}}/${${group}NAME_${.ALLSRC:T}}
> @@ -53,10 +62,11 @@ _${group}INCS+= ${header}
> installincludes: _${group}INS
> _${group}INS: ${_${group}INCS}
> .if defined(${group}NAME)
> - ${INSTALL} -C -o ${${group}OWN} -g ${${group}GRP} -m ${${group}MODE} \
> + ${INSTALL} ${_META_INC} -C -o ${${group}OWN} -g ${${group}GRP} -m ${${group}MODE} \
> ${.ALLSRC} ${DESTDIR}${${group}DIR}/${${group}NAME}
> .else
> - ${INSTALL} -C -o ${${group}OWN} -g ${${group}GRP} -m ${${group}MODE} \
> + echo WHERE ARE ${_META_INC} YOU
> + ${INSTALL} ${_META_INC} -C -o ${${group}OWN} -g ${${group}GRP} -m ${${group}MODE} \
> ${.ALLSRC} ${DESTDIR}${${group}DIR}
> .endif
> .endif
> @@ -73,7 +83,7 @@ installincludes:
> t=${DESTDIR}$$1; \
> shift; \
> ${ECHO} $$t -\> $$l; \
> - ${INSTALL_SYMLINK} $$l $$t; \
> + ${INSTALL_SYMLINK} ${_META_INC} $$l $$t; \
> done; true
> .endif
> .endif # !target(installincludes)
> diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk
> index b8b886a..2e6fa26 100644
> --- a/share/mk/bsd.lib.mk
> +++ b/share/mk/bsd.lib.mk
> @@ -285,28 +285,36 @@ _SHLINSTALLFLAGS:= ${SHLINSTALLFLAGS}
> _SHLINSTALLFLAGS:= ${_SHLINSTALLFLAGS${ie}}
> .endfor
>
> +.if defined(META_CATEGORY)
> +_PKG_FLAGS= -P ${META_CATEGORY}
> +_DEV_PKG_FLAGS= -P ${META_CATEGORY}:dev
> +.else
> +_PKG_FLAGS=
> +_DEV_PKG_FLAGS=
> +.endif
> +
> .if !defined(INTERNALLIB)
> realinstall: _libinstall
> .ORDER: beforeinstall _libinstall
> _libinstall:
> .if defined(LIB) && !empty(LIB) && ${MK_INSTALLLIB} != "no"
> ${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
> - ${_INSTALLFLAGS} lib${LIB}.a ${DESTDIR}${LIBDIR}
> + ${_INSTALLFLAGS} ${_DEV_PKG_FLAGS} lib${LIB}.a ${DESTDIR}${LIBDIR}
> .endif
> .if ${MK_PROFILE} != "no" && defined(LIB) && !empty(LIB)
> ${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
> - ${_INSTALLFLAGS} lib${LIB}_p.a ${DESTDIR}${LIBDIR}
> + ${_INSTALLFLAGS} ${_DEV_PKG_FLAGS} lib${LIB}_p.a ${DESTDIR}${LIBDIR}
> .endif
> .if defined(SHLIB_NAME)
> ${INSTALL} ${STRIP} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
> - ${_INSTALLFLAGS} ${_SHLINSTALLFLAGS} \
> + ${_INSTALLFLAGS} ${_PKG_FLAGS} ${_SHLINSTALLFLAGS} \
> ${SHLIB_NAME} ${DESTDIR}${SHLIBDIR}
> .if ${MK_DEBUG_FILES} != "no"
> .if defined(DEBUGMKDIR)
> ${INSTALL} -T debug -d ${DESTDIR}${DEBUGFILEDIR}
> .endif
> ${INSTALL} -T debug -o ${LIBOWN} -g ${LIBGRP} -m ${DEBUGMODE} \
> - ${_INSTALLFLAGS} \
> + ${_INSTALLFLAGS} ${_DEV_PKG_FLAGS} \
> ${SHLIB_NAME}.debug ${DESTDIR}${DEBUGFILEDIR}
> .endif
> .if defined(SHLIB_LINK)
> @@ -332,12 +340,12 @@ _libinstall:
> -e 's,@@LIBDIR@@,${_LDSCRIPTROOT}${LIBDIR},g' \
> ${.CURDIR}/${SHLIB_LDSCRIPT} > lib${LIB}.ld
> ${INSTALL} -S -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
> - ${_INSTALLFLAGS} lib${LIB}.ld ${DESTDIR}${LIBDIR}/${SHLIB_LINK}
> + ${_INSTALLFLAGS} ${_PKG_FLAGS} lib${LIB}.ld ${DESTDIR}${LIBDIR}/${SHLIB_LINK}
> .else
> .if ${SHLIBDIR} == ${LIBDIR}
> - ${INSTALL_SYMLINK} ${SHLIB_NAME} ${DESTDIR}${LIBDIR}/${SHLIB_LINK}
> + ${INSTALL_SYMLINK} ${_PKG_FLAGS} ${SHLIB_NAME} ${DESTDIR}${LIBDIR}/${SHLIB_LINK}
> .else
> - ${INSTALL_SYMLINK} ${_SHLIBDIRPREFIX}${SHLIBDIR}/${SHLIB_NAME} \
> + ${INSTALL_SYMLINK} ${_PKG_FLAGS} ${_SHLIBDIRPREFIX}${SHLIBDIR}/${SHLIB_NAME} \
> ${DESTDIR}${LIBDIR}/${SHLIB_LINK}
> .if exists(${DESTDIR}${LIBDIR}/${SHLIB_NAME})
> -chflags noschg ${DESTDIR}${LIBDIR}/${SHLIB_NAME}
> @@ -349,11 +357,11 @@ _libinstall:
> .endif # SHIB_NAME
> .if defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB) && ${MK_TOOLCHAIN} != "no"
> ${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
> - ${_INSTALLFLAGS} lib${LIB}_pic.a ${DESTDIR}${LIBDIR}
> + ${_INSTALLFLAGS} ${_DEV_PKG_FLAGS} lib${LIB}_pic.a ${DESTDIR}${LIBDIR}
> .endif
> .if defined(WANT_LINT) && !defined(NO_LINT) && defined(LIB) && !empty(LIB)
> ${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
> - ${_INSTALLFLAGS} ${LINTLIB} ${DESTDIR}${LINTLIBDIR}
> + ${_INSTALLFLAGS} ${_DEV_PKG_FLAGS} ${LINTLIB} ${DESTDIR}${LINTLIBDIR}
> .endif
> .endif # !defined(INTERNALLIB)
>
> diff --git a/share/mk/bsd.links.mk b/share/mk/bsd.links.mk
> index 1e4d57e..c9f83f0 100644
> --- a/share/mk/bsd.links.mk
> +++ b/share/mk/bsd.links.mk
> @@ -8,7 +8,8 @@ afterinstall: _installlinks
> .ORDER: realinstall _installlinks
> _installlinks:
> .if defined(LINKS) && !empty(LINKS)
> - @set ${LINKS}; \
> + @echo LINKFOO
> + set ${LINKS}; \
This looks like a debug leftover.
> while test $$# -ge 2; do \
> l=${DESTDIR}$$1; \
> shift; \
> @@ -19,7 +20,8 @@ _installlinks:
> done; true
> .endif
> .if defined(SYMLINKS) && !empty(SYMLINKS)
> - @set ${SYMLINKS}; \
> + @echo SYMFOO
> + set ${SYMLINKS}; \
This too.
> while test $$# -ge 2; do \
> l=$$1; \
> shift; \
> diff --git a/share/mk/bsd.man.mk b/share/mk/bsd.man.mk
> index 6445ba3..6cbead4 100644
> --- a/share/mk/bsd.man.mk
> +++ b/share/mk/bsd.man.mk
> @@ -54,6 +54,11 @@
> .endif
>
> MINSTALL?= ${INSTALL} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE}
> +.if (defined(NO_ROOT) || defined(LOG_META_INFO)) && defined(META_CATEGORY)
> +# Man pages go into the doc package, and the package specified.
> +MINSTALL+= -P ${META_CATEGORY}:doc
> +_META_INFO= -P ${META_CATEGORY}:doc
> +.endif
>
> CATDIR= ${MANDIR:H:S/$/\/cat/}
> CATEXT= .cat
> @@ -216,7 +221,7 @@ _maninstall: ${MAN}
> t=${DESTDIR}${MANDIR}$${sect}${MANSUBDIR}/$$name; \
> ${ECHO} $${t}${ZEXT} -\> $${l}${ZEXT}; \
> rm -f $${t} $${t}${MCOMPRESS_EXT}; \
> - ${INSTALL_LINK} $${l}${ZEXT} $${t}${ZEXT}; \
> + ${INSTALL_LINK} ${_META_INFO} $${l}${ZEXT} $${t}${ZEXT}; \
> done
> .if defined(MANBUILDCAT) && !empty(MANBUILDCAT)
> @set ${MLINKS:C/\.([^.]*)$/.\1 \1/}; \
> @@ -231,7 +236,7 @@ _maninstall: ${MAN}
> t=${DESTDIR}${CATDIR}$${sect}${MANSUBDIR}/$$name; \
> ${ECHO} $${t}${ZEXT} -\> $${l}${ZEXT}; \
> rm -f $${t} $${t}${MCOMPRESS_EXT}; \
> - ${INSTALL_LINK} $${l}${ZEXT} $${t}${ZEXT}; \
> + ${INSTALL_LINK} ${_META_INFO} $${l}${ZEXT} $${t}${ZEXT}; \
> done
> .endif
> .endif
> diff --git a/sys/Makefile b/sys/Makefile
> index 74068d1..d5d84b3 100644
> --- a/sys/Makefile
> +++ b/sys/Makefile
> @@ -1,5 +1,8 @@
> # $FreeBSD$
>
> +META_CATEGORY= kernel
> +.EXPORTVAR: META_CATEGORY
> +
> .include <bsd.own.mk>
>
> # The boot loader
> diff --git a/sys/conf/kern.post.mk b/sys/conf/kern.post.mk
> index 1de2e1e..46884de 100644
> --- a/sys/conf/kern.post.mk
> +++ b/sys/conf/kern.post.mk
> @@ -245,6 +245,10 @@ links:
> sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
> sh makelinks; rm -f dontlink
>
> +.if defined(META_CATEGORY)
> +META_LOG_SYMBOLS= -P ${META_CATEGORY}:dev
> +.endif
> +
> kernel-tags:
> @[ -f .depend ] || { echo "you must make depend first"; exit 1; }
> sh $S/conf/systags.sh
> @@ -272,7 +276,7 @@ kernel-install:
> ${INSTALL} -p -m 555 -o ${KMODOWN} -g ${KMODGRP} ${KERNEL_KO} ${DESTDIR}${KODIR}
> .if defined(DEBUG) && !defined(INSTALL_NODEBUG) && \
> (defined(MK_KERNEL_SYMBOLS) && ${MK_KERNEL_SYMBOLS} != "no")
> - ${INSTALL} -p -m 555 -o ${KMODOWN} -g ${KMODGRP} ${KERNEL_KO}.symbols ${DESTDIR}${KODIR}
> + ${INSTALL} ${META_LOG_SYMBOLS} -p -m 555 -o ${KMODOWN} -g ${KMODGRP} ${KERNEL_KO}.symbols ${DESTDIR}${KODIR}
> .endif
> .if defined(KERNEL_EXTRA_INSTALL)
> ${INSTALL} -p -m 555 -o ${KMODOWN} -g ${KMODGRP} ${KERNEL_EXTRA_INSTALL} ${DESTDIR}${KODIR}
> diff --git a/sys/conf/kmod.mk b/sys/conf/kmod.mk
> index cd11e3a..ea50d33 100644
> --- a/sys/conf/kmod.mk
> +++ b/sys/conf/kmod.mk
> @@ -68,6 +68,10 @@ KMODLOAD?= /sbin/kldload
> KMODUNLOAD?= /sbin/kldunload
> OBJCOPY?= objcopy
>
> +.if defined(META_CATEGORY)
> +META_LOG_SYMBOLS= -P ${META_CATEGORY}:dev
There seem to be more spellings of META_LOG_SYMBOLS than necessicary
(_META_INFO).
> +.endif
> +
> .if defined(KMODDEPS)
> .error "Do not use KMODDEPS on 5.0+; use MODULE_VERSION/MODULE_DEPEND"
> .endif
> @@ -287,7 +291,7 @@ _kmodinstall:
> .if defined(DEBUG_FLAGS) && !defined(INSTALL_NODEBUG) && \
> (defined(MK_KERNEL_SYMBOLS) && ${MK_KERNEL_SYMBOLS} != "no")
> ${INSTALL} -o ${KMODOWN} -g ${KMODGRP} -m ${KMODMODE} \
> - ${_INSTALLFLAGS} ${PROG}.symbols ${DESTDIR}${KMODDIR}
> + ${_INSTALLFLAGS} ${META_LOG_SYMBOLS} ${PROG}.symbols ${DESTDIR}${KMODDIR}
> .endif
>
> .include <bsd.links.mk>
> diff --git a/tools/install.sh b/tools/install.sh
> index c28bd89..a88387b 100644
> --- a/tools/install.sh
> +++ b/tools/install.sh
> @@ -35,7 +35,7 @@ while [ $# -gt 0 ]; do
> case $1 in
> -d) dirmode="YES"; shift;;
> -[bCcpSsv]) shift;;
> - -[BDfghMmNoTU]) shift; shift;;
> + -[PBDfghMmNoTU]) shift; shift;;
> -[BDfghMmNoTU]*) shift;;
> -l)
> shift
> diff --git a/usr.bin/Makefile b/usr.bin/Makefile
> index 5e3f152..eecd5ec 100644
> --- a/usr.bin/Makefile
> +++ b/usr.bin/Makefile
> @@ -1,6 +1,9 @@
> # From: @(#)Makefile 8.3 (Berkeley) 1/7/94
> # $FreeBSD$
>
> +META_CATEGORY=base
> +.EXPORTVAR: META_CATEGORY
> +
> .include <bsd.own.mk>
>
> # XXX MISSING: deroff diction graph learn plot
> diff --git a/usr.bin/clang/Makefile b/usr.bin/clang/Makefile
> index db5fae7..b4a52f3 100644
> --- a/usr.bin/clang/Makefile
> +++ b/usr.bin/clang/Makefile
> @@ -1,5 +1,8 @@
> # $FreeBSD$
>
> +META_CATEGORY=dev
> +.EXPORTVAR: META_CATEGORY
> +
> .include <bsd.own.mk>
>
> SUBDIR= clang clang-tblgen tblgen
> diff --git a/usr.bin/lex/Makefile b/usr.bin/lex/Makefile
> index 947eba1..1ba000e 100644
> --- a/usr.bin/lex/Makefile
> +++ b/usr.bin/lex/Makefile
> @@ -9,6 +9,9 @@
> # Also note that flex.skel no longer gets installed.
> #
>
> +META_CATEGORY= dev
> +.EXPORTVAR: META_CATEGORY
> +
> PROG= lex
> LINKS+= ${BINDIR}/lex ${BINDIR}/lex++
> LINKS+= ${BINDIR}/lex ${BINDIR}/flex
> diff --git a/usr.bin/xinstall/xinstall.c b/usr.bin/xinstall/xinstall.c
> index 15b115a..a05a87c 100644
> --- a/usr.bin/xinstall/xinstall.c
> +++ b/usr.bin/xinstall/xinstall.c
> @@ -116,7 +116,7 @@ static mode_t mode = S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH;
> static FILE *metafp;
> static const char *group, *owner;
> static const char *suffix = BACKUP_SUFFIX;
> -static char *destdir, *digest, *fflags, *metafile, *tags;
> +static char *destdir, *digest, *fflags, *metafile, *category, *tags;
>
> static int compare(int, const char *, size_t, int, const char *, size_t,
> char **);
> @@ -151,9 +151,11 @@ main(int argc, char *argv[])
> char *p;
> const char *to_name;
>
> + category = getenv("META_CATEGORY");
> +
> iflags = 0;
> group = owner = NULL;
> - while ((ch = getopt(argc, argv, "B:bCcD:df:g:h:l:M:m:N:o:pSsT:Uv")) !=
> + while ((ch = getopt(argc, argv, "B:bCcD:df:g:h:l:M:m:N:o:pSsT:UvP:")) !=
> -1)
> switch((char)ch) {
> case 'B':
> @@ -216,6 +218,10 @@ main(int argc, char *argv[])
> case 'M':
> metafile = optarg;
> break;
> + case 'P':
> + if (strlen(optarg) > 0)
> + category = optarg;
> + break;
> case 'm':
> haveopt_m = 1;
> if (!(set = setmode(optarg)))
> @@ -634,7 +640,7 @@ makelink(const char *from_name, const char *to_name,
> if (!haveopt_f)
> fflags = NULL;
> dres = digest_file(from_name);
> - metadata_log(to_name, "file", NULL, NULL,
> + metadata_log(to_name, "hlink", NULL, destdir ? from_name + strlen(destdir) : from_name,
> dres, to_sb.st_size);
> free(dres);
> mode = omode;
> @@ -1337,9 +1343,15 @@ metadata_log(const char *path, const char *type, struct timeval *tv,
> if (group)
> fprintf(metafp, " gname=%s", group);
> fprintf(metafp, " mode=%#o", mode);
> - if (slink) {
> + if (slink &&
> + (strcmp(type, "link") == 0 ||
> + strcmp(type, "hlink") == 0)) {
> + const char *prefix = "";
> strsvis(buf, slink, VIS_CSTYLE, extra); /* encode link */
> - fprintf(metafp, " link=%s", buf);
> + if (strcmp(type, "hlink") == 0) {
> + prefix = ".";
> + }
> + fprintf(metafp, " %s=%s%s", type, prefix, buf);
> }
> if (*type == 'f') /* type=file */
> fprintf(metafp, " size=%lld", (long long)size);
> @@ -1352,6 +1364,8 @@ metadata_log(const char *path, const char *type, struct timeval *tv,
> fprintf(metafp, " flags=%s", fflags);
> if (tags)
> fprintf(metafp, " tags=%s", tags);
> + if (category)
> + fprintf(metafp, " category=%s", category);
> fputc('\n', metafp);
> /* Flush line. */
> fflush(metafp);
> @@ -1372,15 +1386,15 @@ usage(void)
> {
> (void)fprintf(stderr,
> "usage: install [-bCcpSsUv] [-f flags] [-g group] [-m mode] [-o owner]\n"
> -" [-M log] [-D dest] [-h hash] [-T tags]\n"
> +" [-M log] [-P category] [-D dest] [-h hash] [-T tags]\n"
> " [-B suffix] [-l linkflags] [-N dbdir]\n"
> " file1 file2\n"
> " install [-bCcpSsUv] [-f flags] [-g group] [-m mode] [-o owner]\n"
> -" [-M log] [-D dest] [-h hash] [-T tags]\n"
> +" [-M log] [-P category] [-D dest] [-h hash] [-T tags]\n"
> " [-B suffix] [-l linkflags] [-N dbdir]\n"
> " file1 ... fileN directory\n"
> " install -dU [-vU] [-g group] [-m mode] [-N dbdir] [-o owner]\n"
> -" [-M log] [-D dest] [-h hash] [-T tags]\n"
> +" [-M log] [-P category] [-D dest] [-h hash] [-T tags]\n"
> " directory ...\n");
> exit(EX_USAGE);
> /* NOTREACHED */
> diff --git a/usr.sbin/Makefile b/usr.sbin/Makefile
> index 7a6fefd..4c3b89f 100644
> --- a/usr.sbin/Makefile
> +++ b/usr.sbin/Makefile
> @@ -1,6 +1,9 @@
> # From: @(#)Makefile 5.20 (Berkeley) 6/12/93
> # $FreeBSD$
>
> +META_CATEGORY=base
> +.EXPORTVAR: META_CATEGORY
> +
> .include <bsd.own.mk>
>
> SUBDIR= adduser \
> _______________________________________________
> freebsd-hackers at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe at freebsd.org"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 311 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20140710/ed4d7fd3/attachment.sig>
More information about the freebsd-hackers
mailing list