pkgsrc-Changes archive

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

CVS commit: pkgsrc/mk/install



Module Name:    pkgsrc
Committed By:   jlam
Date:           Mon Aug  7 15:49:44 UTC 2017

Modified Files:
        pkgsrc/mk/install: install.mk

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 pkgsrc/mk/install/install.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/mk/install/install.mk
diff -u pkgsrc/mk/install/install.mk:1.70 pkgsrc/mk/install/install.mk:1.71
--- pkgsrc/mk/install/install.mk:1.70   Thu Jun  1 02:15:10 2017
+++ pkgsrc/mk/install/install.mk        Mon Aug  7 15:49:44 2017
@@ -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



Home | Main Index | Thread Index | Old Index