pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mk Introduce a new variable "CONF_DEPENDS" for pkgview...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/1ee45b789596
branches:  trunk
changeset: 461508:1ee45b789596
user:      jlam <jlam%pkgsrc.org@localhost>
date:      Wed Sep 17 02:38:22 2003 +0000

description:
Introduce a new variable "CONF_DEPENDS" for pkgviews: a package's
config directory matches the config directory for the dependency
listed in CONF_DEPENDS.  Use symlinks to physically point the
package's config directory to the dependency's config directory, and
handle all of this in the INSTALL/DEINSTALL scripts.

Also make the INSTALL/DEINSTALL scripts a bit smarter about not
copying files and not removing files if the source and destination
file locations point to the same thing.

diffstat:

 mk/bsd.pkg.install.mk |   6 +++++-
 mk/bsd.pkg.mk         |  16 ++++++++++++++--
 mk/install/deinstall  |  12 ++++++++++--
 mk/install/header     |   6 +++++-
 mk/install/install    |  40 +++++++++++++++++++++++++++++++---------
 5 files changed, 65 insertions(+), 15 deletions(-)

diffs (231 lines):

diff -r a1e531295f72 -r 1ee45b789596 mk/bsd.pkg.install.mk
--- a/mk/bsd.pkg.install.mk     Tue Sep 16 23:46:55 2003 +0000
+++ b/mk/bsd.pkg.install.mk     Wed Sep 17 02:38:22 2003 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkg.install.mk,v 1.51 2003/09/12 05:15:03 jlam Exp $
+# $NetBSD: bsd.pkg.install.mk,v 1.52 2003/09/17 02:38:22 jlam Exp $
 #
 # This Makefile fragment is included by package Makefiles to use the common
 # INSTALL/DEINSTALL scripts.  To use this Makefile fragment, simply:
@@ -62,10 +62,12 @@
 FILES_SUBST+=          PREFIX=${PREFIX}
 FILES_SUBST+=          LOCALBASE=${LOCALBASE}
 FILES_SUBST+=          X11BASE=${X11BASE}
+FILES_SUBST+=          DEPOTBASE=${DEPOTBASE}
 FILES_SUBST+=          PKG_SYSCONFBASE=${PKG_SYSCONFBASE}
 FILES_SUBST+=          PKG_SYSCONFDEPOTBASE=${PKG_SYSCONFDEPOTBASE}
 FILES_SUBST+=          PKG_SYSCONFBASEDIR=${PKG_SYSCONFBASEDIR}
 FILES_SUBST+=          PKG_SYSCONFDIR=${PKG_SYSCONFDIR}
+FILES_SUBST+=          CONF_DEPENDS=${CONF_DEPENDS:C/:.*//:Q}
 FILES_SUBST+=          PKGBASE=${PKGBASE}
 FILES_SUBST+=          PKG_INSTALLATION_TYPE=${PKG_INSTALLATION_TYPE}
 
@@ -251,6 +253,8 @@
 FILES_SUBST+=          MKDIR=${MKDIR:Q}
 FILES_SUBST+=          MV=${MV:Q}
 FILES_SUBST+=          PERL5=${PERL5:Q}
+FILES_SUBST+=          PKG_ADMIN=${PKG_ADMIN_CMD:Q}
+FILES_SUBST+=          PKG_INFO=${PKG_INFO_CMD:Q}
 FILES_SUBST+=          RM=${RM:Q}
 FILES_SUBST+=          RMDIR=${RMDIR:Q}
 FILES_SUBST+=          SED=${SED:Q}
diff -r a1e531295f72 -r 1ee45b789596 mk/bsd.pkg.mk
--- a/mk/bsd.pkg.mk     Tue Sep 16 23:46:55 2003 +0000
+++ b/mk/bsd.pkg.mk     Wed Sep 17 02:38:22 2003 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: bsd.pkg.mk,v 1.1287 2003/09/16 11:45:42 jlam Exp $
+#      $NetBSD: bsd.pkg.mk,v 1.1288 2003/09/17 02:38:22 jlam Exp $
 #
 # This file is in the public domain.
 #
@@ -633,6 +633,15 @@
 . include "../../mk/texinfo.mk"
 .endif
 
+# CONF_DEPENDS notes a dependency where the config directory for the
+# package matches the dependency's config directory.  CONF_DEPENDS is
+# only meaningful if ${PKG_INSTALLATION_TYPE} == "pkgviews".
+#
+CONF_DEPENDS?=         # empty
+.if !empty(CONF_DEPENDS)
+USE_PKGINSTALL=                yes
+.endif
+
 .if defined(USE_PKGINSTALL) && !empty(USE_PKGINSTALL:M[yY][eE][sS])
 .  include "../../mk/bsd.pkg.install.mk"
 .endif
@@ -1243,6 +1252,9 @@
         !empty(PKG_SYSCONFBASE:M${PREFIX}/*)
 PKG_SYSCONFDEPOTBASE=  # empty
 PKG_SYSCONFBASEDIR=    ${PKG_SYSCONFBASE}
+.      if !empty(CONF_DEPENDS)
+_PLIST_IGNORE_FILES+=  ${PKG_SYSCONFDIR:S,^${PREFIX}/,,}
+.      endif
 .    else
 PKG_SYSCONFDEPOTBASE=  ${PKG_SYSCONFBASE}/${DEPOT_SUBDIR}
 PKG_SYSCONFBASEDIR=    ${PKG_SYSCONFDEPOTBASE}/${PKGNAME}
@@ -1257,7 +1269,7 @@
 
 CONFIGURE_ENV+=                PKG_SYSCONFDIR="${PKG_SYSCONFDIR}"
 MAKE_ENV+=             PKG_SYSCONFDIR="${PKG_SYSCONFDIR}"
-BUILD_DEFS+=           PKG_SYSCONFDIR
+BUILD_DEFS+=           PKG_SYSCONFBASEDIR PKG_SYSCONFDIR
 
 # Passed to most of script invocations
 SCRIPTS_ENV+= CURDIR=${.CURDIR} DISTDIR=${DISTDIR} \
diff -r a1e531295f72 -r 1ee45b789596 mk/install/deinstall
--- a/mk/install/deinstall      Tue Sep 16 23:46:55 2003 +0000
+++ b/mk/install/deinstall      Wed Sep 17 02:38:22 2003 +0000
@@ -1,6 +1,6 @@
 # start of deinstall
 #
-# $NetBSD: deinstall,v 1.21 2003/09/13 10:06:36 jlam Exp $
+# $NetBSD: deinstall,v 1.22 2003/09/17 02:38:29 jlam Exp $
 
 eval set -- ${PKG_USERS}
 for userset; do
@@ -116,7 +116,7 @@
                        samplefile="$1"; file="$2"
                        shift; shift
 
-                       if [ "${file}" != "${samplefile}" -a            \
+                       if [ ! "${file}" -ef "${samplefile}" -a         \
                             -e "${file}" -a -e "${samplefile}" ]; then
                                if ${CMP} -s "${file}" "${samplefile}"; then
                                        ${RM} -f "${file}"
@@ -138,6 +138,14 @@
                fi
        done
 
+       if [ "${PKG_INSTALLATION_TYPE}" = "pkgviews" -a                 \
+            "${_PKG_CONFIG}" = "YES" -a -n "${CONF_DEPENDS}" ]; then
+               if [ -h ${PKG_SYSCONFDIR} ]; then
+                       ${RM} -f ${PKG_SYSCONFDIR}
+               fi
+               ${RMDIR} -p `${DIRNAME} ${PKG_SYSCONFDIR}` 2>/dev/null || ${TRUE}
+       fi
+
        existing_dirs=''
        eval set -- ${ALL_DIRS}
        for dir; do
diff -r a1e531295f72 -r 1ee45b789596 mk/install/header
--- a/mk/install/header Tue Sep 16 23:46:55 2003 +0000
+++ b/mk/install/header Wed Sep 17 02:38:22 2003 +0000
@@ -2,7 +2,7 @@
 #
 # start of header
 #
-# $NetBSD: header,v 1.22 2003/09/13 10:06:36 jlam Exp $
+# $NetBSD: header,v 1.23 2003/09/17 02:38:30 jlam Exp $
 
 PKGNAME=$1
 STAGE=$2
@@ -31,6 +31,8 @@
 MKDIR="@MKDIR@"
 MV="@MV@"
 PERL5="@PERL5@"
+PKG_ADMIN="@PKG_ADMIN@"
+PKG_INFO="@PKG_INFO@"
 RM="@RM@"
 RMDIR="@RMDIR@"
 SED="@SED@"
@@ -49,6 +51,7 @@
 
 LOCALBASE="@LOCALBASE@"
 X11BASE="@X11BASE@"
+DEPOTBASE="@DEPOTBASE@"
 PREFIX="@PREFIX@"
 case ${PKG_PREFIX} in
 ${LOCALBASE}/*)        VIEW="${PKG_PREFIX#${LOCALBASE}/}" ;;
@@ -77,6 +80,7 @@
 PKG_SYSCONFDEPOTBASE="@PKG_SYSCONFDEPOTBASE@"
 PKG_SYSCONFBASEDIR="@PKG_SYSCONFBASEDIR@"
 PKG_SYSCONFDIR="@PKG_SYSCONFDIR@"
+CONF_DEPENDS="@CONF_DEPENDS@"
 
 case ${VIEW} in
 "")    PKG_SYSCONFVIEWBASE="${PKG_SYSCONFBASE}" ;;
diff -r a1e531295f72 -r 1ee45b789596 mk/install/install
--- a/mk/install/install        Tue Sep 16 23:46:55 2003 +0000
+++ b/mk/install/install        Wed Sep 17 02:38:22 2003 +0000
@@ -1,6 +1,6 @@
 # start of install
 #
-# $NetBSD: install,v 1.24 2003/09/13 10:06:36 jlam Exp $
+# $NetBSD: install,v 1.25 2003/09/17 02:38:30 jlam Exp $
 
 if [ -z "${CONF_FILES}" -a -z "${CONF_FILES_PERMS}" -a                 \
      -z "${SUPPORT_FILES}" -a -z "${SUPPORT_FILES_PERMS}" -o           \
@@ -108,6 +108,20 @@
 
        # Create package directories at pre-install time.
        #
+       if [ "${PKG_INSTALLATION_TYPE}" = "pkgviews" -a                 \
+            "${_PKG_CONFIG}" = "YES" -a -n "${CONF_DEPENDS}" ]; then
+               pkg=`${PKG_ADMIN} -b -d ${DEPOTBASE} -s "" lsbest "${CONF_DEPENDS}"`
+               sysconfdir=`${PKG_INFO} -B -K ${DEPOTBASE} $pkg |       \
+                       ${AWK} '/^PKG_SYSCONFDIR=/ {                    \
+                               gsub("^PKG_SYSCONFDIR=[         ]*", ""); \
+                               print;                                  \
+                       }'                                              \
+               `
+               if [ -d $sysconfdir -a ! -e ${PKG_SYSCONFDIR} ]; then
+                       ${MKDIR} -p `${DIRNAME} ${PKG_SYSCONFDIR}`
+                       ${LN} -sf $sysconfdir ${PKG_SYSCONFDIR}
+               fi
+       fi
        if [ -n "${MAKE_DIRS}" -o -n "${OWN_DIRS}" -o                   \
             -n "${MAKE_DIRS_PERMS}" -o -n "${OWN_DIRS_PERMS}" ]; then
                eval set -- ${MAKE_DIRS} ${OWN_DIRS}
@@ -227,8 +241,10 @@
                        fi
                        msgadd "#${file} (m=@CONF_FILES_MODE@)"
                elif [ -e "${file}" ]; then
-                       ${ECHO} "    ${file} already exists, example file is"
-                       ${ECHO} "        ${samplefile}"
+                       if [ ! "${file}" -ef "${samplefile}" ]; then
+                               ${ECHO} "    ${file} already exists, example file is"
+                               ${ECHO} "        ${samplefile}"
+                       fi
                else
                        if [ -e "${samplefile}" ]; then
                                ${ECHO} "    ${file}"
@@ -251,8 +267,10 @@
                        fi
                        msgadd "#${file} (m=@SUPPORT_FILES_MODE@)"
                elif [ -e "${file}" ]; then
-                       ${ECHO} "    ${file} already exists, example file is"
-                       ${ECHO} "        ${samplefile}"
+                       if [ ! "${file}" -ef "${samplefile}" ]; then
+                               ${ECHO} "    ${file} already exists, example file is"
+                               ${ECHO} "        ${samplefile}"
+                       fi
                else
                        if [ -e "${samplefile}" ]; then
                                ${ECHO} "    ${file}"
@@ -276,8 +294,10 @@
                        fi
                        msgadd "#${file} (o=${owner}, g=${group}, m=${mode})"
                elif [ -e ${file} ]; then
-                       ${ECHO} "    ${file} already exists, example file is"
-                       ${ECHO} "        ${samplefile}"
+                       if [ ! "${file}" -ef "${samplefile}" ]; then
+                               ${ECHO} "    ${file} already exists, example file is"
+                               ${ECHO} "        ${samplefile}"
+                       fi
                else
                        if [ -e "${samplefile}" ]; then
                                ${ECHO} "    ${file}"
@@ -303,8 +323,10 @@
                        fi
                        msgadd "#${file} (m=@RCD_SCRIPTS_MODE@)"
                elif [ -e "${file}" ]; then
-                       ${ECHO} "    ${file} already exists, example file is"
-                       ${ECHO} "        ${samplefile}"
+                       if [ ! "${file}" -ef "${samplefile}" ]; then
+                               ${ECHO} "    ${file} already exists, example file is"
+                               ${ECHO} "        ${samplefile}"
+                       fi
                else
                        if [ -e "${samplefile}" ]; then
                                ${ECHO} "    ${file}"



Home | Main Index | Thread Index | Old Index