From bee49534af73e91e9522fef0184be5e82d11a3f6 Mon Sep 17 00:00:00 2001
From: Dmitri Konstantinov <dmitri.konstantinov@cern.ch>
Date: Wed, 10 Mar 2021 12:36:14 +0100
Subject: [PATCH] modification of post-install.sh: creation a filtered list
containing actual paths to be replaced
---
cmake/scripts/post-install.sh | 26 ++++++++++++++++++++++++--
1 file changed, 24 insertions(+), 2 deletions(-)
diff --git a/cmake/scripts/post-install.sh b/cmake/scripts/post-install.sh
index 5b66ba376f..7f46c2a644 100755
--- a/cmake/scripts/post-install.sh
+++ b/cmake/scripts/post-install.sh
@@ -27,6 +27,26 @@ fi
echo "Replacing $OLDINSTALLDIR -> $INSTALLDIR [or $LCGRELEASES] ..."
# prepare package list for replacing
+# This part quicly checks using grep if the path is inside of any file, and creates shofter list called "filteredPaths".
+ALLMYFILES=$(cat $PREFIX/$listname | grep -v -- '->' | while read myfile; do
+ test "$myfile" = ".filelist" && continue # skip .filelist
+ echo ${myfile}
+done)
+
+ALLMYFILES=$(echo $ALLMYFILES | tr '\n' ' ' )
+ALLMYFILES=$(echo $ALLMYFILES | tr -s " " )
+
+filteredPaths=$(cat $PREFIX/$listname | grep -- '->'| while read name; do
+ dir2test="$(echo $name | grep -- '->'| awk -F'->' '{print $1}')"
+ dir2test=$(echo $dir2test | tr '\n' ' ' )
+ dir2test=$(echo $dir2test | tr -s " ")
+ IFS=' '
+ grep -q -- "$dir2test" ${ALLMYFILES}
+ retVal=$?
+ if [ $retVal -eq 0 ]; then
+ echo ${name}
+ fi
+done)
# loop over files (lines without '->')
cat $PREFIX/$listname | grep -v -- '->' | while read name; do
@@ -34,10 +54,12 @@ cat $PREFIX/$listname | grep -v -- '->' | while read name; do
#old=$(mktemp -t lcg.XXXXX)
#cp -f "$PREFIX/$name" "$old"
# loop over all target paths (after '->' delimiter)
- cat $PREFIX/$listname | grep -- '->' | awk -F'->' '{print $2}'| sort | uniq | while read newpath; do
+# cat $PREFIX/$listname | grep -- '->' | awk -F'->' '{print $2}'| sort | uniq | while read newpath; do
+ echo $filteredPaths | grep -- '->' | awk -F'->' '{print $2}'| sort | uniq | while read newpath; do
# loop over all source paths for given target path, use sorting by path length to resolve issues like /var/build/... and /build/...
# 1 target path is related with multiple (at least 2 -- real and 'usual') source paths
- cat $PREFIX/$listname | grep -- '->' | grep -- "$newpath" | awk -F'->' '{ print length($1) " " $0; }' | sort -r -n | cut -d ' ' -f 2- | while read line; do
+# cat $PREFIX/$listname | grep -- '->' | grep -- "$newpath" | awk -F'->' '{ print length($1) " " $0; }' | sort -r -n | cut -d ' ' -f 2- | while read line; do
+ echo $filteredPaths | grep -- '->' | grep -- "$newpath" | awk -F'->' '{ print length($1) " " $0; }' | sort -r -n | cut -d ' ' -f 2- | while read line; do
olddir="$(echo $line | awk -F'->' '{print $1}')"
for install_dir in $INSTALLDIR $LCGRELEASES; do
if test -z "$NIGHTLY_MODE"; then
--
GitLab