Get rid of BRANCH_ID, TREE, LFSVRS variables

There is only one variable: COMMIT. Note that this commit
also changes $PROGNAME-$LFSVRS to $BOOK.
This commit is contained in:
Pierre Labastie 2022-03-30 14:26:41 +02:00
parent 9f89fae89a
commit 2fd624d8f6
3 changed files with 17 additions and 38 deletions

View file

@ -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
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"

View file

@ -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

23
jhalfs
View file

@ -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