From de57ef4f16bc6c5961b465b883b8178d423d0d92 Mon Sep 17 00:00:00 2001 From: Pierre Labastie Date: Sat, 1 Apr 2017 11:05:15 +0000 Subject: [PATCH] Fix issue with clfs, when using a tag in git, and not checking "Rebuild files": git pull fails because the local repo is in "detached head" state. - fix an issue with iputils patch in clfs-3.0.0 --- common/libs/func_book_parser | 32 +++++++++++++++++++++++--------- common/urls.xsl | 3 +++ 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/common/libs/func_book_parser b/common/libs/func_book_parser index 1f354c2..e0cbc32 100644 --- a/common/libs/func_book_parser +++ b/common/libs/func_book_parser @@ -8,9 +8,18 @@ get_book() { # cd $JHALFSDIR if [ -z $WORKING_COPY ] ; then -# Check for Subversion instead of just letting the script hit 'svn' and fail. - test `type -p svn` || eval "echo \"This feature requires Subversion.\" - exit 1" +# 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.\" + exit 1" + ;; + esac + echo -n "Downloading the $PROGNAME document, $LFSVRS version... " case $PROGNAME in @@ -31,17 +40,22 @@ get_book() { # echo $TREE git clone $GIT ${PROGNAME}-$LFSVRS >>$LOGDIR/$LOG 2>&1 if [ ! $TREE == "development" ]; then - cd ${PROGNAME}-$LFSVRS + pushd ${PROGNAME}-$LFSVRS > /dev/null echo "Checking out $LFSVRS at $PWD in $TREE" git checkout ${TREE} >>$LOGDIR/$LOG 2>&1 + popd > /dev/null fi else cd ${PROGNAME}-$LFSVRS case $PROGNAME in - clfs*) git pull >>$LOGDIR/$LOG 2>&1 - if [ ! $TREE == "development" ]; then - git checkout ${TREE} >>$LOGDIR/$LOG 2>&1 - fi + clfs*) + # If the repo is in "detached head" state, git pull fails, so get + # back first to master: + git checkout master >>$LOGDIR/$LOG 2>&1 + git pull >>$LOGDIR/$LOG 2>&1 + if [ ! $TREE == "development" ]; then + git checkout ${TREE} >>$LOGDIR/$LOG 2>&1 + fi ;; lfs | hlfs) svn up >>$LOGDIR/$LOG 2>&1 ;; *) ;; @@ -49,7 +63,7 @@ get_book() { # fi echo -ne "done\n" - else + else # Working copy echo -ne "Using $BOOK as book's sources ...\n" fi } diff --git a/common/urls.xsl b/common/urls.xsl index bcdf78c..c2a5e66 100644 --- a/common/urls.xsl +++ b/common/urls.xsl @@ -105,6 +105,9 @@ udev/ + + iputils/ + /