[jhalfs] 03/03: Fix the logic for -pass1 packages in gen_pkg_book

"Git Owner" ([email protected] via alfs-discuss Mailing List) <[email protected]>
Newsgroups gmane.linux.lfs.automated
Message-ID <[email protected]>
This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch trunk
in repository jhalfs.

commit 7ae97740a8c4bfbc56a8406970ec00899a8b1bd3
Author: Pierre Labastie <[email protected]>
AuthorDate: Thu Dec 16 13:57:01 2021 +0100

    Fix the logic for -pass1 packages in gen_pkg_book
---
 BLFS/gen_pkg_book.sh | 26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/BLFS/gen_pkg_book.sh b/BLFS/gen_pkg_book.sh
index ade0da9..bbde94a 100755
--- a/BLFS/gen_pkg_book.sh
+++ b/BLFS/gen_pkg_book.sh
@@ -207,8 +207,30 @@ popd > /dev/null
 echo Generating the ordered package list
 LIST=
 while read p; do
-    p=${p%-pass1}
-    versions=$(xsltproc --stringparam package "$p" $GetVersion $PackFile)
+    if [ "$p" != "${p%-pass1}" ]; then
+# If the pass2 is installed, no need for pass1. We get its
+# installed version from TRACKFILE; We could use PackFile, but
+# the test would be slightly more complicated.
+echo Treating $p
+        pass2_v=$(xsltproc --stringparam package "${p%-pass1}" \
+                  $GetVersion $TRACKFILE | head -n1)
+echo Found pass2_v=$pass2_v
+        if [ -n "$pass2_v" ]; then continue; fi
+# We need to get the installed version from TRACKFILE
+        inst_v=$(xsltproc --stringparam package "$p" $GetVersion $TRACKFILE | \
+                 head -n1)
+        if [ -z "$inst_v" ]; then inst_v=0; fi
+echo Found inst_v=$inst_v
+# The available version is taken from PackFile
+        avail_v=$(xsltproc --stringparam package "${p%-pass1}" \
+		  $GetVersion $PackFile | head -n1)
+echo Found avail_v=$avail_v
+        versions="$avail_v
+$inst_v"
+	echo which gives versions=$versions
+    else
+        versions=$(xsltproc --stringparam package "$p" $GetVersion $PackFile)
+    fi
     if [ "$versions" != "$(sort -V <<<$versions)" ]; then
         LIST="$LIST $p"
     fi

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

-- 
http://lists.linuxfromscratch.org/sympa/info/alfs-discuss
Unsubscribe: See the above information page
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.