Adapt func_book_parser to git

The variable name "TREE" makes no sense now. It is rather a branch or a tag.
So more work is needed here.
This commit is contained in:
Pierre Labastie 2021-04-30 14:21:44 +02:00
parent dd5d63d102
commit de67016950

View file

@ -9,22 +9,13 @@ get_book() { #
if [ -z $WORKING_COPY ] ; then if [ -z $WORKING_COPY ] ; then
# Check for Subversion or git instead of just letting the script fail. # Check for Subversion or git instead of just letting the script fail.
case $PROGNAME in
lfs | hlfs)
test `type -p svn` || eval "echo \"This feature requires Subversion.\"
exit 1"
;;
clfs*)
test `type -p git` || eval "echo \"This feature requires Git.\" test `type -p git` || eval "echo \"This feature requires Git.\"
exit 1" exit 1"
;;
esac
echo -n "Downloading the $PROGNAME document, $LFSVRS version... " echo -n "Downloading the $PROGNAME document, $LFSVRS version... "
case $PROGNAME in case $PROGNAME in
lfs) svn_root="LFS" ;; lfs) git_root="lfs.git" ;;
hlfs) svn_root="HLFS" ;;
clfs*) ;; clfs*) ;;
*) echo "BOOK not defined in function <get_book>" *) echo "BOOK not defined in function <get_book>"
exit 1 ;; exit 1 ;;
@ -32,12 +23,7 @@ get_book() { #
# Grab a fresh book if it's missing, otherwise, update it from the # 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 # repo. If we've already extracted the commands, move on to getting the
# sources. # sources.
if [ $PROGNAME == "lfs" ] || [ $PROGNAME == "hlfs" ] && if [ ! -d ${PROGNAME}-${LFSVRS}/.git ]; then
[ ! -d ${PROGNAME}-${LFSVRS}/.svn ]; then
svn co $SVN/${svn_root}/${TREE} ${PROGNAME}-$LFSVRS >>$LOGDIR/$LOG 2>&1
elif [ $PROGNAME == "clfs" ] || [ $PROGNAME == "clfs2" ] ||
[ $PROGNAME == "clfs3" ] && [ ! -d ${PROGNAME}-${LFSVRS}/.git ]; then
echo $TREE
git clone $GIT ${PROGNAME}-$LFSVRS >>$LOGDIR/$LOG 2>&1 git clone $GIT ${PROGNAME}-$LFSVRS >>$LOGDIR/$LOG 2>&1
if [ ! $TREE == "development" ]; then if [ ! $TREE == "development" ]; then
pushd ${PROGNAME}-$LFSVRS > /dev/null pushd ${PROGNAME}-$LFSVRS > /dev/null
@ -47,19 +33,13 @@ get_book() { #
fi fi
else else
cd ${PROGNAME}-$LFSVRS cd ${PROGNAME}-$LFSVRS
case $PROGNAME in
clfs*)
# If the repo is in "detached head" state, git pull fails, so get # If the repo is in "detached head" state, git pull fails, so get
# back first to master: # back first to master:
git checkout master >>$LOGDIR/$LOG 2>&1 git checkout trunk >>$LOGDIR/$LOG 2>&1
git pull >>$LOGDIR/$LOG 2>&1 git pull >>$LOGDIR/$LOG 2>&1
if [ ! $TREE == "development" ]; then if [ ! $TREE == "development" ]; then
git checkout ${TREE} >>$LOGDIR/$LOG 2>&1 git checkout ${TREE} >>$LOGDIR/$LOG 2>&1
fi fi
;;
lfs | hlfs) svn up >>$LOGDIR/$LOG 2>&1 ;;
*) ;;
esac
fi fi
echo -ne "done\n" echo -ne "done\n"