diff options
author | jlam <jlam@pkgsrc.org> | 2003-09-17 02:38:22 +0000 |
---|---|---|
committer | jlam <jlam@pkgsrc.org> | 2003-09-17 02:38:22 +0000 |
commit | 399f83c52684953c1f0a9bb47fc6e1d31bf8e921 (patch) | |
tree | 075c2f5dda579f36707f768f171254501ff90c89 /mk | |
parent | ed80fbf036a40411e1b2b3b1334cbd555e4d6324 (diff) | |
download | pkgsrc-399f83c52684953c1f0a9bb47fc6e1d31bf8e921.tar.gz |
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 (limited to 'mk')
-rw-r--r-- | mk/bsd.pkg.install.mk | 6 | ||||
-rw-r--r-- | mk/bsd.pkg.mk | 16 | ||||
-rw-r--r-- | mk/install/deinstall | 12 | ||||
-rw-r--r-- | mk/install/header | 6 | ||||
-rw-r--r-- | mk/install/install | 40 |
5 files changed, 65 insertions, 15 deletions
diff --git a/mk/bsd.pkg.install.mk b/mk/bsd.pkg.install.mk index db9295ee410..63aba11b8a3 100644 --- a/mk/bsd.pkg.install.mk +++ b/mk/bsd.pkg.install.mk @@ -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 @@ INSTALL_SRC?= ${INSTALL_TEMPLATES} 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+= LN=${LN:Q} 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 --git a/mk/bsd.pkg.mk b/mk/bsd.pkg.mk index 9b8729a868d..c652c2cac74 100644 --- a/mk/bsd.pkg.mk +++ b/mk/bsd.pkg.mk @@ -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 @@ USE_MAKEINFO?= no # default to not using makeinfo . 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 @@ PKG_SYSCONFBASEDIR= ${PKG_SYSCONFBASE} !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 @@ PKG_SYSCONFDIR= ${PKG_SYSCONFBASEDIR}/${PKG_SYSCONFSUBDIR} 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 --git a/mk/install/deinstall b/mk/install/deinstall index 84e70d14a3a..eed6f0533bc 100644 --- a/mk/install/deinstall +++ b/mk/install/deinstall @@ -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 @@ DEINSTALL) 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 @@ POST-DEINSTALL) 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 --git a/mk/install/header b/mk/install/header index a86d04e4b09..4f78b37545f 100644 --- a/mk/install/header +++ b/mk/install/header @@ -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 @@ LN="@LN@" MKDIR="@MKDIR@" MV="@MV@" PERL5="@PERL5@" +PKG_ADMIN="@PKG_ADMIN@" +PKG_INFO="@PKG_INFO@" RM="@RM@" RMDIR="@RMDIR@" SED="@SED@" @@ -49,6 +51,7 @@ PKGBASE="@PKGBASE@" LOCALBASE="@LOCALBASE@" X11BASE="@X11BASE@" +DEPOTBASE="@DEPOTBASE@" PREFIX="@PREFIX@" case ${PKG_PREFIX} in ${LOCALBASE}/*) VIEW="${PKG_PREFIX#${LOCALBASE}/}" ;; @@ -77,6 +80,7 @@ PKG_SYSCONFBASE="@PKG_SYSCONFBASE@" PKG_SYSCONFDEPOTBASE="@PKG_SYSCONFDEPOTBASE@" PKG_SYSCONFBASEDIR="@PKG_SYSCONFBASEDIR@" PKG_SYSCONFDIR="@PKG_SYSCONFDIR@" +CONF_DEPENDS="@CONF_DEPENDS@" case ${VIEW} in "") PKG_SYSCONFVIEWBASE="${PKG_SYSCONFBASE}" ;; diff --git a/mk/install/install b/mk/install/install index fe296488be1..be97abf0bbb 100644 --- a/mk/install/install +++ b/mk/install/install @@ -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 @@ PRE-INSTALL) # 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 @@ EOF 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 @@ EOF 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 @@ EOF 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 @@ EOF 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}" |