pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mk/pkgtasks mk/pkgtasks: Assert that directories for t...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/85913866373b
branches:  trunk
changeset: 366284:85913866373b
user:      jlam <jlam%pkgsrc.org@localhost>
date:      Thu Aug 10 05:37:32 2017 +0000

description:
mk/pkgtasks: Assert that directories for target files will exist.

For target files listed in CONF_FILES (and other config file
variables), assert that the containing directories are named in
MAKE_DIRS or one of the other directory variables.

diffstat:

 mk/pkgtasks/directories.mk |   7 ++++++-
 mk/pkgtasks/files.mk       |  15 ++++++++++++++-
 2 files changed, 20 insertions(+), 2 deletions(-)

diffs (55 lines):

diff -r 5b778a1cff9e -r 85913866373b mk/pkgtasks/directories.mk
--- a/mk/pkgtasks/directories.mk        Thu Aug 10 05:27:01 2017 +0000
+++ b/mk/pkgtasks/directories.mk        Thu Aug 10 05:37:32 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: directories.mk,v 1.1 2017/06/01 02:06:04 jlam Exp $
+# $NetBSD: directories.mk,v 1.2 2017/08/10 05:37:32 jlam Exp $
 #
 # Copyright (c) 2017 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -98,6 +98,11 @@
 # Assert that the variables have the right number of words and
 # that no directory is listed in more than one variable.
 #
+# _ALL_DIRS.directories
+#      List of directories named in MAKE_DIRS, OWN_DIRS, REQD_DIRS,
+#      MAKE_DIRS_PERMS, OWN_DIRS_PERMS, and REQD_DIRS_PERMS.  This
+#      variable is used in pkgsrc/mk/pkgtasks/files.mk.
+#
 _ALL_DIRS.directories= # empty
 .for _var_ in MAKE_DIRS OWN_DIRS REQD_DIRS
 .  for d in ${${_var_}}
diff -r 5b778a1cff9e -r 85913866373b mk/pkgtasks/files.mk
--- a/mk/pkgtasks/files.mk      Thu Aug 10 05:27:01 2017 +0000
+++ b/mk/pkgtasks/files.mk      Thu Aug 10 05:37:32 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.mk,v 1.4 2017/08/10 05:25:10 jlam Exp $
+# $NetBSD: files.mk,v 1.5 2017/08/10 05:37:32 jlam Exp $
 #
 # Copyright (c) 2017 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -151,11 +151,24 @@
 .if defined(PKG_SYSCONFSUBDIR) && !empty(PKG_SYSCONFSUBDIR)
 # Always create ${PKG_SYSCONFDIR} if ${PKG_SYSCONFSUBDIR} is non-empty.
 MAKE_DIRS_PERMS+=      ${PKG_SYSCONFDIR} ${PKG_SYSCONFDIR_PERMS}
+_ALL_DIRS.directories+=        ${PKG_SYSCONFDIR}
 .elif !empty(_ALL_TARGET_FILES.files:M${PKG_SYSCONFDIR}/*)
 # Create ${PKG_SYSCONFDIR} if any target files are in that directory.
 MAKE_DIRS+=            ${PKG_SYSCONFDIR}
+_ALL_DIRS.directories+=        ${PKG_SYSCONFDIR}
 .endif
 
+# Assert that the directories that contain target files are listed in
+# one of the directory variables.  This makes use of
+# ${_ALL_DIRS.directories}, which is defined in directories.mk.
+#
+.for t in ${_ALL_TARGET_FILES.files:O:u}
+_FILEMATCH.${t}=       ${_ALL_DIRS.directories:@d@${t:M${d}/*}@}
+.  if empty(_FILEMATCH.${t})
+PKG_FAIL_REASON+=      "This package may need MAKE_DIRS+="${t:C|/[^/]*$||:Q}
+.  endif
+.endfor
+
 _PKGTASKS_DATA.files=  ${_PKGTASKS_DIR}/files
 _PKGTASKS_DATAFILES+=  ${_PKGTASKS_DATA.files}
 



Home | Main Index | Thread Index | Old Index