diff options
author | jlam <jlam@pkgsrc.org> | 2017-08-07 15:49:44 +0000 |
---|---|---|
committer | jlam <jlam@pkgsrc.org> | 2017-08-07 15:49:44 +0000 |
commit | bd61f892efe6252c11d94ee10386672f93c28a53 (patch) | |
tree | 1ed7efb6e1a349cb85b1977fc7679157b489b026 | |
parent | 7312f711a09a3aa05d6d0fc3ed25771dfdde1e91 (diff) | |
download | pkgsrc-bd61f892efe6252c11d94ee10386672f93c28a53.tar.gz |
Assert INSTALLATION_DIRS begin with ${PREFIX} or are relative.
Add an assertion that all paths listed in INSTALLATION_DIRS must
either begin with ${PREFIX}/ or are relative paths. Clarify in the
documentation that INSTALLATION_DIRS can list either type of path.
Some packages are using INSTALLATION_DIRS to create directory trees
outside of ${PREFIX}, e.g., under ${PKG_SYSCONFBASE} or ${VARBASE}.
However, these directories are only created as part of the
"install" target, which causes them to only be created during the
staged installation into ${DESTDIR} and not at all if their binary
packages are installed. These packages should be fixed to use
MAKE_DIRS or OWN_DIRS to create these directory trees at the proper
time.
-rw-r--r-- | mk/install/install.mk | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/mk/install/install.mk b/mk/install/install.mk index 1a7368bdd0c..efb09fac3a9 100644 --- a/mk/install/install.mk +++ b/mk/install/install.mk @@ -1,4 +1,4 @@ -# $NetBSD: install.mk,v 1.70 2017/06/01 02:15:10 jlam Exp $ +# $NetBSD: install.mk,v 1.71 2017/08/07 15:49:44 jlam Exp $ # # This file provides the code for the "install" phase. # @@ -38,10 +38,11 @@ # # INSTALLATION_DIRS # A list of directories that should be created at the very -# beginning of the install phase. These directories are relative -# to ${PREFIX}. As a convenience, a leading gnu/ is transformed -# to ${PKGGNUDIR} and a leading man/ is transformed to -# ${PKGMANDIR}, to save package authors from typing too much. +# beginning of the install phase. These directories MUST either +# be paths that contain a leading {PREFIX}/ or be relative +# paths. As a convenience, a leading gnu/ is transformed to +# ${PKGGNUDIR} and a leading man/ is transformed to ${PKGMANDIR}, +# to save package authors from typing too much. # # AUTO_MKDIRS # INSTALLATION_DIRS_FROM_PLIST @@ -237,18 +238,28 @@ _INSTALL_ONE_DIR_CMD= { \ esac; \ } +# _INSTALLATION_DIRS +# Contains the items listed in ${INSTALLATION_DIRS} with the +# following transformations performed, in order: +# +# 1. Leading "${PREFIX}/" is stripped. +# 2. Leading "gnu/" is transformed into "${PKGGNUDIR}". +# 3. Leading "man/" is transformed into "${PKGMANDIR}/". +# +# ASSERT: Paths listed in ${_INSTALLATION_DIRS} must be relative paths. +# +_INSTALLATION_DIRS= ${INSTALLATION_DIRS:C,^${PREFIX}/,,:C,^gnu/,${PKGGNUDIR},:C,^man/,${PKGMANDIR}/,} +.if !empty(_INSTALLATION_DIRS:M/*) +PKG_FAIL_REASON+= "INSTALLATION_DIRS items must begin with "${PREFIX:Q}" or be relative paths." +.endif + .PHONY: install-makedirs install-makedirs: ${RUN} ${INSTALL_DATA_DIR} ${DESTDIR}${PREFIX} .if defined(INSTALLATION_DIRS) && !empty(INSTALLATION_DIRS) @${STEP_MSG} "Creating installation directories" ${RUN} \ - for dir in ${INSTALLATION_DIRS:C,^gnu/,${PKGGNUDIR},:C,^man/,${PKGMANDIR}/,}; do \ - case "$$dir" in \ - ${PREFIX}/*) \ - dir=`${ECHO} "$$dir" | ${SED} "s|^${PREFIX}/||"` ;; \ - /*) continue ;; \ - esac; \ + for dir in ${_INSTALLATION_DIRS}; do \ ${_INSTALL_ONE_DIR_CMD}; \ done .endif # INSTALLATION_DIRS |