bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] bootstrap: a new option --no-git, prohibiting the use git in the


From: Aleksey Avdeev
Subject: [PATCH] bootstrap: a new option --no-git, prohibiting the use git in the bootstrap process.
Date: Fri, 19 Mar 2010 18:52:39 +0300

Signed-off-by: Aleksey Avdeev <address@hidden>
---

Hello.

  Ability to explicitly disable the use git when calling bootstrap will
exclude recourse to third-party resources for assembly rpm package. What,
in particular, significantly simplify the preparation of packages to build
on git.alt
(see <http://en.altlinux.org/Git.alt_reference#Building_packages_with_gear>).

  The patch in my repository:
<http://git.altlinux.org/people/solo/public/?p=gnulib.git;a=commit;h=8741ad8a412b2aa9f7a4e3fc69902c12a6ed9d69>.

  Background: see <https://bugzilla.redhat.com/show_bug.cgi?id=562743>.

 ChangeLog           |    8 ++++++
 build-aux/bootstrap |   60 ++++++++++++++++++++++++++++++++++-----------------
 2 files changed, 48 insertions(+), 20 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 05a4e3d..4bd8d73 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2010-03-19  Aleksey Avdeev <address@hidden>
+
+       bootstrap: a new option --no-git, prohibiting the use git in
+       the bootstrap process.
+       * build-aux/bootstrap (NO_GIT): Explicit prohibition to use git,
+       if defined with GNULIB_SRCDIR.
+       * build-aux/bootstrap (git_submodule_gnulib_path): New function.
+       
 2010-03-11  Bruno Haible  <address@hidden>
 
        Fix problems with overloaded C++ definitions of memchr, strpbrk, etc.
diff --git a/build-aux/bootstrap b/build-aux/bootstrap
index 365a3d9..0acddc0 100755
--- a/build-aux/bootstrap
+++ b/build-aux/bootstrap
@@ -54,6 +54,8 @@ Options:
                           have gnulib sources on your machine, and
                           do not want to waste your bandwidth downloading
                           them again.  Defaults to \$GNULIB_SRCDIR.
+ --no-git                 Explicit prohibition to use git, if used
+                          --gnulib-srcdir (or defined \$GNULIB_SRCDIR).
  --copy                   Copy files instead of creating symbolic links.
  --force                  Attempt to bootstrap even if the sources seem
                           not to have been checked out.
@@ -234,6 +236,8 @@ do
     checkout_only_file=;;
   --copy)
     copy=true;;
+  --no-git)
+    NO_GIT=t;;
   *)
     echo >&2 "$0: $option: unknown option"
     exit 1;;
@@ -408,12 +412,15 @@ git_modules_config () {
   test -f .gitmodules && git config --file .gitmodules "$@"
 }
 
-gnulib_path=`git_modules_config submodule.gnulib.path`
+git_submodule_gnulib_path () {
+       git_modules_config submodule.gnulib.path
+}
 
 # Get gnulib files.
 
 case ${GNULIB_SRCDIR--} in
 -)
+  git_gnulib_path=`git_submodule_gnulib_path`
   if git_modules_config submodule.gnulib.url >/dev/null; then
     echo "$0: getting gnulib files..."
     git submodule init || exit $?
@@ -434,33 +441,46 @@ case ${GNULIB_SRCDIR--} in
   ;;
 *)
   # Use GNULIB_SRCDIR as a reference.
-  if test -d "$GNULIB_SRCDIR"/.git && \
-        git_modules_config submodule.gnulib.url >/dev/null; then
-    echo "$0: getting gnulib files..."
-    if git submodule --help|grep reference > /dev/null; then
-      # Prefer the one-liner available in git 1.6.4 or newer.
-      git submodule update --init --reference "$GNULIB_SRCDIR" \
-        "$gnulib_path" || exit $?
-    else
-      # This fallback allows at least git 1.5.5.
-      if test -f "$gnulib_path"/gnulib-tool; then
-        # Since file already exists, assume submodule init already complete.
-        git submodule update || exit $?
+  if test ! -d "$GNULIB_SRCDIR"; then
+    echo "$0: $GNULIB_SRCDIR no directory."
+    exit 1
+  fi
+  if test x"$NO_GIT" = x; then
+    git_gnulib_path=`git_submodule_gnulib_path`
+    if test -d "$GNULIB_SRCDIR"/.git && \
+          git_modules_config submodule.gnulib.url >/dev/null; then
+      echo "$0: getting gnulib files..."
+      if git submodule --help|grep reference > /dev/null; then
+        # Prefer the one-liner available in git 1.6.4 or newer.
+        git submodule update --init --reference "$GNULIB_SRCDIR" \
+          "$gnulib_path" || exit $?
       else
-        # Older git can't clone into an empty directory.
-        rmdir "$gnulib_path" 2>/dev/null
-        git clone --reference "$GNULIB_SRCDIR" \
-          "$(git_modules_config submodule.gnulib.url)" "$gnulib_path" \
-          && git submodule init && git submodule update \
-          || exit $?
+        # This fallback allows at least git 1.5.5.
+        if test -f "$gnulib_path"/gnulib-tool; then
+          # Since file already exists, assume submodule init already complete.
+          git submodule update || exit $?
+        else
+          # Older git can't clone into an empty directory.
+          rmdir "$gnulib_path" 2>/dev/null
+          git clone --reference "$GNULIB_SRCDIR" \
+            "$(git_modules_config submodule.gnulib.url)" "$gnulib_path" \
+            && git submodule init && git submodule update \
+            || exit $?
+        fi
       fi
+      GNULIB_SRCDIR=$gnulib_path
     fi
-    GNULIB_SRCDIR=$gnulib_path
+  else
+    echo "$0: unuse git..."
   fi
   ;;
 esac
 
 gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
+if test ! -x "$gnulib_tool";then
+  echo >&2 "$0: invalid gnulib srcdir: $GNULIB_SRCDIR"
+  exit 1
+fi
 <$gnulib_tool || exit
 
 # Get translations.
-- 
1.6.5.2





reply via email to

[Prev in Thread] Current Thread [Next in Thread]