diff options
author | jlam <jlam@pkgsrc.org> | 2017-08-10 05:37:32 +0000 |
---|---|---|
committer | jlam <jlam@pkgsrc.org> | 2017-08-10 05:37:32 +0000 |
commit | 9fa77ed7e82101affafc5e6f25f6d4767e9a04bb (patch) | |
tree | eb55514220f3b7b119be7dccbb3c903634bf8710 /mk | |
parent | 10ea76b4106f0b77b95363d795fd128365be4991 (diff) | |
download | pkgsrc-9fa77ed7e82101affafc5e6f25f6d4767e9a04bb.tar.gz |
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 (limited to 'mk')
-rw-r--r-- | mk/pkgtasks/directories.mk | 7 | ||||
-rw-r--r-- | mk/pkgtasks/files.mk | 15 |
2 files changed, 20 insertions, 2 deletions
diff --git a/mk/pkgtasks/directories.mk b/mk/pkgtasks/directories.mk index 314dfcdc37b..442e798c68f 100644 --- a/mk/pkgtasks/directories.mk +++ b/mk/pkgtasks/directories.mk @@ -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 @@ _REQD_DIRS_PERMS= ${REQD_DIRS_PERMS:S|^${PREFIX}/||g} # 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 --git a/mk/pkgtasks/files.mk b/mk/pkgtasks/files.mk index 858edaf3d51..dab159075ee 100644 --- a/mk/pkgtasks/files.mk +++ b/mk/pkgtasks/files.mk @@ -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 @@ PKG_FAIL_REASON+= ${t:Q}" is listed more than once: "${_FILE_VARLIST.${t}: .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} |