From 2fd624d8f643cbc941085aac4aa18219b462efe5 Mon Sep 17 00:00:00 2001 From: Pierre Labastie Date: Wed, 30 Mar 2022 14:26:41 +0200 Subject: [PATCH] Get rid of BRANCH_ID, TREE, LFSVRS variables There is only one variable: COMMIT. Note that this commit also changes $PROGNAME-$LFSVRS to $BOOK. --- common/libs/func_book_parser | 30 +++++++++++++++--------------- common/libs/func_install_blfs | 2 +- jhalfs | 23 +---------------------- 3 files changed, 17 insertions(+), 38 deletions(-) diff --git a/common/libs/func_book_parser b/common/libs/func_book_parser index 131766d..d4c39df 100644 --- a/common/libs/func_book_parser +++ b/common/libs/func_book_parser @@ -5,32 +5,32 @@ get_book() { # #----------------------------# cd $JHALFSDIR - if [ -z $WORKING_COPY ] ; then + if [ -z "$WORKING_COPY" ] ; then # Check for Subversion or git instead of just letting the script fail. test `type -p git` || eval "echo \"This feature requires Git.\" exit 1" - echo -n "Downloading the $PROGNAME document, $LFSVRS version... " + echo -n "Downloading the lfs document, $COMMIT commit... " # Grab a fresh book if it's missing, otherwise, update it from the # repo. If we've already extracted the commands, move on to getting the # sources. - if [ ! -d ${PROGNAME}-${LFSVRS}/.git ]; then - git clone $REPO ${PROGNAME}-$LFSVRS >>$LOGDIR/$LOG 2>&1 - if [ ! $TREE == "development" ]; then - pushd ${PROGNAME}-$LFSVRS > /dev/null - echo "Checking out $LFSVRS at $PWD in $TREE" - git checkout ${TREE} >>$LOGDIR/$LOG 2>&1 - popd > /dev/null + if [ ! -d "$BOOK"/.git ]; then + git clone "$REPO" "$BOOK" >>"$LOGDIR/$LOG" 2>&1 + if [ "$COMMIT" != trunk ]; then + pushd "$BOOK" >/dev/null + echo "Checking out $COMMIT at $PWD" + git checkout "$COMMIT" >>"$LOGDIR/$LOG" 2>&1 + popd >/dev/null fi else - cd ${PROGNAME}-$LFSVRS + cd "$BOOK" # If the repo is in "detached head" state, git pull fails, so get - # back first to master: - git checkout trunk >>$LOGDIR/$LOG 2>&1 - git pull >>$LOGDIR/$LOG 2>&1 - if [ ! $TREE == "development" ]; then - git checkout ${TREE} >>$LOGDIR/$LOG 2>&1 + # back first to trunk: + git checkout trunk >>"$LOGDIR/$LOG" 2>&1 + git pull >>"$LOGDIR/$LOG" 2>&1 + if [ "$COMMIT" != "trunk" ]; then + git checkout "$COMMIT" >>"$LOGDIR/$LOG" 2>&1 fi fi echo -ne "done\n" diff --git a/common/libs/func_install_blfs b/common/libs/func_install_blfs index cedf0db..129d33c 100644 --- a/common/libs/func_install_blfs +++ b/common/libs/func_install_blfs @@ -49,7 +49,7 @@ sudo make -j1 -C $BUILDDIR$BLFS_ROOT \ REV=$INITSYS \ TRACKING_DIR=$BUILDDIR$TRACKING_DIR \ LFS_XML=$BUILDDIR$BLFS_ROOT/$LFS_XML \ - LFS-BRANCH=${LFS_TREE} \ + LFS-BRANCH="${COMMIT}" \ BLFS_XML=$BUILDDIR$BLFS_ROOT/$BLFS_XML \ BLFS-BRANCH=${BLFS_TREE} \ $BUILDDIR$BLFS_ROOT/packages.xml diff --git a/jhalfs b/jhalfs index e112dd9..9cac0f7 100755 --- a/jhalfs +++ b/jhalfs @@ -192,29 +192,8 @@ if [[ $JHALFSDIR == "$CWD" ]]; then exit 2 fi -# Book sources envars -BRANCH_ID=${BRANCH_ID:=development} - -case $BRANCH_ID in - development ) - TREE=trunk - LFSVRS=development - ;; - *EDIT* ) echo " You forgot to set the branch or stable book version." - echo " Please rerun make and fix the configuration." - exit 2 ;; - branch-* ) - LFSVRS=${BRANCH_ID} - TREE=${BRANCH_ID#branch-} - ;; - * ) - LFSVRS=${BRANCH_ID} - TREE=${BRANCH_ID} - ;; -esac - # Set the document location... -BOOK=${BOOK:=$JHALFSDIR/$PROGNAME-$LFSVRS} +BOOK=${BOOK:=$JHALFSDIR/book-source} #--- Envars not sourced from configuration