pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mk Define new variables for package Makefile use:



details:   https://anonhg.NetBSD.org/pkgsrc/rev/ea4e2e17f656
branches:  trunk
changeset: 498326:ea4e2e17f656
user:      jlam <jlam%pkgsrc.org@localhost>
date:      Fri Aug 19 22:24:09 2005 +0000

description:
Define new variables for package Makefile use:

        REQD_FILES, REQD_FILES_PERMS, REQD_FILES_MODE
        REQD_DIRS, REQD_DIRS_PERMS

These are the same as the CONF_* variables, except the files and
directories listed in REQD_* are always copied over, created or removed
(taking into account if there are user modifications from the originals,
etc.) regardless of the value of PKG_CONFIG.

The implementation involved pushing the knowledge of PKG_CONFIG,
PKG_RCD_SCRIPTS, PKG_CREATE_USERGROUP, and PKG_REGISTER_SHELLS into
the individual helper scripts.  The helper scripts are now always
invoked by the +INSTALL and +DEINSTALL scripts.  The +DIRS and +FILES
script have been enhanced to understand a new "f" flag that means
"force" to ignore the value of PKG_CONFIG and PKG_RCD_SCRIPTS.

Lastly, the +FILES script has been taught a new "r" flag just for rc.d
scripts and the +RCD_SCRIPTS script is now unnecessary.

diffstat:

 mk/bsd.pkg.check.mk          |    6 +-
 mk/install/bsd.pkginstall.mk |  148 ++++++++++++++++++++++++++++--------------
 mk/install/deinstall         |   36 +++------
 mk/install/dirs              |   37 ++++++++--
 mk/install/files             |   85 ++++++++++++++++--------
 mk/install/header            |   33 +--------
 mk/install/install           |   47 +++++--------
 mk/install/shell             |   18 ++++-
 mk/install/usergroup         |   63 ++++++++++++------
 9 files changed, 277 insertions(+), 196 deletions(-)

diffs (truncated from 876 to 300 lines):

diff -r 63293f10db3a -r ea4e2e17f656 mk/bsd.pkg.check.mk
--- a/mk/bsd.pkg.check.mk       Fri Aug 19 22:07:46 2005 +0000
+++ b/mk/bsd.pkg.check.mk       Fri Aug 19 22:24:09 2005 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkg.check.mk,v 1.11 2005/08/19 22:07:46 jlam Exp $
+# $NetBSD: bsd.pkg.check.mk,v 1.12 2005/08/19 22:24:09 jlam Exp $
 #
 # This Makefile fragment is included by bsd.pkg.mk and defines the
 # relevant variables and targets for the various install-time "check"
@@ -59,10 +59,10 @@
 .endif
 CHECK_FILES_SKIP+=     ${PERL5_INSTALLARCHLIB}/perllocal.pod
 CHECK_FILES_SKIP+=     ${PREFIX}/emul/linux/proc
-.for d in ${MAKE_DIRS} ${OWN_DIRS}
+.for d in ${MAKE_DIRS} ${REQD_DIRS} ${OWN_DIRS}
 CHECK_FILES_SKIP+=     ${d}
 .endfor
-.for d o g m in ${MAKE_DIRS_PERMS} ${OWN_DIRS_PERMS}
+.for d o g m in ${MAKE_DIRS_PERMS} ${REQD_DIRS_PERMS} ${OWN_DIRS_PERMS}
 CHECK_FILES_SKIP+=     ${d}
 .endfor
 _CHECK_FILES_SKIP_FILTER=      ${GREP} -v ${CHECK_FILES_SKIP:@f@-e ${f:Q}@}
diff -r 63293f10db3a -r ea4e2e17f656 mk/install/bsd.pkginstall.mk
--- a/mk/install/bsd.pkginstall.mk      Fri Aug 19 22:07:46 2005 +0000
+++ b/mk/install/bsd.pkginstall.mk      Fri Aug 19 22:24:09 2005 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkginstall.mk,v 1.11 2005/08/19 18:12:38 jlam Exp $
+# $NetBSD: bsd.pkginstall.mk,v 1.12 2005/08/19 22:24:10 jlam Exp $
 #
 # This Makefile fragment is included by bsd.pkg.mk to use the common
 # INSTALL/DEINSTALL scripts.  To use this Makefile fragment, simply:
@@ -261,14 +261,19 @@
 #      MLINKS in the base system.  At post-install time, if the true config
 #      file doesn't exist, then the example one is copied into place.  At
 #      deinstall time, the true one is removed if it doesn't differ from the
-#      example one.
+#      example one.  REQD_FILES is the same as CONF_FILES but the value
+#      of PKG_CONFIG is ignored.
 #
-# CONF_FILES_MODE is the file permissions for the files in CONF_FILES.
+# CONF_FILES_MODE and REQD_FILES_MODE are the file permissions for the
+# files in CONF_FILES and REQD_FILES, respectively.
 #
 # CONF_FILES_PERMS are lists that look like:
+#
 #              example_file config_file user group mode
+#
 #      and works like CONF_FILES, except the config files are owned by
-#      user:group have mode permissions.
+#      user:group have mode permissions.  REQD_FILES_PERMS is the same
+#      as CONF_FILES_PERMS but the value of PKG_CONFIG is ignored.
 #
 # RCD_SCRIPTS works lists the basenames of the rc.d scripts.  They are
 #      expected to be found in ${PREFIX}/share/examples/rc.d, and
@@ -295,15 +300,30 @@
 ${INSTALL_FILES_FILE}: ../../mk/install/files
        ${_PKG_SILENT}${_PKG_DEBUG}${RM} -f ${.TARGET} ${.TARGET}.tmp
        ${_PKG_SILENT}${_PKG_DEBUG}${TEST} -f ${.TARGET}.tmp || {       \
+       case "${RCD_SCRIPTS:M*:Q}" in                                   \
+       "")     ;;                                                      \
+       *)      ${TOUCH} ${TOUCH_FLAGS} ${.TARGET}.tmp ;;               \
+       esac; }
+       ${_PKG_SILENT}${_PKG_DEBUG}${TEST} -f ${.TARGET}.tmp || {       \
        case "${CONF_FILES:M*:Q}" in                                    \
        "")     ;;                                                      \
        *)      ${TOUCH} ${TOUCH_FLAGS} ${.TARGET}.tmp ;;               \
        esac; }
        ${_PKG_SILENT}${_PKG_DEBUG}${TEST} -f ${.TARGET}.tmp || {       \
+       case "${REQD_FILES:M*:Q}" in                                    \
+       "")     ;;                                                      \
+       *)      ${TOUCH} ${TOUCH_FLAGS} ${.TARGET}.tmp ;;               \
+       esac; }
+       ${_PKG_SILENT}${_PKG_DEBUG}${TEST} -f ${.TARGET}.tmp || {       \
        case "${CONF_FILES_PERMS:M*:Q}" in                              \
        "")     ;;                                                      \
        *)      ${TOUCH} ${TOUCH_FLAGS} ${.TARGET}.tmp ;;               \
        esac; }
+       ${_PKG_SILENT}${_PKG_DEBUG}${TEST} -f ${.TARGET}.tmp || {       \
+       case "${REQD_FILES_PERMS:M*:Q}" in                              \
+       "")     ;;                                                      \
+       *)      ${TOUCH} ${TOUCH_FLAGS} ${.TARGET}.tmp ;;               \
+       esac; }
        ${_PKG_SILENT}${_PKG_DEBUG}${TEST} ! -f ${.TARGET}.tmp || {     \
        ${ECHO} "# start of install-files";                             \
        ${ECHO} "#";                                                    \
@@ -319,6 +339,17 @@
        } >> ${.TARGET}.tmp
        ${_PKG_SILENT}${_PKG_DEBUG}${_FUNC_STRIP_PREFIX};               \
        ${TEST} ! -f ${.TARGET}.tmp || {                                \
+       eval set -- __dummy ${RCD_SCRIPTS};                             \
+       while ${TEST} $$# -gt 0; do                                     \
+               if ${TEST} "$$1" = "__dummy"; then shift; continue; fi; \
+               script="$$1"; shift;                                    \
+               file="${RCD_SCRIPTS_DIR:S/^${PREFIX}\///}/$$script";    \
+               egfile="${RCD_SCRIPTS_EXAMPLEDIR}/$$script";            \
+               ${ECHO} "# FILE: $$file cr $$egfile ${RCD_SCRIPTS_MODE}"; \
+       done;                                                           \
+       } >> ${.TARGET}.tmp
+       ${_PKG_SILENT}${_PKG_DEBUG}${_FUNC_STRIP_PREFIX};               \
+       ${TEST} ! -f ${.TARGET}.tmp || {                                \
        eval set -- __dummy ${CONF_FILES};                              \
        while ${TEST} $$# -gt 0; do                                     \
                if ${TEST} "$$1" = "__dummy"; then shift; continue; fi; \
@@ -331,6 +362,18 @@
        } >> ${.TARGET}.tmp
        ${_PKG_SILENT}${_PKG_DEBUG}${_FUNC_STRIP_PREFIX};               \
        ${TEST} ! -f ${.TARGET}.tmp || {                                \
+       eval set -- __dummy ${REQD_FILES};                              \
+       while ${TEST} $$# -gt 0; do                                     \
+               if ${TEST} "$$1" = "__dummy"; then shift; continue; fi; \
+               egfile="$$1"; file="$$2";                               \
+               shift; shift;                                           \
+               egfile=`strip_prefix "$$egfile"`;                       \
+               file=`strip_prefix "$$file"`;                           \
+               ${ECHO} "# FILE: $$file cf $$egfile ${REQD_FILES_MODE}"; \
+       done;                                                           \
+       } >> ${.TARGET}.tmp
+       ${_PKG_SILENT}${_PKG_DEBUG}${_FUNC_STRIP_PREFIX};               \
+       ${TEST} ! -f ${.TARGET}.tmp || {                                \
        eval set -- __dummy ${CONF_FILES_PERMS};                        \
        while ${TEST} $$# -gt 0; do                                     \
                if ${TEST} "$$1" = "__dummy"; then shift; continue; fi; \
@@ -342,6 +385,19 @@
                ${ECHO} "# FILE: $$file c $$egfile $$mode $$owner $$group"; \
        done;                                                           \
        } >> ${.TARGET}.tmp
+       ${_PKG_SILENT}${_PKG_DEBUG}${_FUNC_STRIP_PREFIX};               \
+       ${TEST} ! -f ${.TARGET}.tmp || {                                \
+       eval set -- __dummy ${REQD_FILES_PERMS};                        \
+       while ${TEST} $$# -gt 0; do                                     \
+               if ${TEST} "$$1" = "__dummy"; then shift; continue; fi; \
+               egfile="$$1"; file="$$2";                               \
+               owner="$$3"; group="$$4"; mode="$$5";                   \
+               shift; shift; shift; shift; shift;                      \
+               egfile=`strip_prefix "$$egfile"`;                       \
+               file=`strip_prefix "$$file"`;                           \
+               ${ECHO} "# FILE: $$file cf $$egfile $$mode $$owner $$group"; \
+       done;                                                           \
+       } >> ${.TARGET}.tmp
        ${_PKG_SILENT}${_PKG_DEBUG}${TEST} ! -f ${.TARGET}.tmp || {     \
        ${ECHO} "EOF_FILES";                                            \
        ${ECHO} "       \$${CHMOD} +x ./+FILES";                        \
@@ -354,69 +410,28 @@
        ${MV} -f ${.TARGET}.tmp ${.TARGET}
        ${_PKG_SILENT}${_PKG_DEBUG}${TOUCH} ${TOUCH_FLAGS} ${.TARGET}
 
-INSTALL_RCD_SCRIPTS_FILE=      ${WRKDIR}/.install-rcd-scripts
-INSTALL_UNPACK_TMPL+=          ${INSTALL_RCD_SCRIPTS_FILE}
-
-${INSTALL_RCD_SCRIPTS_FILE}: ../../mk/install/files
-       ${_PKG_SILENT}${_PKG_DEBUG}${RM} -f ${.TARGET} ${.TARGET}.tmp
-       ${_PKG_SILENT}${_PKG_DEBUG}${TEST} -f ${.TARGET}.tmp || {       \
-       case "${RCD_SCRIPTS:M*:Q}" in                                   \
-       "")     ;;                                                      \
-       *)      ${TOUCH} ${TOUCH_FLAGS} ${.TARGET}.tmp ;;               \
-       esac; }
-       ${_PKG_SILENT}${_PKG_DEBUG}${TEST} ! -f ${.TARGET}.tmp || {     \
-       ${ECHO} "# start of install-rcd-scripts";                       \
-       ${ECHO} "#";                                                    \
-       ${ECHO} "# Generate a +RCD_SCRIPTS script that reference counts config"; \
-       ${ECHO} "# files that are required for the proper functioning"; \
-       ${ECHO} "# of the package.";                                    \
-       ${ECHO} "#";                                                    \
-       ${ECHO} "case \$${STAGE} in";                                   \
-       ${ECHO} "PRE-INSTALL|UNPACK)";                                  \
-       ${ECHO} "       \$${CAT} > ./+RCD_SCRIPTS << 'EOF_RCD_SCRIPTS'"; \
-       ${SED} ${FILES_SUBST_SED} ../../mk/install/files;               \
-       ${ECHO} "";                                                     \
-       } >> ${.TARGET}.tmp
-       ${_PKG_SILENT}${_PKG_DEBUG}${_FUNC_STRIP_PREFIX};               \
-       ${TEST} ! -f ${.TARGET}.tmp || {                                \
-       eval set -- __dummy ${RCD_SCRIPTS};                             \
-       while ${TEST} $$# -gt 0; do                                     \
-               if ${TEST} "$$1" = "__dummy"; then shift; continue; fi; \
-               script="$$1"; shift;                                    \
-               file="${RCD_SCRIPTS_DIR:S/^${PREFIX}\///}/$$script";    \
-               egfile="${RCD_SCRIPTS_EXAMPLEDIR}/$$script";            \
-               ${ECHO} "# FILE: $$file c $$egfile ${RCD_SCRIPTS_MODE}"; \
-       done;                                                           \
-       } >> ${.TARGET}.tmp
-       ${_PKG_SILENT}${_PKG_DEBUG}${TEST} ! -f ${.TARGET}.tmp || {     \
-       ${ECHO} "EOF_RCD_SCRIPTS";                                      \
-       ${ECHO} "       \$${CHMOD} +x ./+RCD_SCRIPTS";                  \
-       ${ECHO} "       ;;";                                            \
-       ${ECHO} "esac";                                                 \
-       ${ECHO} "";                                                     \
-       ${ECHO} "# end of install-rcd-scripts";                         \
-       } >> ${.TARGET}.tmp
-       ${_PKG_SILENT}${_PKG_DEBUG}${TEST} ! -f ${.TARGET}.tmp ||       \
-       ${MV} -f ${.TARGET}.tmp ${.TARGET}
-       ${_PKG_SILENT}${_PKG_DEBUG}${TOUCH} ${TOUCH_FLAGS} ${.TARGET}
-
 # OWN_DIRS contains a list of directories for this package that should be
 #       created and should attempt to be destroyed by the INSTALL/DEINSTALL
 #      scripts.  MAKE_DIRS is used the same way, but the package admin
 #      isn't prompted to remove the directory at post-deinstall time if it
-#      isn't empty.
+#      isn't empty.  REQD_DIRS is like MAKE_DIRS but the value of PKG_CONFIG
+#      is ignored.
 #
 # OWN_DIRS_PERMS contains a list of "directory owner group mode" sublists
 #      representing directories for this package that should be
 #      created/destroyed by the INSTALL/DEINSTALL scripts.  MAKE_DIRS_PERMS
 #      is used the same way but the package admin isn't prompted to remove
 #      the directory at post-deinstall time if it isn't empty.
+#      REQD_DIRS_PERMS is like MAKE_DIRS but the value of PKG_CONFIG is
+#      ignored.
 #
 # If any directory pathnames are relative, then they are taken to be
 # relative to ${PREFIX}.
 #
 MAKE_DIRS?=            # empty
 MAKE_DIRS_PERMS?=      # empty
+REQD_DIRS?=            # empty
+REQD_DIRS_PERMS?=      # empty
 OWN_DIRS?=             # empty
 OWN_DIRS_PERMS?=       # empty
 
@@ -451,6 +466,11 @@
        *)      ${TOUCH} ${TOUCH_FLAGS} ${.TARGET}.tmp ;;               \
        esac; }
        ${_PKG_SILENT}${_PKG_DEBUG}${TEST} -f ${.TARGET}.tmp || {       \
+       case "${REQD_DIRS:M*:Q}" in                                     \
+       "")     ;;                                                      \
+       *)      ${TOUCH} ${TOUCH_FLAGS} ${.TARGET}.tmp ;;               \
+       esac; }
+       ${_PKG_SILENT}${_PKG_DEBUG}${TEST} -f ${.TARGET}.tmp || {       \
        case "${OWN_DIRS:M*:Q}" in                                      \
        "")     ;;                                                      \
        *)      ${TOUCH} ${TOUCH_FLAGS} ${.TARGET}.tmp ;;               \
@@ -461,6 +481,11 @@
        *)      ${TOUCH} ${TOUCH_FLAGS} ${.TARGET}.tmp ;;               \
        esac; }
        ${_PKG_SILENT}${_PKG_DEBUG}${TEST} -f ${.TARGET}.tmp || {       \
+       case "${REQD_DIRS_PERMS:M*:Q}" in                               \
+       "")     ;;                                                      \
+       *)      ${TOUCH} ${TOUCH_FLAGS} ${.TARGET}.tmp ;;               \
+       esac; }
+       ${_PKG_SILENT}${_PKG_DEBUG}${TEST} -f ${.TARGET}.tmp || {       \
        case "${OWN_DIRS_PERMS:M*:Q}" in                                \
        "")     ;;                                                      \
        *)      ${TOUCH} ${TOUCH_FLAGS} ${.TARGET}.tmp ;;               \
@@ -502,6 +527,16 @@
        } >> ${.TARGET}.tmp
        ${_PKG_SILENT}${_PKG_DEBUG}${_FUNC_STRIP_PREFIX};               \
        ${TEST} ! -f ${.TARGET}.tmp || {                                \
+       eval set -- __dummy ${REQD_DIRS};                               \
+       while ${TEST} $$# -gt 0; do                                     \
+               if ${TEST} "$$1" = "__dummy"; then shift; continue; fi; \
+               dir="$$1"; shift;                                       \
+               dir=`strip_prefix "$$dir"`;                             \
+               ${ECHO} "# DIR: $$dir fm";                              \
+       done;                                                           \
+       } >> ${.TARGET}.tmp
+       ${_PKG_SILENT}${_PKG_DEBUG}${_FUNC_STRIP_PREFIX};               \
+       ${TEST} ! -f ${.TARGET}.tmp || {                                \
        eval set -- __dummy ${OWN_DIRS};                                \
        while ${TEST} $$# -gt 0; do                                     \
                if ${TEST} "$$1" = "__dummy"; then shift; continue; fi; \
@@ -523,6 +558,17 @@
        } >> ${.TARGET}.tmp
        ${_PKG_SILENT}${_PKG_DEBUG}${_FUNC_STRIP_PREFIX};               \
        ${TEST} ! -f ${.TARGET}.tmp || {                                \
+       eval set -- __dummy ${REQD_DIRS_PERMS};                         \
+       while ${TEST} $$# -gt 0; do                                     \
+               if ${TEST} "$$1" = "__dummy"; then shift; continue; fi; \
+               dir="$$1"; owner="$$2"; group="$$3"; mode="$$4";        \
+               shift; shift; shift; shift;                             \
+               dir=`strip_prefix "$$dir"`;                             \
+               ${ECHO} "# DIR: $$dir fm $$owner $$group $$mode";       \
+       done;                                                           \
+       } >> ${.TARGET}.tmp
+       ${_PKG_SILENT}${_PKG_DEBUG}${_FUNC_STRIP_PREFIX};               \
+       ${TEST} ! -f ${.TARGET}.tmp || {                                \
        eval set -- __dummy ${OWN_DIRS_PERMS};                          \
        while ${TEST} $$# -gt 0; do                                     \
                if ${TEST} "$$1" = "__dummy"; then shift; continue; fi; \
diff -r 63293f10db3a -r ea4e2e17f656 mk/install/deinstall
--- a/mk/install/deinstall      Fri Aug 19 22:07:46 2005 +0000
+++ b/mk/install/deinstall      Fri Aug 19 22:24:09 2005 +0000
@@ -1,12 +1,12 @@
 # -*- sh -*-
 # start of deinstall
 #
-# $NetBSD: deinstall,v 1.35 2005/07/29 18:32:18 jlam Exp $
+# $NetBSD: deinstall,v 1.36 2005/08/19 22:24:10 jlam Exp $
 
 case ${STAGE} in
 VIEW-DEINSTALL)
        case ${_PKG_CONFIG} in
-       YES)
+       yes)
                case ${PKG_SYSCONFDEPOTBASE} in
                "")
                        ${TEST} ! -x ./+FILES ||
@@ -23,10 +23,8 @@
        #
        # Remove shells from /etc/shells.
        #
-       case ${_PKG_REGISTER_SHELLS} in



Home | Main Index | Thread Index | Old Index