Re: Expanding on NO_ROOT: Categorizing installed files
--rwEMma7ioTxnRzrJ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
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 u=
pdate FreeNAS; one of the things I've done is take the NO_ROOT build change=
s, and expand upon them to have categories.
>=20
> I'd like to say I went for minimal changes here, but mostly what I was go=
ing for was minimal work on my part. However, this seems to mostly work; t=
he METALOG that gets generated has lines such as
>=20
> ./bin/cat type=3Dfile uname=3Droot gname=3Dwheel mode=3D0555 size=3D1152=
0 category=3Dbase
>=20
> 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 "ca=
tegory=3Ddev", 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.
>=20
> 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=3D 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 r=
espond to the list, I may follow up from a different address :).)
>=20
> 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=3D"list of dirs" to add additional dirs to the SUBDIR list
> @@ -271,7 +272,7 @@ WMAKEENV=3D ${CROSSENV} \
> =20
> # make hierarchy
> HMAKE=3D PATH=3D${TMPPATH} ${MAKE} LOCAL_MTREE=3D${LOCAL_MTREE}
> -.if defined(NO_ROOT)
> +.if defined(NO_ROOT) || defined(LOG_META_INFO)
> HMAKE+=3D PATH=3D${TMPPATH} METALOG=3D${METALOG} -DNO_ROOT
> .endif
> =20
> @@ -333,6 +334,10 @@ LIB32WMAKEENV+=3D MAKEOBJDIRPREFIX=3D${OBJTREE}/lib3=
2 \
> LIBDIR=3D/usr/lib32 \
> SHLIBDIR=3D/usr/lib32 \
> COMPILER_TYPE=3D${WMAKE_COMPILER_TYPE}
> +.if defined(LOG_META_INFO) || defined(NO_ROOT)
> +LIB32WMAKEENV+=3D META_CATEGORY=3Dcompat32
> +.endif
> +
> LIB32WMAKEFLAGS+=3D \
> CC=3D"${CC} ${LIB32FLAGS}" \
> CXX=3D"${CXX} ${LIB32FLAGS}" \
> @@ -364,14 +369,21 @@ IMAKEENV+=3D PATH=3D${TMPPATH}:${INSTALLTMP}
> INSTALLFLAGS+=3D -N ${.CURDIR}/etc
> MTREEFLAGS+=3D -N ${.CURDIR}/etc
> .endif
> -.if defined(NO_ROOT)
> +.if defined(NO_ROOT) || defined(LOG_META_INFO)
> METALOG?=3D ${DESTDIR}/${DISTDIR}/METALOG
> -IMAKE+=3D -DNO_ROOT METALOG=3D${METALOG}
> -INSTALL_DDIR=3D ${DESTDIR}/${DISTDIR}
> -INSTALLFLAGS+=3D -U -M ${METALOG} -D ${INSTALL_DDIR:S://:/:g:C:/$::}
> +. if defined(NO_ROOT)
> +IMAKE+=3D -DNO_ROOT
> +INSTALLFLAGS+=3D -U
> MTREEFLAGS+=3D -W
> +. endif
> +. if defined(LOG_META_INFO)
> +IMAKE+=3D -DLOG_META_INFO
> +. endif
> +IMAKE+=3D METALOG=3D${METALOG}
> +INSTALL_DDIR=3D ${DESTDIR}/${DISTDIR}
> +INSTALLFLAGS+=3D -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=3D INSTALL=3D"install ${INSTALLFLAGS}"
> IMAKE_MTREE=3D MTREE_CMD=3D"nmtree ${MTREEFLAGS}"
> .endif
> @@ -739,7 +751,7 @@ distributeworld installworld: installcheck installche=
ck_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 installche=
ck_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 installche=
ck_UGID
> .endfor
> -mkdir ${DESTDIR}/${DISTDIR}/base
> cd ${.CURDIR}/etc; ${CROSSENV} PATH=3D${TMPPATH} ${MAKE} \
> - METALOG=3D${METALOG} ${IMAKE_INSTALL} ${IMAKE_MTREE} \
> + METALOG=3D${METALOG} META_CATEGORY=3Dbase ${IMAKE_INSTALL} ${IMAKE_=
MTREE} \
> DISTBASE=3D/base DESTDIR=3D${DESTDIR}/${DISTDIR}/base \
> LOCAL_MTREE=3D${LOCAL_MTREE} distrib-dirs
> .endif
> @@ -987,7 +1000,7 @@ reinstallkernel reinstallkernel.debug: installcheck
> @echo ">>> Installing kernel ${INSTALLKERNEL}"
> @echo "--------------------------------------------------------------"
> cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
> - ${CROSSENV} PATH=3D${TMPPATH} \
> + ${CROSSENV} PATH=3D${TMPPATH} META_CATEGORY=3D"kernel" \
> ${MAKE} ${IMAKE_INSTALL} KERNEL=3D${INSTKERNNAME} ${.TARGET:S/kerne=
l//}
> =20
> 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$
> =20
> +META_CATEGORY=3D base
I belive this should be in bin/Makefile.inc which will eliminate the need
for .EXPORTVAR.
> +.EXPORTVAR: META_CATEGORY
> +
> .include <bsd.own.mk>
> =20
> SUBDIR=3D 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$
> =20
> +META_CATEGORY=3Dbase
> +.EXPORTVAR: META_CATEGORY
> +
> .include <bsd.own.mk>
> =20
> .if ${MK_SENDMAIL} !=3D "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=3Dfile mode=3D0644 uname=3Droot gname=
=3Dwheel"; \
> - echo "./etc/passwd type=3Dfile mode=3D0644 uname=3Droot gname=3Dwheel"=
; \
> - echo "./etc/pwd.db type=3Dfile mode=3D0644 uname=3Droot gname=3Dwheel"=
; \
> - echo "./etc/spwd.db type=3Dfile mode=3D0600 uname=3Droot gname=3Dwheel=
"; \
> + echo "./etc/login.conf.db type=3Dfile mode=3D0644 uname=3Droot gname=
=3Dwheel category=3Dbase"; \
> + echo "./etc/passwd type=3Dfile mode=3D0644 uname=3Droot gname=3Dwheel =
category=3Dbase"; \
> + echo "./etc/pwd.db type=3Dfile mode=3D0644 uname=3Droot gname=3Dwheel =
category=3Dbase"; \
> + echo "./etc/spwd.db type=3Dfile mode=3D0600 uname=3Droot gname=3Dwheel=
category=3Dbase"; \
> ) | ${METALOG.add}
> .endif
> .if ${MK_BLUETOOTH} !=3D "no"
> @@ -346,6 +349,9 @@ distrib-dirs: ${MTREES:N/*}
> .if defined(NO_ROOT)
> @set ${MTREES}; \
> while test $$# -ge 2; do \
> + p=3D"category=3Dbase"; \
> + test "$$1" =3D=3D BSD.include.dist && p=3D"category=3Ddev" ; \
> + test "$$1" =3D=3D BSD.groff.dist && p=3D"category=3Ddoc" ; \
> m=3D${.CURDIR}/$$1; \
> shift; \
> d=3D$$1; \
> @@ -353,8 +359,8 @@ distrib-dirs: ${MTREES:N/*}
> d=3D${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$
> =20
> +META_CATEGORY=3D base
> +.EXPORTVAR: META_CATEGORY
> +
> .include <bsd.own.mk>
> =20
> SUBDIR=3D csu libgcc libgcov libdialog libgomp libodialog libregex libre=
adline \
> 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$
> =20
> +META_CATEGORY=3Ddev
> +.EXPORTVAR: META_CATEGORY
> +
> .include <bsd.own.mk>
> =20
> # The order of some of these are rather important. Some depend on previ=
ous
> 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.
> =20
> +META_CATEGORY=3D dev
> +.EXPORTVAR: META_CATEGORY
> +
> .include <bsd.own.mk>
> =20
> CLEANFILES=3D 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$
> =20
> +META_CATEGORY=3D base
> +.EXPORTVAR: META_CATEGORY
> +
> .include <bsd.own.mk>
> =20
> # 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$
> =20
> +META_CATEGORY=3Ddev
> +.EXPORT_VAR: META_CATEGORY
> +
> .include <bsd.own.mk>
> =20
> .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+=3D -I${.CURDIR}/../common \
> -I${.CURDIR}/../../libc/include
> CFLAGS+=3D -fno-omit-frame-pointer
> =20
> +META_CATEGORY=3D 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}
> =20
> CLEANFILES=3D ${OBJS}
> @@ -39,7 +42,7 @@ Scrt1.o: Scrt1.s
> ${CC} ${ACFLAGS} -c -o ${.TARGET} Scrt1.s
> =20
> realinstall:
> - ${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
> + ${INSTALL} -P ${META_CATEGORY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
> ${OBJS} ${DESTDIR}${LIBDIR}
> =20
> .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$
> =20
> +META_CATEGORY?=3D base
> +.EXPORTVAR: META_CATEGORY
> +
> SHLIBDIR?=3D /lib
> =20
> .include <bsd.own.mk>
> @@ -9,6 +12,7 @@ SHLIBDIR?=3D /lib
> # named MACHINE_CPUARCH, but some ABIs are different enough to require
> # their own libc, so allow a directory named MACHINE_ARCH to override th=
is.
> =20
> +
> .if exists(${.CURDIR}/${MACHINE_ARCH})
> LIBC_ARCH=3D${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$
> =20
> +META_CATEGORY=3D base
> +.EXPORTVAR: META_CATEGORY
> +
> LIB=3D elf
> =20
> SRCS=3D 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$
> =20
> +META_CATEGORY=3D base
> +.EXPORTVAR: META_CATEGORY
> +
> LIB=3D kvm
> SHLIBDIR?=3D /lib
> CFLAGS+=3D-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$
> =20
> +META_CATEGORY=3Dbase
> +.EXPORTVAR: META_CATEGORY
> +
> .include <bsd.own.mk>
> =20
> SUBDIR=3D ${_atrun} \
> diff --git a/rescue/Makefile b/rescue/Makefile
> index 0945ed3..685af4d 100644
> --- a/rescue/Makefile
> +++ b/rescue/Makefile
> @@ -1,5 +1,8 @@
> # $FreeBSD$
> =20
> +META_CATEGORY=3Drescue
> +.EXPORTVAR: META_CATEGORY
> +
> SUBDIR=3D librescue \
> rescue
> =20
> 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$
> =20
> +META_CATEGORY=3D base
> +.EXPORTVAR: META_CATEGORY
> +
> .include <bsd.own.mk>
> =20
> # 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$
> =20
> +META_CATEGORY=3D secure
> +.EXPORTVAR: META_CATEGORY
> +
> .include <bsd.own.mk>
> =20
> SUBDIR=3D 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$
> =20
> +META_CATEGORY=3Dbase
> +.EXPORTVAR: META_CATEGORY
> +
> .include <bsd.own.mk>
> =20
> # 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.
> #
> =20
> +META_CATEGORY=3Ddtrace
> +.EXPORTVAR: META_CATEGORY
> +
> .include <bsd.own.mk>
> =20
> SUBDIR=3D ${_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$
> =20
> +META_CATEGORY=3D kernel
I can see some loging in this, but it seems like a somewhat odd choice.
> +.EXPORTVAR: META_CATEGORY
> +
> MAN=3D 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 @@
> =20
> INCSGROUPS?=3D INCS
> =20
> +.if defined(NO_ROOT) || defined(LOG_META_INFO)
> +.if defined(META_CATEGORY)
> +_META_INC=3D -P ${META_CATEGORY}:dev
> +.else
> +_META_INC=3D -P dev
> +.endif
> +.endif
> +
> .if !target(buildincludes)
> .for group in ${INCSGROUPS}
> buildincludes: ${${group}}
> @@ -39,9 +47,10 @@ ${group}NAME_${header:T}?=3D ${${group}NAME}
> .else
> ${group}NAME_${header:T}?=3D ${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+=3D ${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 ${${g=
roup}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=20
> + ${INSTALL} ${_META_INC} -C -o ${${group}OWN} -g ${${group}GRP} -m ${${g=
roup}MODE} \
> ${.ALLSRC} ${DESTDIR}${${group}DIR}
> .endif
> .endif
> @@ -73,7 +83,7 @@ installincludes:
> t=3D${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:=3D ${SHLINSTALLFLAGS}
> _SHLINSTALLFLAGS:=3D ${_SHLINSTALLFLAGS${ie}}
> .endfor
> =20
> +.if defined(META_CATEGORY)
> +_PKG_FLAGS=3D -P ${META_CATEGORY}
> +_DEV_PKG_FLAGS=3D -P ${META_CATEGORY}:dev
> +.else
> +_PKG_FLAGS=3D
> +_DEV_PKG_FLAGS=3D
> +.endif
> +
> .if !defined(INTERNALLIB)
> realinstall: _libinstall
> .ORDER: beforeinstall _libinstall
> _libinstall:
> .if defined(LIB) && !empty(LIB) && ${MK_INSTALLLIB} !=3D "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} !=3D "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} !=3D "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}/${S=
HLIB_LINK}
> .else
> .if ${SHLIBDIR} =3D=3D ${LIBDIR}
> - ${INSTALL_SYMLINK} ${SHLIB_NAME} ${DESTDIR}${LIBDIR}/${SHLIB_LINK}
> + ${INSTALL_SYMLINK} ${_PKG_FLAGS} ${SHLIB_NAME} ${DESTDIR}${LIBDIR}/${SH=
LIB_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} !=3D "no"
> ${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
> - ${_INSTALLFLAGS} lib${LIB}_pic.a ${DESTDIR}${LIBDIR}
> + ${_INSTALLFLAGS} ${_DEV_PKG_FLAGS} lib${LIB}_pic.a ${DESTDIR}${LIBD=
IR}
> .endif
> .if defined(WANT_LINT) && !defined(NO_LINT) && defined(LIB) && !empty(LI=
B)
> ${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
> - ${_INSTALLFLAGS} ${LINTLIB} ${DESTDIR}${LINTLIBDIR}
> + ${_INSTALLFLAGS} ${_DEV_PKG_FLAGS} ${LINTLIB} ${DESTDIR}${LINTLIBDI=
R}
> .endif
> .endif # !defined(INTERNALLIB)
> =20
> 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=3D${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=3D$$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
> =20
> MINSTALL?=3D ${INSTALL} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE}
> +.if (defined(NO_ROOT) || defined(LOG_META_INFO)) && defined(META_CATEGOR=
Y)
> +# Man pages go into the doc package, and the package specified.
> +MINSTALL+=3D -P ${META_CATEGORY}:doc
> +_META_INFO=3D -P ${META_CATEGORY}:doc
> +.endif
> =20
> CATDIR=3D ${MANDIR:H:S/$/\/cat/}
> CATEXT=3D .cat
> @@ -216,7 +221,7 @@ _maninstall: ${MAN}
> t=3D${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=3D${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$
> =20
> +META_CATEGORY=3D kernel
> +.EXPORTVAR: META_CATEGORY
> +
> .include <bsd.own.mk>
> =20
> # 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
> =20
> +.if defined(META_CATEGORY)
> +META_LOG_SYMBOLS=3D -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} !=3D "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?=3D /sbin/kldload
> KMODUNLOAD?=3D /sbin/kldunload
> OBJCOPY?=3D objcopy
> =20
> +.if defined(META_CATEGORY)
> +META_LOG_SYMBOLS=3D -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} !=3D "no")
> ${INSTALL} -o ${KMODOWN} -g ${KMODGRP} -m ${KMODMODE} \
> - ${_INSTALLFLAGS} ${PROG}.symbols ${DESTDIR}${KMODDIR}
> + ${_INSTALLFLAGS} ${META_LOG_SYMBOLS} ${PROG}.symbols ${DESTDIR}${KM=
ODDIR}
> .endif
> =20
> .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=3D"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$
> =20
> +META_CATEGORY=3Dbase
> +.EXPORTVAR: META_CATEGORY
> +
> .include <bsd.own.mk>
> =20
> # 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$
> =20
> +META_CATEGORY=3Ddev
> +.EXPORTVAR: META_CATEGORY
> +
> .include <bsd.own.mk>
> =20
> SUBDIR=3D 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.
> #
> =20
> +META_CATEGORY=3D dev
> +.EXPORTVAR: META_CATEGORY
> +
> PROG=3D lex
> LINKS+=3D ${BINDIR}/lex ${BINDIR}/lex++
> LINKS+=3D ${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 =3D S_IRWXU | S_IRGRP | S_IXGRP | =
S_IROTH | S_IXOTH;
> static FILE *metafp;
> static const char *group, *owner;
> static const char *suffix =3D BACKUP_SUFFIX;
> -static char *destdir, *digest, *fflags, *metafile, *tags;
> +static char *destdir, *digest, *fflags, *metafile, *category, *tags;
> =20
> 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;
> =20
> + category =3D getenv("META_CATEGORY");
> +
> iflags =3D 0;
> group =3D owner =3D NULL;
> - while ((ch =3D getopt(argc, argv, "B:bCcD:df:g:h:l:M:m:N:o:pSsT:Uv")) !=
=3D
> + while ((ch =3D getopt(argc, argv, "B:bCcD:df:g:h:l:M:m:N:o:pSsT:UvP:"))=
!=3D
> -1)
> switch((char)ch) {
> case 'B':
> @@ -216,6 +218,10 @@ main(int argc, char *argv[])
> case 'M':
> metafile =3D optarg;
> break;
> + case 'P':
> + if (strlen(optarg) > 0)
> + category =3D optarg;
> + break;
> case 'm':
> haveopt_m =3D 1;
> if (!(set =3D setmode(optarg)))
> @@ -634,7 +640,7 @@ makelink(const char *from_name, const char *to_name,
> if (!haveopt_f)
> fflags =3D NULL;
> dres =3D digest_file(from_name);
> - metadata_log(to_name, "file", NULL, NULL,
> + metadata_log(to_name, "hlink", NULL, destdir ? from_name + strlen(de=
stdir) : from_name,
> dres, to_sb.st_size);
> free(dres);
> mode =3D omode;
> @@ -1337,9 +1343,15 @@ metadata_log(const char *path, const char *type, s=
truct timeval *tv,
> if (group)
> fprintf(metafp, " gname=3D%s", group);
> fprintf(metafp, " mode=3D%#o", mode);
> - if (slink) {
> + if (slink &&
> + (strcmp(type, "link") =3D=3D 0 ||
> + strcmp(type, "hlink") =3D=3D 0)) {
> + const char *prefix =3D "";
> strsvis(buf, slink, VIS_CSTYLE, extra); /* encode link */
> - fprintf(metafp, " link=3D%s", buf);
> + if (strcmp(type, "hlink") =3D=3D 0) {
> + prefix =3D ".";
> + }
> + fprintf(metafp, " %s=3D%s%s", type, prefix, buf);
> }
> if (*type =3D=3D 'f') /* type=3Dfile */
> fprintf(metafp, " size=3D%lld", (long long)size);
> @@ -1352,6 +1364,8 @@ metadata_log(const char *path, const char *type, st=
ruct timeval *tv,
> fprintf(metafp, " flags=3D%s", fflags);
> if (tags)
> fprintf(metafp, " tags=3D%s", tags);
> + if (category)
> + fprintf(metafp, " category=3D%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$
> =20
> +META_CATEGORY=3Dbase
> +.EXPORTVAR: META_CATEGORY
> +
> .include <bsd.own.mk>
> =20
> SUBDIR=3D adduser \
> _______________________________________________
> freebsd-hackers@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"
--rwEMma7ioTxnRzrJ
Content-Type: application/pgp-signature
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iKYEARECAGYFAlO+ssJfFIAAAAAALgAoaXNzdWVyLWZwckBub3RhdGlvbnMub3Bl
bnBncC5maWZ0aGhvcnNlbWFuLm5ldDY1NUQ1MTlDMjZBNzgyRTcyNTI5OUJGMDVE
OEU4QkU5RjIzODFBRDQACgkQXY6L6fI4GtRlpQCgtEBBS72lx6nC/94E7tPaZsfV
RfsAnA0ciNHYiefTsor5tJrHVe9u8Chl
=2ADx
-----END PGP SIGNATURE-----
--rwEMma7ioTxnRzrJ--
討論串 (同標題文章)
完整討論串 (本文為第 6 之 16 篇):