From 337a10c6685914e9504e17a2f1cc303969e9f5b3 Mon Sep 17 00:00:00 2001 From: David Lutterkort Date: Mon, 19 Jul 2010 14:46:09 -0700 Subject: [PATCH] Use gnulib from a submodule This allows us to record the exact changeset from gnulib that everybody should be using. --- .gitmodules | 3 +++ .gnulib | 1 + bootstrap | 34 ++++++++++++++++++++-------------- 3 files changed, 24 insertions(+), 14 deletions(-) create mode 100644 .gitmodules create mode 160000 .gnulib diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..7acb1ea19 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "gnulib"] + path = .gnulib + url = git://git.sv.gnu.org/gnulib.git diff --git a/.gnulib b/.gnulib new file mode 160000 index 000000000..e240ab433 --- /dev/null +++ b/.gnulib @@ -0,0 +1 @@ +Subproject commit e240ab433593692f27c804c26ec1730a0dd27e5d diff --git a/bootstrap b/bootstrap index 62f4b9fce..ee1100359 100755 --- a/bootstrap +++ b/bootstrap @@ -33,25 +33,31 @@ do esac done -cleanup_gnulib() { - st=$? - rm -fr .gnulib - exit $st -} +# Get gnulib files. case ${GNULIB_SRCDIR--} in -) - if [ ! -d .gnulib ]; then + echo "$0: getting gnulib files..." + git submodule init || exit $? + git submodule update || exit $? + GNULIB_SRCDIR=.gnulib + ;; +*) + # Redirect the gnulib submodule to the directory on the command line + # if possible. + if test -d "$GNULIB_SRCDIR"/.git && \ + git config --file .gitmodules submodule.gnulib.url >/dev/null; then + git submodule init + GNULIB_SRCDIR=`cd $GNULIB_SRCDIR && pwd` + git config --replace-all submodule.gnulib.url $GNULIB_SRCDIR echo "$0: getting gnulib files..." - - trap cleanup_gnulib 1 2 13 15 - - git clone --depth 1 git://git.sv.gnu.org/gnulib .gnulib || - cleanup_gnulib - - trap - 1 2 13 15 + git submodule update || exit $? + GNULIB_SRCDIR=.gnulib + else + echo >&2 "$0: invalid gnulib srcdir: $GNULIB_SRCDIR" + exit 1 fi - GNULIB_SRCDIR=.gnulib + ;; esac gnulib_tool=$GNULIB_SRCDIR/gnulib-tool