pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mk Add USE_PKG_ADMIN_DIGEST flag for switching between...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/156c4640f10e
branches:  trunk
changeset: 347523:156c4640f10e
user:      joerg <joerg%pkgsrc.org@localhost>
date:      Sun Jan 12 23:38:42 2020 +0000

description:
Add USE_PKG_ADMIN_DIGEST flag for switching between $NetBSD$ and SHA256
digests to identify file versions. Defaults to no for now. For digest
mode, recursive into FILESDIR, so that e.g. the majority of pkg_install
itself is recorded as well SMF manifests.

diffstat:

 mk/defaults/mk.conf                |   8 +++++-
 mk/pkgformat/pkg/metadata.mk       |  48 +++++++++++++++++++++++++++++++++++--
 mk/pkgformat/pkg/pkgformat-vars.mk |   7 +++-
 3 files changed, 57 insertions(+), 6 deletions(-)

diffs (120 lines):

diff -r 3a5f559194d6 -r 156c4640f10e mk/defaults/mk.conf
--- a/mk/defaults/mk.conf       Sun Jan 12 23:35:01 2020 +0000
+++ b/mk/defaults/mk.conf       Sun Jan 12 23:38:42 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mk.conf,v 1.305 2019/06/08 19:51:38 leot Exp $
+# $NetBSD: mk.conf,v 1.306 2020/01/12 23:38:42 joerg Exp $
 #
 
 # This file provides default values for variables that may be overridden
@@ -22,6 +22,12 @@
 # Possible: yes, no, auto
 # Default: auto (automatic detection, see above)
 
+USE_PKG_ADMIN_DIGEST=  no
+# Record file digests instead of extracing the NetBSD RCS ID from files.
+#
+# Possible: yes, no
+# Default: no
+
 #ALLOW_VULNERABLE_PACKAGES=
 # allow the user to build packages which are known to be vulnerable to
 # security exploits
diff -r 3a5f559194d6 -r 156c4640f10e mk/pkgformat/pkg/metadata.mk
--- a/mk/pkgformat/pkg/metadata.mk      Sun Jan 12 23:35:01 2020 +0000
+++ b/mk/pkgformat/pkg/metadata.mk      Sun Jan 12 23:38:42 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: metadata.mk,v 1.17 2019/10/01 13:01:02 jperkin Exp $
+# $NetBSD: metadata.mk,v 1.18 2020/01/12 23:38:42 joerg Exp $
 
 ######################################################################
 ### The targets below are all PRIVATE.
@@ -129,7 +129,46 @@
 ###
 _BUILD_VERSION_FILE=   ${PKG_DB_TMPDIR}/+BUILD_VERSION
 _METADATA_TARGETS+=    ${_BUILD_VERSION_FILE}
-
+.if !empty(USE_PKG_ADMIN_DIGEST:M[Yy][Ee][Ss])
+${_BUILD_VERSION_FILE}:
+       ${RUN}${MKDIR} ${.TARGET:H}
+       ${RUN}${RM} -f ${.TARGET}.tmp
+       ${RUN}                                                          \
+       exec 1>>${.TARGET}.tmp;                                         \
+       ${FIND} ${FILESDIR} -type f 2> /dev/null | while read f; do     \
+               ${TEST} ! -f "$$f" || ${ECHO} "$$f";                    \
+       done
+       for f in ${.CURDIR}/Makefile ${PKGDIR}/*; do                    \
+               ${TEST} ! -f "$$f" || ${ECHO} "$$f";                    \
+       done
+       ${RUN}                                                          \
+       exec 1>>${.TARGET}.tmp;                                         \
+       ${TEST} -f ${DISTINFO_FILE:Q} || exit 0;                        \
+       ${CAT} ${DISTINFO_FILE} |                                       \
+       ${AWK} 'NF == 4 && $$3 == "=" { gsub("[()]", "", $$2); print $$2 }' | \
+       while read file; do                                             \
+               ${TEST} ! -f "${PATCHDIR}/$$file" ||                    \
+                       ${ECHO} "${PATCHDIR}/$$file";                   \
+       done
+       ${RUN}                                                          \
+       exec 1>>${.TARGET}.tmp;                                         \
+       ${TEST} -d ${PATCHDIR} || exit 0;                               \
+       cd ${PATCHDIR}; for f in *; do                                  \
+               case "$$f" in                                           \
+               "*"|*.orig|*.rej|*~)    ;;                              \
+               patch-*)                ${ECHO} "${PATCHDIR}/$$f" ;;    \
+               esac;                                                   \
+       done
+       ${RUN}                                                          \
+       ${CAT} ${.TARGET}.tmp |                                         \
+       ${AWK} '{ t=$$0; sub("^${PKGSRCDIR}/", "");                     \
+                  printf "%s %s\n", t, $$0 }' |                        \
+       while read file relfile; do                                     \
+               printf "%s: " "$$relfile";                              \
+               ${PKG_ADMIN} digest "$$file";                           \
+       done |                                                          \
+       ${SORT} -u > ${.TARGET} && ${RM} -f ${.TARGET}.tmp
+.else
 ${_BUILD_VERSION_FILE}:
        ${RUN}${MKDIR} ${.TARGET:H}
        ${RUN}${RM} -f ${.TARGET}.tmp
@@ -158,7 +197,9 @@
        done
        ${RUN}                                                          \
        ${CAT} ${.TARGET}.tmp |                                         \
-       while read file; do                                             \
+       ${AWK} '{ t=$$0; sub("^${PKGSRCDIR}/", "");
+                  printf "%s %s\n"; t, $$0 }' | \
+       while read file relfile; do                                     \
                ${GREP} '\$$NetBSD' $$file 2>/dev/null |                \
                ${SED} -e "s|^|$$file:|;q";                             \
        done |                                                          \
@@ -167,6 +208,7 @@
                  sub("[$$][^$$]*$$", "$$");                            \
                  print; }' |                                           \
        ${SORT} -u > ${.TARGET} && ${RM} -f ${.TARGET}.tmp
+.endif
 
 ######################################################################
 ###
diff -r 3a5f559194d6 -r 156c4640f10e mk/pkgformat/pkg/pkgformat-vars.mk
--- a/mk/pkgformat/pkg/pkgformat-vars.mk        Sun Jan 12 23:35:01 2020 +0000
+++ b/mk/pkgformat/pkg/pkgformat-vars.mk        Sun Jan 12 23:38:42 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: pkgformat-vars.mk,v 1.7 2017/08/19 00:30:19 jlam Exp $
+# $NetBSD: pkgformat-vars.mk,v 1.8 2020/01/12 23:38:42 joerg Exp $
 #
 # This Makefile fragment is included indirectly by bsd.prefs.mk and
 # defines some variables which must be defined earlier than where
@@ -32,8 +32,11 @@
 LINKFARM_CMD?=         ${PKG_TOOLS_BIN}/linkfarm
 
 # Latest versions of tools required for correct pkgsrc operation.
+.if !empty(USE_PKG_ADMIN_DIGEST:M[Yy][Ee][Ss])
+PKGTOOLS_REQD=         20191008
+.else
 PKGTOOLS_REQD=         20100914
-
+.endif
 # Latest version of pkg_install required to extract packages
 PKGTOOLS_VERSION_REQD= 20091115
 



Home | Main Index | Thread Index | Old Index