aboutsummaryrefslogtreecommitdiff
path: root/Mk/Scripts/check-stagedir.sh
diff options
context:
space:
mode:
authorMathieu Arnold <mat@FreeBSD.org>2014-01-28 14:16:30 +0000
committerMathieu Arnold <mat@FreeBSD.org>2014-01-28 14:16:30 +0000
commit98f460acc526061a917e8e3c6bb7482188be3ce3 (patch)
tree3c00665e2b39a189a9853b811e06ec553d910dee /Mk/Scripts/check-stagedir.sh
parented596e5185173c1848298bba902f332240bae024 (diff)
downloadports-98f460acc526061a917e8e3c6bb7482188be3ce3.tar.gz
ports-98f460acc526061a917e8e3c6bb7482188be3ce3.zip
Notes
Diffstat (limited to 'Mk/Scripts/check-stagedir.sh')
-rw-r--r--Mk/Scripts/check-stagedir.sh21
1 files changed, 17 insertions, 4 deletions
diff --git a/Mk/Scripts/check-stagedir.sh b/Mk/Scripts/check-stagedir.sh
index 820034028d9f..67a2162e7b5c 100644
--- a/Mk/Scripts/check-stagedir.sh
+++ b/Mk/Scripts/check-stagedir.sh
@@ -24,7 +24,7 @@ esac
# validate environment
envfault=
for i in STAGEDIR PREFIX LOCALBASE WRKDIR WRKSRC MTREE_FILE \
- TMPPLIST DATADIR DOCSDIR EXAMPLESDIR
+ TMPPLIST DOCSDIR EXAMPLESDIR PLIST_SUB
do
if ! ( eval ": \${${i}?}" ) 2>/dev/null ; then
envfault="${envfault}${envfault:+" "}${i}"
@@ -98,14 +98,27 @@ fi
done
} > ${WRKDIR}/.mtree
+for i in $PLIST_SUB
+do
+ echo $i
+done | awk -F= '{print length($2), $1, $2 | "sort -nr" }' | while read l k v
+do
+ if [ $l -ne 0 ]
+ then
+ echo "s,${v},%%${k}%%,g;"
+ fi
+done > ${WRKDIR}/.plist_sub
+
+sed_plist_sub=`cat ${WRKDIR}/.plist_sub`
+
### HANDLE FILES
find ${STAGEDIR} -type f -o -type l | sort | sed -e "s,${STAGEDIR},," >${WRKDIR}/.staged-files
comm -13 ${WRKDIR}/.plist-files ${WRKDIR}/.staged-files \
| sed \
-e "s,${DOCSDIR},%%PORTDOCS%%%%DOCSDIR%%,g" \
-e "s,${EXAMPLESDIR},%%PORTEXAMPLES%%%%EXAMPLESDIR%%,g" \
- -e "s,${DATADIR},%%DATADIR%%,g" \
- -e "s,${PREFIX}/,,g" | grep -v "^share/licenses" || [ $? = 1 ]
+ -e "s,${PREFIX}/,,g" \
+ -e "${sed_plist_sub}" | grep -v "^share/licenses" || [ $? = 1 ]
### HANDLE DIRS
cat ${WRKDIR}/.plist-dirs-unsorted ${WRKDIR}/.mtree | sort -u >${WRKDIR}/.traced-dirs
@@ -115,6 +128,6 @@ comm -13 ${WRKDIR}/.traced-dirs ${WRKDIR}/.staged-dirs \
-e 's,^,@dirrmtry ,' \
-e "s,\(.*\)${DOCSDIR},%%PORTDOCS%%\1%%DOCSDIR%%,g" \
-e "s,\(.*\)${EXAMPLESDIR},%%PORTEXAMPLES%%\1%%EXAMPLESDIR%%,g" \
- -e "s,${DATADIR},%%DATADIR%%,g" \
-e "s,${PREFIX}/,,g" \
+ -e "${sed_plist_sub}" \
-e 's,@dirrmtry \(/.*\),@unexec rmdir >/dev/null 2>\&1 \1 || :,' | grep -v "^@dirrmtry share/licenses" || [ $? = 1 ]