summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2019-04-01 21:19:13 (GMT)
committerBruno Haible <bruno@clisp.org>2019-05-07 17:52:10 (GMT)
commit73c7a24c63723418943c5f67707a67667d9ee1ee (patch)
treeec538c1e7030c46c15c4eb9fc12581b2069b94bf
parent37cc7b27485023128c1411e0ebb05698549d48fe (diff)
downloadlibunistring-73c7a24c63723418943c5f67707a67667d9ee1ee.tar.gz
build: Separate git operations from build operations.
* gitsub.sh: New file, from gnulib. * .gitmodules: New file. * autogen.sh: Remove all git operations. Look at GNULIB_SRCDIR environment variable. Ignore the GNULIB_TOOL environment variable. * HACKING: Explain when to use gitsub.sh.
-rw-r--r--.gitmodules3
-rw-r--r--ChangeLog9
-rw-r--r--HACKING17
-rwxr-xr-xautogen.sh830
-rwxr-xr-xgitsub.sh483
5 files changed, 924 insertions, 418 deletions
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..11d805c
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[subcheckout "gnulib"]
+ url = git://git.savannah.gnu.org/gnulib.git
+ path = gnulib
diff --git a/ChangeLog b/ChangeLog
index 94354c1..4c160e4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2019-04-01 Bruno Haible <bruno@clisp.org>
+
+ build: Separate git operations from build operations.
+ * gitsub.sh: New file, from gnulib.
+ * .gitmodules: New file.
+ * autogen.sh: Remove all git operations. Look at GNULIB_SRCDIR
+ environment variable. Ignore the GNULIB_TOOL environment variable.
+ * HACKING: Explain when to use gitsub.sh.
+
2019-03-13 Bruno Haible <bruno@clisp.org>
build: Update Windows support.
diff --git a/HACKING b/HACKING
index 0139dae..1db20b6 100644
--- a/HACKING
+++ b/HACKING
@@ -48,7 +48,22 @@ You will need reasonably recent versions of the build tools:
And, of course, the packages listed in the DEPENDENCIES file.
-Then you can run the 'autogen.sh' script
+
+Building off the Git repository
+===============================
+
+Access to the Git repository is described at
+https://savannah.gnu.org/git/?group=libunistring .
+
+After fetching the sources from the Git repository, peek at the comments in
+autogen.sh, then run
+ ./gitsub.sh pull
+ ./autogen.sh
+Then you can proceed with "./configure" as usual.
+
+Each time you want to update the source, do not only "git pull". Instead do
+ git pull && ./gitsub.sh pull
+ ./autogen.sh
Sources
diff --git a/autogen.sh b/autogen.sh
index 4feebb7..20c3655 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -5,10 +5,9 @@
# with new versions of autoconf or automake.
#
# This script requires autoconf-2.63..2.69 and automake-1.11..1.16 in the PATH.
-# It also requires either
-# - the GNULIB_TOOL environment variable pointing to the gnulib-tool script
-# in a gnulib checkout, or
-# - the git program in the PATH and an internet connection.
+# If not used from a released tarball, it also requires either
+# - the GNULIB_SRCDIR environment variable pointing to a gnulib checkout, or
+# - a preceding invocation of './gitsub.sh pull'.
# It also requires
# - the gperf program.
@@ -28,12 +27,6 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# Usage: ./autogen.sh [--skip-gnulib]
-#
-# Usage from a git checkout: ./autogen.sh
-# This uses an up-to-date gnulib checkout.
-#
-# Usage from a released tarball: ./autogen.sh --skip-gnulib
-# This does not use a gnulib checkout.
skip_gnulib=false
while :; do
@@ -46,6 +39,7 @@ done
TEXINFO_VERSION=6.5
if test $skip_gnulib = false; then
+
# texinfo.tex
# The most recent snapshot of it is available in the gnulib repository.
# But this is a snapshot, with all possible dangers.
@@ -57,414 +51,416 @@ if test $skip_gnulib = false; then
&& mv build-aux/texinfo.tex.tmp build-aux/texinfo.tex; \
} || rm -f build-aux/texinfo.tex.tmp
fi
- if test -z "$GNULIB_TOOL"; then
- # Check out gnulib in a subdirectory 'gnulib'.
- if test -d gnulib; then
- (cd gnulib && git pull)
- else
- git clone git://git.savannah.gnu.org/gnulib.git
- fi
- # Now it should contain a gnulib-tool.
- if test -f gnulib/gnulib-tool; then
- GNULIB_TOOL=`pwd`/gnulib/gnulib-tool
- else
- echo "** warning: gnulib-tool not found" 1>&2
- fi
+
+ if test -n "$GNULIB_SRCDIR"; then
+ test -d "$GNULIB_SRCDIR" || {
+ echo "*** GNULIB_SRCDIR is set but does not point to an existing directory." 1>&2
+ exit 1
+ }
+ else
+ GNULIB_SRCDIR=`pwd`/gnulib
+ test -d "$GNULIB_SRCDIR" || {
+ echo "*** Subdirectory 'gnulib' does not yet exist. Use './gitsub.sh pull' to create it, or set the environment variable GNULIB_SRCDIR." 1>&2
+ exit 1
+ }
fi
- # Skip the gnulib-tool step if gnulib-tool was not found.
- if test -n "$GNULIB_TOOL"; then
- GNULIB_MODULES='
- unitypes
- unistr/base
- unistr/u8-check
- unistr/u8-chr
- unistr/u8-cmp
- unistr/u8-cmp2
- unistr/u8-cpy
- unistr/u8-cpy-alloc
- unistr/u8-endswith
- unistr/u8-mblen
- unistr/u8-mbsnlen
- unistr/u8-mbtouc
- unistr/u8-mbtoucr
- unistr/u8-mbtouc-unsafe
- unistr/u8-move
- unistr/u8-next
- unistr/u8-prev
- unistr/u8-set
- unistr/u8-startswith
- unistr/u8-stpcpy
- unistr/u8-stpncpy
- unistr/u8-strcat
- unistr/u8-strchr
- unistr/u8-strcmp
- unistr/u8-strcoll
- unistr/u8-strcpy
- unistr/u8-strcspn
- unistr/u8-strdup
- unistr/u8-strlen
- unistr/u8-strmblen
- unistr/u8-strmbtouc
- unistr/u8-strncat
- unistr/u8-strncmp
- unistr/u8-strncpy
- unistr/u8-strnlen
- unistr/u8-strpbrk
- unistr/u8-strrchr
- unistr/u8-strspn
- unistr/u8-strstr
- unistr/u8-strtok
- unistr/u8-to-u16
- unistr/u8-to-u32
- unistr/u8-uctomb
- unistr/u16-check
- unistr/u16-chr
- unistr/u16-cmp
- unistr/u16-cmp2
- unistr/u16-cpy
- unistr/u16-cpy-alloc
- unistr/u16-endswith
- unistr/u16-mblen
- unistr/u16-mbsnlen
- unistr/u16-mbtouc
- unistr/u16-mbtoucr
- unistr/u16-mbtouc-unsafe
- unistr/u16-move
- unistr/u16-next
- unistr/u16-prev
- unistr/u16-set
- unistr/u16-startswith
- unistr/u16-stpcpy
- unistr/u16-stpncpy
- unistr/u16-strcat
- unistr/u16-strchr
- unistr/u16-strcmp
- unistr/u16-strcoll
- unistr/u16-strcpy
- unistr/u16-strcspn
- unistr/u16-strdup
- unistr/u16-strlen
- unistr/u16-strmblen
- unistr/u16-strmbtouc
- unistr/u16-strncat
- unistr/u16-strncmp
- unistr/u16-strncpy
- unistr/u16-strnlen
- unistr/u16-strpbrk
- unistr/u16-strrchr
- unistr/u16-strspn
- unistr/u16-strstr
- unistr/u16-strtok
- unistr/u16-to-u32
- unistr/u16-to-u8
- unistr/u16-uctomb
- unistr/u32-check
- unistr/u32-chr
- unistr/u32-cmp
- unistr/u32-cmp2
- unistr/u32-cpy
- unistr/u32-cpy-alloc
- unistr/u32-endswith
- unistr/u32-mblen
- unistr/u32-mbsnlen
- unistr/u32-mbtouc
- unistr/u32-mbtoucr
- unistr/u32-mbtouc-unsafe
- unistr/u32-move
- unistr/u32-next
- unistr/u32-prev
- unistr/u32-set
- unistr/u32-startswith
- unistr/u32-stpcpy
- unistr/u32-stpncpy
- unistr/u32-strcat
- unistr/u32-strchr
- unistr/u32-strcmp
- unistr/u32-strcoll
- unistr/u32-strcpy
- unistr/u32-strcspn
- unistr/u32-strdup
- unistr/u32-strlen
- unistr/u32-strmblen
- unistr/u32-strmbtouc
- unistr/u32-strncat
- unistr/u32-strncmp
- unistr/u32-strncpy
- unistr/u32-strnlen
- unistr/u32-strpbrk
- unistr/u32-strrchr
- unistr/u32-strspn
- unistr/u32-strstr
- unistr/u32-strtok
- unistr/u32-to-u16
- unistr/u32-to-u8
- unistr/u32-uctomb
- uniconv/base
- uniconv/u8-conv-from-enc
- uniconv/u8-conv-to-enc
- uniconv/u8-strconv-from-enc
- uniconv/u8-strconv-from-locale
- uniconv/u8-strconv-to-enc
- uniconv/u8-strconv-to-locale
- uniconv/u16-conv-from-enc
- uniconv/u16-conv-to-enc
- uniconv/u16-strconv-from-enc
- uniconv/u16-strconv-from-locale
- uniconv/u16-strconv-to-enc
- uniconv/u16-strconv-to-locale
- uniconv/u32-conv-from-enc
- uniconv/u32-conv-to-enc
- uniconv/u32-strconv-from-enc
- uniconv/u32-strconv-from-locale
- uniconv/u32-strconv-to-enc
- uniconv/u32-strconv-to-locale
- unistdio/base
- unistdio/u8-asnprintf
- unistdio/u8-asprintf
- unistdio/u8-snprintf
- unistdio/u8-sprintf
- unistdio/u8-u8-asnprintf
- unistdio/u8-u8-asprintf
- unistdio/u8-u8-snprintf
- unistdio/u8-u8-sprintf
- unistdio/u8-u8-vasnprintf
- unistdio/u8-u8-vasprintf
- unistdio/u8-u8-vsnprintf
- unistdio/u8-u8-vsprintf
- unistdio/u8-vasnprintf
- unistdio/u8-vasprintf
- unistdio/u8-vsnprintf
- unistdio/u8-vsprintf
- unistdio/u16-asnprintf
- unistdio/u16-asprintf
- unistdio/u16-snprintf
- unistdio/u16-sprintf
- unistdio/u16-u16-asnprintf
- unistdio/u16-u16-asprintf
- unistdio/u16-u16-snprintf
- unistdio/u16-u16-sprintf
- unistdio/u16-u16-vasnprintf
- unistdio/u16-u16-vasprintf
- unistdio/u16-u16-vsnprintf
- unistdio/u16-u16-vsprintf
- unistdio/u16-vasnprintf
- unistdio/u16-vasprintf
- unistdio/u16-vsnprintf
- unistdio/u16-vsprintf
- unistdio/u32-asnprintf
- unistdio/u32-asprintf
- unistdio/u32-snprintf
- unistdio/u32-sprintf
- unistdio/u32-u32-asnprintf
- unistdio/u32-u32-asprintf
- unistdio/u32-u32-snprintf
- unistdio/u32-u32-sprintf
- unistdio/u32-u32-vasnprintf
- unistdio/u32-u32-vasprintf
- unistdio/u32-u32-vsnprintf
- unistdio/u32-u32-vsprintf
- unistdio/u32-vasnprintf
- unistdio/u32-vasprintf
- unistdio/u32-vsnprintf
- unistdio/u32-vsprintf
- unistdio/ulc-asnprintf
- unistdio/ulc-asprintf
- unistdio/ulc-fprintf
- unistdio/ulc-snprintf
- unistdio/ulc-sprintf
- unistdio/ulc-vasnprintf
- unistdio/ulc-vasprintf
- unistdio/ulc-vfprintf
- unistdio/ulc-vsnprintf
- unistdio/ulc-vsprintf
- uniname/base
- uniname/uniname
- unictype/base
- unictype/bidiclass-all
- unictype/block-all
- unictype/category-all
- unictype/combining-class-all
- unictype/ctype-alnum
- unictype/ctype-alpha
- unictype/ctype-blank
- unictype/ctype-cntrl
- unictype/ctype-digit
- unictype/ctype-graph
- unictype/ctype-lower
- unictype/ctype-print
- unictype/ctype-punct
- unictype/ctype-space
- unictype/ctype-upper
- unictype/ctype-xdigit
- unictype/decimal-digit
- unictype/digit
- unictype/joininggroup-all
- unictype/joiningtype-all
- unictype/mirror
- unictype/numeric
- unictype/property-all
- unictype/scripts-all
- unictype/syntax-c-ident
- unictype/syntax-c-whitespace
- unictype/syntax-java-ident
- unictype/syntax-java-whitespace
- uniwidth/base
- uniwidth/u8-strwidth
- uniwidth/u8-width
- uniwidth/u16-strwidth
- uniwidth/u16-width
- uniwidth/u32-strwidth
- uniwidth/u32-width
- uniwidth/width
- unigbrk/base
- unigbrk/u8-grapheme-breaks
- unigbrk/u8-grapheme-next
- unigbrk/u8-grapheme-prev
- unigbrk/u16-grapheme-breaks
- unigbrk/u16-grapheme-next
- unigbrk/u16-grapheme-prev
- unigbrk/u32-grapheme-breaks
- unigbrk/u32-grapheme-next
- unigbrk/u32-grapheme-prev
- unigbrk/uc-gbrk-prop
- unigbrk/uc-is-grapheme-break
- unigbrk/ulc-grapheme-breaks
- unigbrk/uc-grapheme-breaks
- uniwbrk/base
- uniwbrk/u8-wordbreaks
- uniwbrk/u16-wordbreaks
- uniwbrk/u32-wordbreaks
- uniwbrk/ulc-wordbreaks
- uniwbrk/wordbreak-property
- unilbrk/base
- unilbrk/u8-possible-linebreaks
- unilbrk/u8-width-linebreaks
- unilbrk/u16-possible-linebreaks
- unilbrk/u16-width-linebreaks
- unilbrk/u32-possible-linebreaks
- unilbrk/u32-width-linebreaks
- unilbrk/ulc-possible-linebreaks
- unilbrk/ulc-width-linebreaks
- uninorm/base
- uninorm/canonical-decomposition
- uninorm/composition
- uninorm/decomposition
- uninorm/filter
- uninorm/nfc
- uninorm/nfd
- uninorm/nfkc
- uninorm/nfkd
- uninorm/u8-normalize
- uninorm/u8-normcmp
- uninorm/u8-normcoll
- uninorm/u8-normxfrm
- uninorm/u16-normalize
- uninorm/u16-normcmp
- uninorm/u16-normcoll
- uninorm/u16-normxfrm
- uninorm/u32-normalize
- uninorm/u32-normcmp
- uninorm/u32-normcoll
- uninorm/u32-normxfrm
- unicase/base
- unicase/empty-prefix-context
- unicase/empty-suffix-context
- unicase/locale-language
- unicase/tolower
- unicase/totitle
- unicase/toupper
- unicase/u8-casecmp
- unicase/u8-casecoll
- unicase/u8-casefold
- unicase/u8-casexfrm
- unicase/u8-ct-casefold
- unicase/u8-ct-tolower
- unicase/u8-ct-totitle
- unicase/u8-ct-toupper
- unicase/u8-is-cased
- unicase/u8-is-casefolded
- unicase/u8-is-lowercase
- unicase/u8-is-titlecase
- unicase/u8-is-uppercase
- unicase/u8-prefix-context
- unicase/u8-suffix-context
- unicase/u8-tolower
- unicase/u8-totitle
- unicase/u8-toupper
- unicase/u16-casecmp
- unicase/u16-casecoll
- unicase/u16-casefold
- unicase/u16-casexfrm
- unicase/u16-ct-casefold
- unicase/u16-ct-tolower
- unicase/u16-ct-totitle
- unicase/u16-ct-toupper
- unicase/u16-is-cased
- unicase/u16-is-casefolded
- unicase/u16-is-lowercase
- unicase/u16-is-titlecase
- unicase/u16-is-uppercase
- unicase/u16-prefix-context
- unicase/u16-suffix-context
- unicase/u16-tolower
- unicase/u16-totitle
- unicase/u16-toupper
- unicase/u32-casecmp
- unicase/u32-casecoll
- unicase/u32-casefold
- unicase/u32-casexfrm
- unicase/u32-ct-casefold
- unicase/u32-ct-tolower
- unicase/u32-ct-totitle
- unicase/u32-ct-toupper
- unicase/u32-is-cased
- unicase/u32-is-casefolded
- unicase/u32-is-lowercase
- unicase/u32-is-titlecase
- unicase/u32-is-uppercase
- unicase/u32-prefix-context
- unicase/u32-suffix-context
- unicase/u32-tolower
- unicase/u32-totitle
- unicase/u32-toupper
- unicase/ulc-casecmp
- unicase/ulc-casecoll
- unicase/ulc-casexfrm
- relocatable-lib-lgpl
- '
- $GNULIB_TOOL --lib=libunistring --source-base=lib --m4-base=gnulib-m4 --tests-base=tests \
- --with-tests --lgpl=3orGPLv2 --makefile-name=Makefile.gnulib --libtool --local-dir=gnulib-local \
- --import $GNULIB_MODULES
- # Change lib/unistr.h to be usable standalone.
- sed -e 's/if GNULIB_[A-Za-z0-9_]* || .*/if 1/g' \
- -e 's/if GNULIB_[A-Za-z0-9_]*/if 1/g' \
- -e 's/HAVE_INLINE/UNISTRING_HAVE_INLINE/g' \
- < lib/unistr.in.h \
- > lib/unistr.in.h.tmp \
- && mv lib/unistr.in.h.tmp lib/unistr.in.h
- # Change lib/unictype.h, lib/uninorm.h, lib/unicase.h for shared libraries on Woe32 systems.
- sed -e 's/extern const uc_general_category_t UC_/extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_/' \
- -e 's/extern const uc_property_t UC_/extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_/' \
- < lib/unictype.in.h \
- > lib/unictype.in.h.tmp \
- && mv lib/unictype.in.h.tmp lib/unictype.in.h
- sed -e 's/extern const struct unicode_normalization_form /extern LIBUNISTRING_DLL_VARIABLE const struct unicode_normalization_form /' \
- < lib/uninorm.in.h \
- > lib/uninorm.in.h.tmp \
- && mv lib/uninorm.in.h.tmp lib/uninorm.in.h
- sed -e 's/extern const casing_/extern LIBUNISTRING_DLL_VARIABLE const casing_/' \
- < lib/unicase.in.h \
- > lib/unicase.in.h.tmp \
- && mv lib/unicase.in.h.tmp lib/unicase.in.h
- $GNULIB_TOOL --copy-file build-aux/config.guess; chmod a+x build-aux/config.guess
- $GNULIB_TOOL --copy-file build-aux/config.sub; chmod a+x build-aux/config.sub
- $GNULIB_TOOL --copy-file build-aux/declared.sh lib/declared.sh; chmod a+x lib/declared.sh
- $GNULIB_TOOL --copy-file build-aux/run-test; chmod a+x build-aux/run-test
- $GNULIB_TOOL --copy-file build-aux/test-driver.diff
- # If we got no texinfo.tex so far, take the snapshot from gnulib.
- if test ! -f build-aux/texinfo.tex; then
- $GNULIB_TOOL --copy-file build-aux/texinfo.tex
- fi
+ # Now it should contain a gnulib-tool.
+ GNULIB_TOOL="$GNULIB_SRCDIR/gnulib-tool"
+ test -f "$GNULIB_TOOL" || {
+ echo "*** gnulib-tool not found." 1>&2
+ exit 1
+ }
+ GNULIB_MODULES='
+ unitypes
+ unistr/base
+ unistr/u8-check
+ unistr/u8-chr
+ unistr/u8-cmp
+ unistr/u8-cmp2
+ unistr/u8-cpy
+ unistr/u8-cpy-alloc
+ unistr/u8-endswith
+ unistr/u8-mblen
+ unistr/u8-mbsnlen
+ unistr/u8-mbtouc
+ unistr/u8-mbtoucr
+ unistr/u8-mbtouc-unsafe
+ unistr/u8-move
+ unistr/u8-next
+ unistr/u8-prev
+ unistr/u8-set
+ unistr/u8-startswith
+ unistr/u8-stpcpy
+ unistr/u8-stpncpy
+ unistr/u8-strcat
+ unistr/u8-strchr
+ unistr/u8-strcmp
+ unistr/u8-strcoll
+ unistr/u8-strcpy
+ unistr/u8-strcspn
+ unistr/u8-strdup
+ unistr/u8-strlen
+ unistr/u8-strmblen
+ unistr/u8-strmbtouc
+ unistr/u8-strncat
+ unistr/u8-strncmp
+ unistr/u8-strncpy
+ unistr/u8-strnlen
+ unistr/u8-strpbrk
+ unistr/u8-strrchr
+ unistr/u8-strspn
+ unistr/u8-strstr
+ unistr/u8-strtok
+ unistr/u8-to-u16
+ unistr/u8-to-u32
+ unistr/u8-uctomb
+ unistr/u16-check
+ unistr/u16-chr
+ unistr/u16-cmp
+ unistr/u16-cmp2
+ unistr/u16-cpy
+ unistr/u16-cpy-alloc
+ unistr/u16-endswith
+ unistr/u16-mblen
+ unistr/u16-mbsnlen
+ unistr/u16-mbtouc
+ unistr/u16-mbtoucr
+ unistr/u16-mbtouc-unsafe
+ unistr/u16-move
+ unistr/u16-next
+ unistr/u16-prev
+ unistr/u16-set
+ unistr/u16-startswith
+ unistr/u16-stpcpy
+ unistr/u16-stpncpy
+ unistr/u16-strcat
+ unistr/u16-strchr
+ unistr/u16-strcmp
+ unistr/u16-strcoll
+ unistr/u16-strcpy
+ unistr/u16-strcspn
+ unistr/u16-strdup
+ unistr/u16-strlen
+ unistr/u16-strmblen
+ unistr/u16-strmbtouc
+ unistr/u16-strncat
+ unistr/u16-strncmp
+ unistr/u16-strncpy
+ unistr/u16-strnlen
+ unistr/u16-strpbrk
+ unistr/u16-strrchr
+ unistr/u16-strspn
+ unistr/u16-strstr
+ unistr/u16-strtok
+ unistr/u16-to-u32
+ unistr/u16-to-u8
+ unistr/u16-uctomb
+ unistr/u32-check
+ unistr/u32-chr
+ unistr/u32-cmp
+ unistr/u32-cmp2
+ unistr/u32-cpy
+ unistr/u32-cpy-alloc
+ unistr/u32-endswith
+ unistr/u32-mblen
+ unistr/u32-mbsnlen
+ unistr/u32-mbtouc
+ unistr/u32-mbtoucr
+ unistr/u32-mbtouc-unsafe
+ unistr/u32-move
+ unistr/u32-next
+ unistr/u32-prev
+ unistr/u32-set
+ unistr/u32-startswith
+ unistr/u32-stpcpy
+ unistr/u32-stpncpy
+ unistr/u32-strcat
+ unistr/u32-strchr
+ unistr/u32-strcmp
+ unistr/u32-strcoll
+ unistr/u32-strcpy
+ unistr/u32-strcspn
+ unistr/u32-strdup
+ unistr/u32-strlen
+ unistr/u32-strmblen
+ unistr/u32-strmbtouc
+ unistr/u32-strncat
+ unistr/u32-strncmp
+ unistr/u32-strncpy
+ unistr/u32-strnlen
+ unistr/u32-strpbrk
+ unistr/u32-strrchr
+ unistr/u32-strspn
+ unistr/u32-strstr
+ unistr/u32-strtok
+ unistr/u32-to-u16
+ unistr/u32-to-u8
+ unistr/u32-uctomb
+ uniconv/base
+ uniconv/u8-conv-from-enc
+ uniconv/u8-conv-to-enc
+ uniconv/u8-strconv-from-enc
+ uniconv/u8-strconv-from-locale
+ uniconv/u8-strconv-to-enc
+ uniconv/u8-strconv-to-locale
+ uniconv/u16-conv-from-enc
+ uniconv/u16-conv-to-enc
+ uniconv/u16-strconv-from-enc
+ uniconv/u16-strconv-from-locale
+ uniconv/u16-strconv-to-enc
+ uniconv/u16-strconv-to-locale
+ uniconv/u32-conv-from-enc
+ uniconv/u32-conv-to-enc
+ uniconv/u32-strconv-from-enc
+ uniconv/u32-strconv-from-locale
+ uniconv/u32-strconv-to-enc
+ uniconv/u32-strconv-to-locale
+ unistdio/base
+ unistdio/u8-asnprintf
+ unistdio/u8-asprintf
+ unistdio/u8-snprintf
+ unistdio/u8-sprintf
+ unistdio/u8-u8-asnprintf
+ unistdio/u8-u8-asprintf
+ unistdio/u8-u8-snprintf
+ unistdio/u8-u8-sprintf
+ unistdio/u8-u8-vasnprintf
+ unistdio/u8-u8-vasprintf
+ unistdio/u8-u8-vsnprintf
+ unistdio/u8-u8-vsprintf
+ unistdio/u8-vasnprintf
+ unistdio/u8-vasprintf
+ unistdio/u8-vsnprintf
+ unistdio/u8-vsprintf
+ unistdio/u16-asnprintf
+ unistdio/u16-asprintf
+ unistdio/u16-snprintf
+ unistdio/u16-sprintf
+ unistdio/u16-u16-asnprintf
+ unistdio/u16-u16-asprintf
+ unistdio/u16-u16-snprintf
+ unistdio/u16-u16-sprintf
+ unistdio/u16-u16-vasnprintf
+ unistdio/u16-u16-vasprintf
+ unistdio/u16-u16-vsnprintf
+ unistdio/u16-u16-vsprintf
+ unistdio/u16-vasnprintf
+ unistdio/u16-vasprintf
+ unistdio/u16-vsnprintf
+ unistdio/u16-vsprintf
+ unistdio/u32-asnprintf
+ unistdio/u32-asprintf
+ unistdio/u32-snprintf
+ unistdio/u32-sprintf
+ unistdio/u32-u32-asnprintf
+ unistdio/u32-u32-asprintf
+ unistdio/u32-u32-snprintf
+ unistdio/u32-u32-sprintf
+ unistdio/u32-u32-vasnprintf
+ unistdio/u32-u32-vasprintf
+ unistdio/u32-u32-vsnprintf
+ unistdio/u32-u32-vsprintf
+ unistdio/u32-vasnprintf
+ unistdio/u32-vasprintf
+ unistdio/u32-vsnprintf
+ unistdio/u32-vsprintf
+ unistdio/ulc-asnprintf
+ unistdio/ulc-asprintf
+ unistdio/ulc-fprintf
+ unistdio/ulc-snprintf
+ unistdio/ulc-sprintf
+ unistdio/ulc-vasnprintf
+ unistdio/ulc-vasprintf
+ unistdio/ulc-vfprintf
+ unistdio/ulc-vsnprintf
+ unistdio/ulc-vsprintf
+ uniname/base
+ uniname/uniname
+ unictype/base
+ unictype/bidiclass-all
+ unictype/block-all
+ unictype/category-all
+ unictype/combining-class-all
+ unictype/ctype-alnum
+ unictype/ctype-alpha
+ unictype/ctype-blank
+ unictype/ctype-cntrl
+ unictype/ctype-digit
+ unictype/ctype-graph
+ unictype/ctype-lower
+ unictype/ctype-print
+ unictype/ctype-punct
+ unictype/ctype-space
+ unictype/ctype-upper
+ unictype/ctype-xdigit
+ unictype/decimal-digit
+ unictype/digit
+ unictype/joininggroup-all
+ unictype/joiningtype-all
+ unictype/mirror
+ unictype/numeric
+ unictype/property-all
+ unictype/scripts-all
+ unictype/syntax-c-ident
+ unictype/syntax-c-whitespace
+ unictype/syntax-java-ident
+ unictype/syntax-java-whitespace
+ uniwidth/base
+ uniwidth/u8-strwidth
+ uniwidth/u8-width
+ uniwidth/u16-strwidth
+ uniwidth/u16-width
+ uniwidth/u32-strwidth
+ uniwidth/u32-width
+ uniwidth/width
+ unigbrk/base
+ unigbrk/u8-grapheme-breaks
+ unigbrk/u8-grapheme-next
+ unigbrk/u8-grapheme-prev
+ unigbrk/u16-grapheme-breaks
+ unigbrk/u16-grapheme-next
+ unigbrk/u16-grapheme-prev
+ unigbrk/u32-grapheme-breaks
+ unigbrk/u32-grapheme-next
+ unigbrk/u32-grapheme-prev
+ unigbrk/uc-gbrk-prop
+ unigbrk/uc-is-grapheme-break
+ unigbrk/ulc-grapheme-breaks
+ unigbrk/uc-grapheme-breaks
+ uniwbrk/base
+ uniwbrk/u8-wordbreaks
+ uniwbrk/u16-wordbreaks
+ uniwbrk/u32-wordbreaks
+ uniwbrk/ulc-wordbreaks
+ uniwbrk/wordbreak-property
+ unilbrk/base
+ unilbrk/u8-possible-linebreaks
+ unilbrk/u8-width-linebreaks
+ unilbrk/u16-possible-linebreaks
+ unilbrk/u16-width-linebreaks
+ unilbrk/u32-possible-linebreaks
+ unilbrk/u32-width-linebreaks
+ unilbrk/ulc-possible-linebreaks
+ unilbrk/ulc-width-linebreaks
+ uninorm/base
+ uninorm/canonical-decomposition
+ uninorm/composition
+ uninorm/decomposition
+ uninorm/filter
+ uninorm/nfc
+ uninorm/nfd
+ uninorm/nfkc
+ uninorm/nfkd
+ uninorm/u8-normalize
+ uninorm/u8-normcmp
+ uninorm/u8-normcoll
+ uninorm/u8-normxfrm
+ uninorm/u16-normalize
+ uninorm/u16-normcmp
+ uninorm/u16-normcoll
+ uninorm/u16-normxfrm
+ uninorm/u32-normalize
+ uninorm/u32-normcmp
+ uninorm/u32-normcoll
+ uninorm/u32-normxfrm
+ unicase/base
+ unicase/empty-prefix-context
+ unicase/empty-suffix-context
+ unicase/locale-language
+ unicase/tolower
+ unicase/totitle
+ unicase/toupper
+ unicase/u8-casecmp
+ unicase/u8-casecoll
+ unicase/u8-casefold
+ unicase/u8-casexfrm
+ unicase/u8-ct-casefold
+ unicase/u8-ct-tolower
+ unicase/u8-ct-totitle
+ unicase/u8-ct-toupper
+ unicase/u8-is-cased
+ unicase/u8-is-casefolded
+ unicase/u8-is-lowercase
+ unicase/u8-is-titlecase
+ unicase/u8-is-uppercase
+ unicase/u8-prefix-context
+ unicase/u8-suffix-context
+ unicase/u8-tolower
+ unicase/u8-totitle
+ unicase/u8-toupper
+ unicase/u16-casecmp
+ unicase/u16-casecoll
+ unicase/u16-casefold
+ unicase/u16-casexfrm
+ unicase/u16-ct-casefold
+ unicase/u16-ct-tolower
+ unicase/u16-ct-totitle
+ unicase/u16-ct-toupper
+ unicase/u16-is-cased
+ unicase/u16-is-casefolded
+ unicase/u16-is-lowercase
+ unicase/u16-is-titlecase
+ unicase/u16-is-uppercase
+ unicase/u16-prefix-context
+ unicase/u16-suffix-context
+ unicase/u16-tolower
+ unicase/u16-totitle
+ unicase/u16-toupper
+ unicase/u32-casecmp
+ unicase/u32-casecoll
+ unicase/u32-casefold
+ unicase/u32-casexfrm
+ unicase/u32-ct-casefold
+ unicase/u32-ct-tolower
+ unicase/u32-ct-totitle
+ unicase/u32-ct-toupper
+ unicase/u32-is-cased
+ unicase/u32-is-casefolded
+ unicase/u32-is-lowercase
+ unicase/u32-is-titlecase
+ unicase/u32-is-uppercase
+ unicase/u32-prefix-context
+ unicase/u32-suffix-context
+ unicase/u32-tolower
+ unicase/u32-totitle
+ unicase/u32-toupper
+ unicase/ulc-casecmp
+ unicase/ulc-casecoll
+ unicase/ulc-casexfrm
+ relocatable-lib-lgpl
+ '
+ $GNULIB_TOOL --lib=libunistring --source-base=lib --m4-base=gnulib-m4 --tests-base=tests \
+ --with-tests --lgpl=3orGPLv2 --makefile-name=Makefile.gnulib --libtool --local-dir=gnulib-local \
+ --import $GNULIB_MODULES
+ # Change lib/unistr.h to be usable standalone.
+ sed -e 's/if GNULIB_[A-Za-z0-9_]* || .*/if 1/g' \
+ -e 's/if GNULIB_[A-Za-z0-9_]*/if 1/g' \
+ -e 's/HAVE_INLINE/UNISTRING_HAVE_INLINE/g' \
+ < lib/unistr.in.h \
+ > lib/unistr.in.h.tmp \
+ && mv lib/unistr.in.h.tmp lib/unistr.in.h
+ # Change lib/unictype.h, lib/uninorm.h, lib/unicase.h for shared libraries on Woe32 systems.
+ sed -e 's/extern const uc_general_category_t UC_/extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_/' \
+ -e 's/extern const uc_property_t UC_/extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_/' \
+ < lib/unictype.in.h \
+ > lib/unictype.in.h.tmp \
+ && mv lib/unictype.in.h.tmp lib/unictype.in.h
+ sed -e 's/extern const struct unicode_normalization_form /extern LIBUNISTRING_DLL_VARIABLE const struct unicode_normalization_form /' \
+ < lib/uninorm.in.h \
+ > lib/uninorm.in.h.tmp \
+ && mv lib/uninorm.in.h.tmp lib/uninorm.in.h
+ sed -e 's/extern const casing_/extern LIBUNISTRING_DLL_VARIABLE const casing_/' \
+ < lib/unicase.in.h \
+ > lib/unicase.in.h.tmp \
+ && mv lib/unicase.in.h.tmp lib/unicase.in.h
+ $GNULIB_TOOL --copy-file build-aux/config.guess; chmod a+x build-aux/config.guess
+ $GNULIB_TOOL --copy-file build-aux/config.sub; chmod a+x build-aux/config.sub
+ $GNULIB_TOOL --copy-file build-aux/declared.sh lib/declared.sh; chmod a+x lib/declared.sh
+ $GNULIB_TOOL --copy-file build-aux/run-test; chmod a+x build-aux/run-test
+ $GNULIB_TOOL --copy-file build-aux/test-driver.diff
+ # If we got no texinfo.tex so far, take the snapshot from gnulib.
+ if test ! -f build-aux/texinfo.tex; then
+ $GNULIB_TOOL --copy-file build-aux/texinfo.tex
fi
fi
diff --git a/gitsub.sh b/gitsub.sh
new file mode 100755
index 0000000..9665198
--- /dev/null
+++ b/gitsub.sh
@@ -0,0 +1,483 @@
+#! /bin/sh
+#
+# Copyright (C) 2019 Free Software Foundation, Inc.
+# Written by Bruno Haible <bruno@clisp.org>, 2019.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+# Program that manages the subdirectories of a git checkout of a package
+# that come from other packages (called "dependency packages").
+#
+# This program is similar in spirit to 'git submodule', with three
+# essential differences:
+#
+# 1) Its options are easy to remember, and do not require knowledge of
+# 'git submodule'.
+#
+# 2) The developer may choose to work on a different checkout for each
+# dependency package. This is important when the developer is
+# preparing simultaneous changes to the package and the dependency
+# package, or is using the dependency package in several packages.
+#
+# The developer indicates this different checkout by setting the
+# environment variable <SUBDIR>_SRCDIR (e.g. GNULIB_SRCDIR) to point to it.
+#
+# 3) The package maintainer may choose to use or not use git submodules.
+#
+# The advantages of management through a git submodule are:
+# - Changes to the dependency package cannot suddenly break your package.
+# In other words, when there is an incompatible change that will cause
+# a breakage, you can fix things at your pace; you are not forced to
+# cope with such breakages in an emergency.
+# - When you need to make a change as a response to a change in the
+# dependency package, your co-developers cannot accidentally mix things
+# up (for example, use a combination of your newest change with an
+# older version of the dependency package).
+#
+# The advantages of management without a git submodule (just as a plain
+# subdirectory, let's call it a "subcheckout") are:
+# - The simplicity: you are conceptually always using the newest revision
+# of the dependency package.
+# - You don't have to remember to periodially upgrade the dependency.
+# Upgrading the dependency is an implicit operation.
+
+# This program is meant to be copied to the top-level directory of the package,
+# together with a configuration file. The configuration is supposed to be
+# named '.gitmodules' and to define:
+# * The git submodules, as described in "man 5 gitmodules" or
+# <https://git-scm.com/docs/gitmodules>. For example:
+#
+# [submodule "gnulib"]
+# url = git://git.savannah.gnu.org/gnulib.git
+# path = gnulib
+#
+# You don't add this piece of configuration to .gitmodules manually. Instead,
+# you would invoke
+# $ git submodule add --name "gnulib" -- git://git.savannah.gnu.org/gnulib.git gnulib
+#
+# * The subdirectories that are not git submodules, in a similar syntax. For
+# example:
+#
+# [subcheckout "gnulib"]
+# url = git://git.savannah.gnu.org/gnulib.git
+# path = gnulib
+#
+# Here the URL is the one used for anonymous checkouts of the dependency
+# package. If the developer needs a checkout with write access, they can
+# either set the GNULIB_SRCDIR environment variable to point to that checkout
+# or modify the gnulib/.git/config file to enter a different URL.
+
+scriptname="$0"
+scriptversion='2019-04-01'
+nl='
+'
+IFS=" "" $nl"
+
+# func_usage
+# outputs to stdout the --help usage message.
+func_usage ()
+{
+ echo "\
+Usage: gitsub.sh pull [SUBDIR]
+ gitsub.sh upgrade [SUBDIR]
+ gitsub.sh checkout SUBDIR REVISION
+
+Operations:
+
+gitsub.sh pull [SUBDIR]
+ You should perform this operation after 'git clone ...' and after
+ every 'git pull'.
+ It brings your checkout in sync with what the other developers of
+ your package have committed and pushed.
+ If an environment variable <SUBDIR>_SRCDIR is set, with a non-empty
+ value, nothing is done for this SUBDIR.
+ If no SUBDIR is specified, the operation applies to all dependencies.
+
+gitsub.sh upgrade [SUBDIR]
+ You should perform this operation periodically, to ensure currency
+ of the dependency package revisions that you use.
+ This operation pulls and checks out the changes that the developers
+ of the dependency package have committed and pushed.
+ If an environment variable <SUBDIR>_SRCDIR is set, with a non-empty
+ value, nothing is done for this SUBDIR.
+ If no SUBDIR is specified, the operation applies to all dependencies.
+
+gitsub.sh checkout SUBDIR REVISION
+ Checks out a specific revision for a dependency package.
+ If an environment variable <SUBDIR>_SRCDIR is set, with a non-empty
+ value, this operation fails.
+
+This script requires the git program in the PATH and an internet connection.
+"
+}
+
+# func_version
+# outputs to stdout the --version message.
+func_version ()
+{
+ year=`echo "$scriptversion" | sed -e 's/^\(....\)-.*/\1/'`
+ echo "\
+gitsub.sh (GNU gnulib) $scriptversion
+Copyright (C) 2019-$year Free Software Foundation, Inc.
+License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
+This is free software: you are free to change and redistribute it.
+There is NO WARRANTY, to the extent permitted by law.
+"
+ printf "Written by %s.\n" "Bruno Haible"
+}
+
+# func_fatal_error message
+# outputs to stderr a fatal error message, and terminates the program.
+# Input:
+# - scriptname name of this program
+func_fatal_error ()
+{
+ echo "$scriptname: *** $1" 1>&2
+ echo "$scriptname: *** Stop." 1>&2
+ exit 1
+}
+
+# func_warning message
+# Outputs to stderr a warning message,
+func_warning ()
+{
+ echo "gitsub.sh: warning: $1" 1>&2
+}
+
+# func_note message
+# Outputs to stdout a note message,
+func_note ()
+{
+ echo "gitsub.sh: note: $1"
+}
+
+# Unset CDPATH. Otherwise, output from 'cd dir' can surprise callers.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+# Command-line option processing.
+mode=
+while test $# -gt 0; do
+ case "$1" in
+ --help | --hel | --he | --h )
+ func_usage
+ exit $? ;;
+ --version | --versio | --versi | --vers | --ver | --ve | --v )
+ func_version
+ exit $? ;;
+ -- )
+ # Stop option processing
+ shift
+ break ;;
+ -* )
+ echo "gitsub.sh: unknown option $1" 1>&2
+ echo "Try 'gitsub.sh --help' for more information." 1>&2
+ exit 1 ;;
+ * )
+ break ;;
+ esac
+done
+if test $# = 0; then
+ echo "gitsub.sh: missing operation argument" 1>&2
+ echo "Try 'gitsub.sh --help' for more information." 1>&2
+ exit 1
+fi
+case "$1" in
+ pull | upgrade | checkout )
+ mode="$1"
+ shift ;;
+ *)
+ echo "gitsub.sh: unknown operation '$1'" 1>&2
+ echo "Try 'gitsub.sh --help' for more information." 1>&2
+ exit 1 ;;
+esac
+if test $# = 2 && test $mode != checkout || test $# -gt 2; then
+ echo "gitsub.sh: too many arguments in '$mode' mode" 1>&2
+ echo "Try 'gitsub.sh --help' for more information." 1>&2
+ exit 1
+fi
+if test $# = 0 && test $mode = checkout; then
+ echo "gitsub.sh: too few arguments in '$mode' mode" 1>&2
+ echo "Try 'gitsub.sh --help' for more information." 1>&2
+ exit 1
+fi
+
+# Read the configuration.
+# Output:
+# - subcheckout_names space-separated list of subcheckout names
+# - submodule_names space-separated list of submodule names
+if test -f .gitmodules; then
+ subcheckout_names=`git config --file .gitmodules --get-regexp --name-only 'subcheckout\..*\.url' | sed -e 's/^subcheckout\.//' -e 's/\.url$//' | tr -d '\r' | tr '\n' ' '`
+ submodule_names=`git config --file .gitmodules --get-regexp --name-only 'submodule\..*\.url' | sed -e 's/^submodule\.//' -e 's/\.url$//' | tr -d '\r' | tr '\n' ' '`
+else
+ subcheckout_names=
+ submodule_names=
+fi
+
+# func_validate SUBDIR
+# Verifies that the state on the file system is in sync with the declarations
+# in the configuration file.
+# Input:
+# - subcheckout_names space-separated list of subcheckout names
+# - submodule_names space-separated list of submodule names
+# Output:
+# - srcdirvar Environment that the user can set
+# - srcdir Value of the environment variable
+# - path if $srcdir = "": relative path of the subdirectory
+# - needs_init if $srcdir = "" and $path is not yet initialized:
+# true
+# - url if $srcdir = "" and $path is not yet initialized:
+# the repository URL
+func_validate ()
+{
+ srcdirvar=`echo "$1" | LC_ALL=C sed -e 's/[^a-zA-Z0-9]/_/g' | LC_ALL=C tr '[a-z]' '[A-Z]'`"_SRCDIR"
+ eval 'srcdir=$'"$srcdirvar"
+ path=
+ url=
+ if test -n "$srcdir"; then
+ func_note "Ignoring '$1' because $srcdirvar is set."
+ else
+ found=false
+ needs_init=
+ case " $subcheckout_names " in *" $1 "*)
+ found=true
+ # It ought to be a subcheckout.
+ path=`git config --file .gitmodules "subcheckout.$1.path"`
+ if test -z "$path"; then
+ path="$1"
+ fi
+ if test -d "$path"; then
+ if test -d "$path/.git"; then
+ # It's a plain checkout.
+ :
+ else
+ if test -f "$path/.git"; then
+ # It's a submodule.
+ func_fatal_error "Subdirectory '$path' is supposed to be a plain checkout, but it is a submodule."
+ else
+ func_warning "Ignoring '$path' because it exists but is not a git checkout."
+ fi
+ fi
+ else
+ # The subdir does not yet exist.
+ needs_init=true
+ url=`git config --file .gitmodules "subcheckout.$1.url"`
+ if test -z "$url"; then
+ func_fatal_error "Property subcheckout.$1.url is not defined in .gitmodules"
+ fi
+ fi
+ ;;
+ esac
+ case " $submodule_names " in *" $1 "*)
+ found=true
+ # It ought to be a submodule.
+ path=`git config --file .gitmodules "submodule.$1.path"`
+ if test -z "$path"; then
+ path="$1"
+ fi
+ if test -d "$path"; then
+ if test -d "$path/.git" || test -f "$path/.git"; then
+ # It's likely a submodule.
+ :
+ else
+ path_if_empty=`find "$path" -prune -empty 2>/dev/null`
+ if test -n "$path_if_empty"; then
+ # The subdir is empty.
+ needs_init=true
+ else
+ # The subdir is not empty.
+ # It is important to report an error, because we don't want to erase
+ # the user's files and 'git submodule update gnulib' sometimes reports
+ # "fatal: destination path '$path' already exists and is not an empty directory."
+ # but sometimes does not.
+ func_fatal_error "Subdir '$path' exists but is not a git checkout."
+ fi
+ fi
+ else
+ # The subdir does not yet exist.
+ needs_init=true
+ fi
+ # Another way to determine needs_init could be:
+ # if git submodule status "$path" | grep '^-' > /dev/null; then
+ # needs_init=true
+ # fi
+ if test -n "$needs_init"; then
+ url=`git config --file .gitmodules "submodule.$1.url"`
+ if test -z "$url"; then
+ func_fatal_error "Property submodule.$1.url is not defined in .gitmodules"
+ fi
+ fi
+ ;;
+ esac
+ if ! $found; then
+ func_fatal_error "Subdir '$1' is not configured as a subcheckout or a submodule in .gitmodules"
+ fi
+ fi
+}
+
+# func_cleanup_current_git_clone
+# Cleans up the current 'git clone' operation.
+# Input:
+# - path
+func_cleanup_current_git_clone ()
+{
+ rm -rf "$path"
+ func_fatal_error "git clone failed"
+}
+
+# func_pull SUBDIR
+# Implements the 'pull' operation.
+func_pull ()
+{
+ func_validate "$1"
+ if test -z "$srcdir"; then
+ case " $subcheckout_names " in *" $1 "*)
+ # It's a subcheckout.
+ if test -d "$path"; then
+ if test -d "$path/.git"; then
+ (cd "$path" && git pull) || func_fatal_error "git operation failed"
+ fi
+ else
+ # The subdir does not yet exist. Create a plain checkout.
+ trap func_cleanup_current_git_clone 1 2 13 15
+ git clone "$url" "$path" || func_cleanup_current_git_clone
+ trap - 1 2 13 15
+ fi
+ ;;
+ esac
+ case " $submodule_names " in *" $1 "*)
+ # It's a submodule.
+ if test -n "$needs_init"; then
+ # Create a submodule checkout.
+ git submodule init -- "$path" && git submodule update -- "$path" || func_fatal_error "git operation failed"
+ else
+ # See https://stackoverflow.com/questions/1030169/easy-way-to-pull-latest-of-all-git-submodules
+ # https://stackoverflow.com/questions/4611512/is-there-a-way-to-make-git-pull-automatically-update-submodules
+ git submodule update "$path" || func_fatal_error "git operation failed"
+ fi
+ ;;
+ esac
+ fi
+}
+
+# func_upgrade SUBDIR
+# Implements the 'upgrade' operation.
+func_upgrade ()
+{
+ func_validate "$1"
+ if test -z "$srcdir"; then
+ if test -d "$path"; then
+ case " $subcheckout_names " in *" $1 "*)
+ # It's a subcheckout.
+ if test -d "$path/.git"; then
+ (cd "$path" && git pull) || func_fatal_error "git operation failed"
+ fi
+ ;;
+ esac
+ case " $submodule_names " in *" $1 "*)
+ # It's a submodule.
+ if test -z "$needs_init"; then
+ (cd "$path" && git fetch && git merge origin/master) || func_fatal_error "git operation failed"
+ fi
+ ;;
+ esac
+ else
+ # The subdir does not yet exist.
+ func_fatal_error "Subdirectory '$path' does not exist yet. Use 'gitsub.sh pull' to create it."
+ fi
+ fi
+}
+
+# func_checkout SUBDIR REVISION
+# Implements the 'checkout' operation.
+func_checkout ()
+{
+ func_validate "$1"
+ if test -z "$srcdir"; then
+ if test -d "$path"; then
+ case " $subcheckout_names " in *" $1 "*)
+ # It's a subcheckout.
+ if test -d "$path/.git"; then
+ (cd "$path" && git checkout "$2") || func_fatal_error "git operation failed"
+ fi
+ ;;
+ esac
+ case " $submodule_names " in *" $1 "*)
+ # It's a submodule.
+ if test -z "$needs_init"; then
+ (cd "$path" && git checkout "$2") || func_fatal_error "git operation failed"
+ fi
+ ;;
+ esac
+ else
+ # The subdir does not yet exist.
+ func_fatal_error "Subdirectory '$path' does not exist yet. Use 'gitsub.sh pull' to create it."
+ fi
+ fi
+}
+
+case "$mode" in
+ pull )
+ if test $# = 0; then
+ for sub in $subcheckout_names $submodule_names; do
+ func_pull "$sub"
+ done
+ else
+ valid=false
+ for sub in $subcheckout_names $submodule_names; do
+ if test "$sub" = "$1"; then
+ valid=true
+ fi
+ done
+ if $valid; then
+ func_pull "$1"
+ else
+ func_fatal_error "Subdir '$1' is not configured as a subcheckout or a submodule in .gitmodules"
+ fi
+ fi
+ ;;
+
+ upgrade )
+ if test $# = 0; then
+ for sub in $subcheckout_names $submodule_names; do
+ func_upgrade "$sub"
+ done
+ else
+ valid=false
+ for sub in $subcheckout_names $submodule_names; do
+ if test "$sub" = "$1"; then
+ valid=true
+ fi
+ done
+ if $valid; then
+ func_upgrade "$1"
+ else
+ func_fatal_error "Subdir '$1' is not configured as a subcheckout or a submodule in .gitmodules"
+ fi
+ fi
+ ;;
+
+ checkout )
+ valid=false
+ for sub in $subcheckout_names $submodule_names; do
+ if test "$sub" = "$1"; then
+ valid=true
+ fi
+ done
+ if $valid; then
+ func_checkout "$1" "$2"
+ else
+ func_fatal_error "Subdir '$1' is not configured as a subcheckout or a submodule in .gitmodules"
+ fi
+ ;;
+esac