mk/pkgtasks: Make the assertion comments more obvious.diff -r1.2 -r1.3 pkgsrc/mk/pkgtasks/directories.mk
(jlam)
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | # $NetBSD: directories.mk,v 1.2 2017/08/10 05:37:32 jlam Exp $ | 1 | # $NetBSD: directories.mk,v 1.3 2017/08/10 05:37:44 jlam Exp $ | |
2 | # | 2 | # | |
3 | # Copyright (c) 2017 The NetBSD Foundation, Inc. | 3 | # Copyright (c) 2017 The NetBSD Foundation, Inc. | |
4 | # All rights reserved. | 4 | # All rights reserved. | |
5 | # | 5 | # | |
6 | # This code is derived from software contributed to The NetBSD Foundation | 6 | # This code is derived from software contributed to The NetBSD Foundation | |
7 | # by Johnny C. Lam. | 7 | # by Johnny C. Lam. | |
8 | # | 8 | # | |
9 | # Redistribution and use in source and binary forms, with or without | 9 | # Redistribution and use in source and binary forms, with or without | |
10 | # modification, are permitted provided that the following conditions | 10 | # modification, are permitted provided that the following conditions | |
11 | # are met: | 11 | # are met: | |
12 | # 1. Redistributions of source code must retain the above copyright | 12 | # 1. Redistributions of source code must retain the above copyright | |
13 | # notice, this list of conditions and the following disclaimer. | 13 | # notice, this list of conditions and the following disclaimer. | |
14 | # 2. Redistributions in binary form must reproduce the above copyright | 14 | # 2. Redistributions in binary form must reproduce the above copyright | |
@@ -85,28 +85,28 @@ _PKGTASKS_DATAVARS.directories= \ | @@ -85,28 +85,28 @@ _PKGTASKS_DATAVARS.directories= \ | |||
85 | . if !empty(${_var_}) | 85 | . if !empty(${_var_}) | |
86 | USE_PKGTASKS= yes | 86 | USE_PKGTASKS= yes | |
87 | . endif | 87 | . endif | |
88 | .endfor | 88 | .endfor | |
89 | 89 | |||
90 | # Strip leading "${PREFIX}/" from the directory pathnames. | 90 | # Strip leading "${PREFIX}/" from the directory pathnames. | |
91 | _MAKE_DIRS= ${MAKE_DIRS:S|^${PREFIX}/||g} | 91 | _MAKE_DIRS= ${MAKE_DIRS:S|^${PREFIX}/||g} | |
92 | _MAKE_DIRS_PERMS= ${MAKE_DIRS_PERMS:S|^${PREFIX}/||g} | 92 | _MAKE_DIRS_PERMS= ${MAKE_DIRS_PERMS:S|^${PREFIX}/||g} | |
93 | _OWN_DIRS= ${OWN_DIRS:S|^${PREFIX}/||g} | 93 | _OWN_DIRS= ${OWN_DIRS:S|^${PREFIX}/||g} | |
94 | _OWN_DIRS_PERMS= ${OWN_DIRS_PERMS:S|^${PREFIX}/||g} | 94 | _OWN_DIRS_PERMS= ${OWN_DIRS_PERMS:S|^${PREFIX}/||g} | |
95 | _REQD_DIRS= ${REQD_DIRS:S|^${PREFIX}/||g} | 95 | _REQD_DIRS= ${REQD_DIRS:S|^${PREFIX}/||g} | |
96 | _REQD_DIRS_PERMS= ${REQD_DIRS_PERMS:S|^${PREFIX}/||g} | 96 | _REQD_DIRS_PERMS= ${REQD_DIRS_PERMS:S|^${PREFIX}/||g} | |
97 | 97 | |||
98 | # Assert that the variables have the right number of words and | 98 | # ASSERT: The variables have the right number of words and that no | |
99 | # that no directory is listed in more than one variable. | 99 | # directory is listed in more than one variable. | |
100 | # | 100 | # | |
101 | # _ALL_DIRS.directories | 101 | # _ALL_DIRS.directories | |
102 | # List of directories named in MAKE_DIRS, OWN_DIRS, REQD_DIRS, | 102 | # List of directories named in MAKE_DIRS, OWN_DIRS, REQD_DIRS, | |
103 | # MAKE_DIRS_PERMS, OWN_DIRS_PERMS, and REQD_DIRS_PERMS. This | 103 | # MAKE_DIRS_PERMS, OWN_DIRS_PERMS, and REQD_DIRS_PERMS. This | |
104 | # variable is used in pkgsrc/mk/pkgtasks/files.mk. | 104 | # variable is used in pkgsrc/mk/pkgtasks/files.mk. | |
105 | # | 105 | # | |
106 | _ALL_DIRS.directories= # empty | 106 | _ALL_DIRS.directories= # empty | |
107 | .for _var_ in MAKE_DIRS OWN_DIRS REQD_DIRS | 107 | .for _var_ in MAKE_DIRS OWN_DIRS REQD_DIRS | |
108 | . for d in ${${_var_}} | 108 | . for d in ${${_var_}} | |
109 | _DIRS.${d}+= ${_var_} | 109 | _DIRS.${d}+= ${_var_} | |
110 | _ALL_DIRS.directories+= ${d} | 110 | _ALL_DIRS.directories+= ${d} | |
111 | . endfor | 111 | . endfor | |
112 | .endfor | 112 | .endfor |
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | # $NetBSD: files.mk,v 1.5 2017/08/10 05:37:32 jlam Exp $ | 1 | # $NetBSD: files.mk,v 1.6 2017/08/10 05:37:44 jlam Exp $ | |
2 | # | 2 | # | |
3 | # Copyright (c) 2017 The NetBSD Foundation, Inc. | 3 | # Copyright (c) 2017 The NetBSD Foundation, Inc. | |
4 | # All rights reserved. | 4 | # All rights reserved. | |
5 | # | 5 | # | |
6 | # This code is derived from software contributed to The NetBSD Foundation | 6 | # This code is derived from software contributed to The NetBSD Foundation | |
7 | # by Johnny C. Lam. | 7 | # by Johnny C. Lam. | |
8 | # | 8 | # | |
9 | # Redistribution and use in source and binary forms, with or without | 9 | # Redistribution and use in source and binary forms, with or without | |
10 | # modification, are permitted provided that the following conditions | 10 | # modification, are permitted provided that the following conditions | |
11 | # are met: | 11 | # are met: | |
12 | # 1. Redistributions of source code must retain the above copyright | 12 | # 1. Redistributions of source code must retain the above copyright | |
13 | # notice, this list of conditions and the following disclaimer. | 13 | # notice, this list of conditions and the following disclaimer. | |
14 | # 2. Redistributions in binary form must reproduce the above copyright | 14 | # 2. Redistributions in binary form must reproduce the above copyright | |
@@ -97,28 +97,28 @@ _PKGTASKS_DATAVARS.files+= \ | @@ -97,28 +97,28 @@ _PKGTASKS_DATAVARS.files+= \ | |||
97 | . if !empty(${_var_}) | 97 | . if !empty(${_var_}) | |
98 | USE_PKGTASKS= yes | 98 | USE_PKGTASKS= yes | |
99 | . endif | 99 | . endif | |
100 | .endfor | 100 | .endfor | |
101 | 101 | |||
102 | # Strip leading "${PREFIX}/" from the file pathnames. | 102 | # Strip leading "${PREFIX}/" from the file pathnames. | |
103 | _CONF_FILES= ${CONF_FILES:S|^${PREFIX}/||g} | 103 | _CONF_FILES= ${CONF_FILES:S|^${PREFIX}/||g} | |
104 | _CONF_FILES_PERMS= ${CONF_FILES_PERMS:S|^${PREFIX}/||g} | 104 | _CONF_FILES_PERMS= ${CONF_FILES_PERMS:S|^${PREFIX}/||g} | |
105 | _REQD_FILES= ${REQD_FILES:S|^${PREFIX}/||g} | 105 | _REQD_FILES= ${REQD_FILES:S|^${PREFIX}/||g} | |
106 | _REQD_FILES_PERMS= ${REQD_FILES_PERMS:S|^${PREFIX}/||g} | 106 | _REQD_FILES_PERMS= ${REQD_FILES_PERMS:S|^${PREFIX}/||g} | |
107 | __INIT_SCRIPTS= ${_INIT_SCRIPTS:S|^${PREFIX}/||g} | 107 | __INIT_SCRIPTS= ${_INIT_SCRIPTS:S|^${PREFIX}/||g} | |
108 | __INIT_SCRIPTS_PERMS= ${_INIT_SCRIPTS_PERMS:S|^${PREFIX}/||g} | 108 | __INIT_SCRIPTS_PERMS= ${_INIT_SCRIPTS_PERMS:S|^${PREFIX}/||g} | |
109 | 109 | |||
110 | # Assert that the variables have the right number of words and | 110 | # ASSERT: The variables have the right number of words and that | |
111 | # that no target file is listed in more than one variable. | 111 | # no target file is listed in more than one variable. | |
112 | # | 112 | # | |
113 | _ALL_TARGET_FILES.files= # empty | 113 | _ALL_TARGET_FILES.files= # empty | |
114 | .for _var_ in CONF_FILES REQD_FILES _INIT_SCRIPTS | 114 | .for _var_ in CONF_FILES REQD_FILES _INIT_SCRIPTS | |
115 | . if empty(${_var_}) || empty(${_var_}:C/.*/2/:M*:S/2 2//gW) | 115 | . if empty(${_var_}) || empty(${_var_}:C/.*/2/:M*:S/2 2//gW) | |
116 | # ${_var_} has a multiple of 2 words. | 116 | # ${_var_} has a multiple of 2 words. | |
117 | . for s t in ${${_var_}} | 117 | . for s t in ${${_var_}} | |
118 | _FILE_VARLIST.${t}+= ${_var_} | 118 | _FILE_VARLIST.${t}+= ${_var_} | |
119 | _ALL_TARGET_FILES.files+= ${t} | 119 | _ALL_TARGET_FILES.files+= ${t} | |
120 | . endfor | 120 | . endfor | |
121 | . else | 121 | . else | |
122 | PKG_FAIL_REASON+= ${_var_:Q}" must have a multiple of 2 words." | 122 | PKG_FAIL_REASON+= ${_var_:Q}" must have a multiple of 2 words." | |
123 | . endif | 123 | . endif | |
124 | .endfor | 124 | .endfor | |
@@ -148,29 +148,29 @@ PKG_FAIL_REASON+= ${t:Q}" is liste | @@ -148,29 +148,29 @@ PKG_FAIL_REASON+= ${t:Q}" is liste | |||
148 | # PKG_SYSCONFDIR_PERMS | 148 | # PKG_SYSCONFDIR_PERMS | |
149 | # PKG_SYSCONFSUBDIR | 149 | # PKG_SYSCONFSUBDIR | |
150 | # | 150 | # | |
151 | .if defined(PKG_SYSCONFSUBDIR) && !empty(PKG_SYSCONFSUBDIR) | 151 | .if defined(PKG_SYSCONFSUBDIR) && !empty(PKG_SYSCONFSUBDIR) | |
152 | # Always create ${PKG_SYSCONFDIR} if ${PKG_SYSCONFSUBDIR} is non-empty. | 152 | # Always create ${PKG_SYSCONFDIR} if ${PKG_SYSCONFSUBDIR} is non-empty. | |
153 | MAKE_DIRS_PERMS+= ${PKG_SYSCONFDIR} ${PKG_SYSCONFDIR_PERMS} | 153 | MAKE_DIRS_PERMS+= ${PKG_SYSCONFDIR} ${PKG_SYSCONFDIR_PERMS} | |
154 | _ALL_DIRS.directories+= ${PKG_SYSCONFDIR} | 154 | _ALL_DIRS.directories+= ${PKG_SYSCONFDIR} | |
155 | .elif !empty(_ALL_TARGET_FILES.files:M${PKG_SYSCONFDIR}/*) | 155 | .elif !empty(_ALL_TARGET_FILES.files:M${PKG_SYSCONFDIR}/*) | |
156 | # Create ${PKG_SYSCONFDIR} if any target files are in that directory. | 156 | # Create ${PKG_SYSCONFDIR} if any target files are in that directory. | |
157 | MAKE_DIRS+= ${PKG_SYSCONFDIR} | 157 | MAKE_DIRS+= ${PKG_SYSCONFDIR} | |
158 | _ALL_DIRS.directories+= ${PKG_SYSCONFDIR} | 158 | _ALL_DIRS.directories+= ${PKG_SYSCONFDIR} | |
159 | .endif | 159 | .endif | |
160 | 160 | |||
161 | # Assert that the directories that contain target files are listed in | 161 | # ASSERT: The directories that contain target files are listed in | |
162 | # one of the directory variables. This makes use of | 162 | # one of the directory variables. This makes use of | |
163 | # ${_ALL_DIRS.directories}, which is defined in directories.mk. | 163 | # ${_ALL_DIRS.directories}, which is defined in directories.mk. | |
164 | # | 164 | # | |
165 | .for t in ${_ALL_TARGET_FILES.files:O:u} | 165 | .for t in ${_ALL_TARGET_FILES.files:O:u} | |
166 | _FILEMATCH.${t}= ${_ALL_DIRS.directories:@d@${t:M${d}/*}@} | 166 | _FILEMATCH.${t}= ${_ALL_DIRS.directories:@d@${t:M${d}/*}@} | |
167 | . if empty(_FILEMATCH.${t}) | 167 | . if empty(_FILEMATCH.${t}) | |
168 | PKG_FAIL_REASON+= "This package may need MAKE_DIRS+="${t:C|/[^/]*$||:Q} | 168 | PKG_FAIL_REASON+= "This package may need MAKE_DIRS+="${t:C|/[^/]*$||:Q} | |
169 | . endif | 169 | . endif | |
170 | .endfor | 170 | .endfor | |
171 | 171 | |||
172 | _PKGTASKS_DATA.files= ${_PKGTASKS_DIR}/files | 172 | _PKGTASKS_DATA.files= ${_PKGTASKS_DIR}/files | |
173 | _PKGTASKS_DATAFILES+= ${_PKGTASKS_DATA.files} | 173 | _PKGTASKS_DATAFILES+= ${_PKGTASKS_DATA.files} | |
174 | 174 | |||
175 | ${_PKGTASKS_DATA.files}: | 175 | ${_PKGTASKS_DATA.files}: | |
176 | ${RUN}${MKDIR} ${.TARGET:H:Q} | 176 | ${RUN}${MKDIR} ${.TARGET:H:Q} |
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | # $NetBSD: permissions.mk,v 1.1 2017/06/01 02:06:04 jlam Exp $ | 1 | # $NetBSD: permissions.mk,v 1.2 2017/08/10 05:37:44 jlam Exp $ | |
2 | # | 2 | # | |
3 | # Copyright (c) 2017 The NetBSD Foundation, Inc. | 3 | # Copyright (c) 2017 The NetBSD Foundation, Inc. | |
4 | # All rights reserved. | 4 | # All rights reserved. | |
5 | # | 5 | # | |
6 | # This code is derived from software contributed to The NetBSD Foundation | 6 | # This code is derived from software contributed to The NetBSD Foundation | |
7 | # by Johnny C. Lam. | 7 | # by Johnny C. Lam. | |
8 | # | 8 | # | |
9 | # Redistribution and use in source and binary forms, with or without | 9 | # Redistribution and use in source and binary forms, with or without | |
10 | # modification, are permitted provided that the following conditions | 10 | # modification, are permitted provided that the following conditions | |
11 | # are met: | 11 | # are met: | |
12 | # 1. Redistributions of source code must retain the above copyright | 12 | # 1. Redistributions of source code must retain the above copyright | |
13 | # notice, this list of conditions and the following disclaimer. | 13 | # notice, this list of conditions and the following disclaimer. | |
14 | # 2. Redistributions in binary form must reproduce the above copyright | 14 | # 2. Redistributions in binary form must reproduce the above copyright | |
@@ -78,27 +78,27 @@ _SPECIAL_PERMS= ${SPECIAL_PERMS:S|^${PR | @@ -78,27 +78,27 @@ _SPECIAL_PERMS= ${SPECIAL_PERMS:S|^${PR | |||
78 | # | 78 | # | |
79 | # REQD_DIRS_PERMS+= /path/to/scoredir ${GAMEDIR_PERMS} | 79 | # REQD_DIRS_PERMS+= /path/to/scoredir ${GAMEDIR_PERMS} | |
80 | # REQD_FILES_PERMS+= /dev/null /path/to/scorefile ${GAMEDATA_PERMS} | 80 | # REQD_FILES_PERMS+= /dev/null /path/to/scorefile ${GAMEDATA_PERMS} | |
81 | # | 81 | # | |
82 | # Keywords: setuid setgid st_mode perms | 82 | # Keywords: setuid setgid st_mode perms | |
83 | # | 83 | # | |
84 | _SYS_VARS.pkgtasks+= SETUID_ROOT_PERMS SETGID_GAMES_PERMS \ | 84 | _SYS_VARS.pkgtasks+= SETUID_ROOT_PERMS SETGID_GAMES_PERMS \ | |
85 | GAMEDATA_PERMS GAMEDIR_PERMS | 85 | GAMEDATA_PERMS GAMEDIR_PERMS | |
86 | SETUID_ROOT_PERMS?= ${REAL_ROOT_USER} ${REAL_ROOT_GROUP} 4511 | 86 | SETUID_ROOT_PERMS?= ${REAL_ROOT_USER} ${REAL_ROOT_GROUP} 4511 | |
87 | SETGID_GAMES_PERMS?= ${GAMES_USER} ${GAMES_GROUP} ${GAMEMODE} | 87 | SETGID_GAMES_PERMS?= ${GAMES_USER} ${GAMES_GROUP} ${GAMEMODE} | |
88 | GAMEDATA_PERMS?= ${GAMES_USER} ${GAMES_GROUP} ${GAMEDATAMODE} | 88 | GAMEDATA_PERMS?= ${GAMES_USER} ${GAMES_GROUP} ${GAMEDATAMODE} | |
89 | GAMEDIR_PERMS?= ${GAMES_USER} ${GAMES_GROUP} ${GAMEDIRMODE} | 89 | GAMEDIR_PERMS?= ${GAMES_USER} ${GAMES_GROUP} ${GAMEDIRMODE} | |
90 | 90 | |||
91 | # Assert that the variables have the right number of words. | 91 | # ASSERT: The variables have the right number of words. | |
92 | .for _var_ in SPECIAL_PERMS | 92 | .for _var_ in SPECIAL_PERMS | |
93 | . if empty(${_var_}) || empty(${_var_}:C/.*/4/:M*:S/4 4 4 4//gW) | 93 | . if empty(${_var_}) || empty(${_var_}:C/.*/4/:M*:S/4 4 4 4//gW) | |
94 | # ${_var_} has a multiple of 4 words. | 94 | # ${_var_} has a multiple of 4 words. | |
95 | . else | 95 | . else | |
96 | PKG_FAIL_REASON+= ${_var_:Q}" must have a multiple of 4 words." | 96 | PKG_FAIL_REASON+= ${_var_:Q}" must have a multiple of 4 words." | |
97 | . endif | 97 | . endif | |
98 | .endfor | 98 | .endfor | |
99 | 99 | |||
100 | _PKGTASKS_DATA.permissions= ${_PKGTASKS_DIR}/permissions | 100 | _PKGTASKS_DATA.permissions= ${_PKGTASKS_DIR}/permissions | |
101 | _PKGTASKS_DATAFILES+= ${_PKGTASKS_DATA.permissions} | 101 | _PKGTASKS_DATAFILES+= ${_PKGTASKS_DATA.permissions} | |
102 | 102 | |||
103 | ${_PKGTASKS_DATA.permissions}: | 103 | ${_PKGTASKS_DATA.permissions}: | |
104 | ${RUN}${MKDIR} ${.TARGET:H:Q} | 104 | ${RUN}${MKDIR} ${.TARGET:H:Q} |