Subject: Repetative OWN_DIRS_PERMS
To: None <tech-pkg@netbsd.org>
From: Mike M. Volokhov <mishka@terabyte.com.ua>
List: tech-pkg
Date: 09/17/2003 22:52:36
Greetings!
Let asssume we are have the following situation:
---- cut ----
USER_DIR_1?= dir1
USER_DIR_2?= dir2
OWN_DIRS_PERMS+= ${USER_DIR_1} foo bar 0755
OWN_DIRS_PERMS+= ${USER_DIR_2} foo bar 0755
BUILD_DEFS= USER_DIR_1 USER_DIR_2
---- cut ----
Then, user can invoke the make(1) as follows:
$ make USER_DIR_1=mydir USER_DIR_2=mydir
In this case "make deinstall" shows two just the same directories:
===========================================================================
If you won't be using foo-0.0 any longer, you may want to remove
* the following directories:
mydir
mydir
===========================================================================
As you can uderstand, this list may be very long. The patch below
tries to improve this situation.
However, it uses some arguments from NetBSD own sort(1), which may
not be allowed anywhere. At the other hand, it would be not bad
provide it (sort) within bootsrap-pkgsrc toolset. Another idea is
use awk(1) for rearrange, resort, and then arrange back this list.
--
BR, Mishka.
Index: deinstall
===================================================================
RCS file: /cvsroot/pkgsrc/mk/install/deinstall,v
retrieving revision 1.22
diff -u -r1.22 deinstall
--- deinstall 2003/09/17 02:38:29 1.22
+++ deinstall 2003/09/17 19:34:27
@@ -146,7 +146,7 @@
${RMDIR} -p `${DIRNAME} ${PKG_SYSCONFDIR}` 2>/dev/null || ${TRUE}
fi
- existing_dirs=''
+ _existing_dirs=''
eval set -- ${ALL_DIRS}
for dir; do
if [ "${_PKG_CONFIG}" = "YES" ]; then
@@ -168,7 +168,7 @@
${ECHO} ${is_make_dir} \
`
if [ ${is_make_dir} -eq 0 -a -d "${dir}" ]; then
- existing_dirs="${existing_dirs} \"${dir}\""
+ _existing_dirs="\"${dir}\" ${_existing_dirs}"
fi
else
case "${dir}" in
@@ -185,12 +185,13 @@
;;
*)
if [ -d "${dir}" ]; then
- existing_dirs="${existing_dirs} \"${dir}\""
+ _existing_dirs="\"${dir}\" ${_existing_dirs}"
fi
;;
esac
fi
done
+ existing_dirs=$(${ECHO} "$_existing_dirs" | ${SORT} -R ' ' -u)
if [ -n "${ALL_USERS}" -o -n "${ALL_GROUPS}" -o \
-n "${modified_files}" -o -n "${existing_dirs}" ]; then