Nimbin[12]?Mirrors & Forks / jhalfs / commits / 1bf09c1

jhalfs git · trunk

jhalfs LFS build automation (mirror)

lfs mirror bash · first commit 2005-09-11 · last commit 2024-02-13 (2 years ago) · synced 3 days ago · upstream: git.linuxfromscratch.org/jhalfs

Python 78.4% Shell 19.8% Makefile 1.8%
git clone https://git.christianimmanuel.de/mirrors-forks/jhalfs.gitwget https://git.christianimmanuel.de/mirrors-forks/jhalfs/archive/jhalfs.tar.gz

Implementation of dependency checking 4

Pierre Labastie · 2023-03-23 17:38 · 1bf09c15a7bc85a01a996453bc9d11fa36ba1331

Implement generation of a modified script if dependency checking is
requested.
 BLFS/gen_pkg_book.sh | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/BLFS/gen_pkg_book.sh b/BLFS/gen_pkg_book.sh
index dd8f633..e953013 100755
--- a/BLFS/gen_pkg_book.sh
+++ b/BLFS/gen_pkg_book.sh
@@ -297,4 +297,50 @@ xsltproc --xinclude --nonet                           \
 chmod -R +x scripts
 echo -e "done\n"
 
+if [ -n "$DEP_CHECK" ]; then
+   if (( ${#TARGET[*]} != 1 )); then
+      printf "\nWARNING: If dependencies are checked, only one package\n"
+      printf "         shoud be selected. Not generating check code.\n"
+      exit
+   fi
+
+   LIST_LFS="$(xsltproc $ListLFS $LFS_FULL)"
+   LIST_NEEDED="$(echo $FULL_LIST)"
+   LIST_INSTALLED="$(porg -a | sed 's/-[[:digit:]].*//')"
+   LIST_UNNEEDED=
+   for p in $LIST_INSTALLED; do
+      case " $LIST_LFS " in *" $p "*)  continue ;; esac
+      case " $LIST_NEEDED " in *" $p "*)  continue ;; esac
+      LIST_UNNEEDED="$LIST_UNNEEDED $p"
+   done
+   cat >head.tmp <<EOF
+#!/bin/bash
+set -e
+
+# Remove all unneeded packages
+VERSIONED_LIST=
+for p in $LIST_UNNEEDED; do
+   VERSIONED_LIST="\$VERSIONED_LIST \$(porg \$p)"
+   porg -rb \$p
+done
+
+# Function to restore packages
+restore_pack {
+for p in \$VERSIONED_LIST; do
+   porgball -e -l /var/lib/packages/\${p}.porg.tar.gz
+done
+}
+
+trap restore_pack ERR
+
+EOF
+   cat >tail.tmp <<EOF
+restore_pack
+exit
+EOF
+
+   sed -e "1,2d" -e '$d' scripts/*${TARGET} >script.tmp
+   cat head.tmp script.tmp tail.tmp >scripts/*${TARGET}
+   rm *.tmp
+fi
 #clean_configuration