[Top][All Lists]

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

[Findutils-patches] [PATCH] Check gnulib out with git rather than CVS.

From: James Youngman
Subject: [Findutils-patches] [PATCH] Check gnulib out with git rather than CVS.
Date: Tue, 27 Nov 2007 11:29:37 +0000

2007-11-27  James Youngman  <address@hidden>

        Check gnulib out with native git, rather than git-cvspserver.
        This fixes Savannah bug #21568, for the second time.
        * import-gnulib.config (gnulib_version): Switch to using a git
        commit id and native git, since git-cvspserver silently fails to
        support "cvs update -D".
        * (do_checkout): Check gnulib out with git rather
        than CVS.
        (main): Require 'git' to be available.
        (move_cvsdir): Remove any pre-existing gnulib-cvs directory.
        * doc/find-maint.texi (Using the GNU Portability Library): Desribe
        how we now obtain gnulib.  Update the instructions on how we patch
        * .gitignore: Ignore gnulib-git, not gnulib-cvs
        * .cvsignore: Ditto
        * (findutils-check-smells): Change from gnulib-cvs to
        * README-CVS: Mention the extra dependency on git.
        * NEWS: Mention this change.
 .cvsignore           |    2 +-
 .gitignore           |    2 +-          |    2 +-
 NEWS                 |    6 +++
 README-CVS           |    5 +-
 doc/find-maint.texi  |   35 ++++++++---------
 import-gnulib.config |    2 +-     |  106 +++++++++++++++++++++++---------------------------
 8 files changed, 78 insertions(+), 82 deletions(-)

diff --git a/.cvsignore b/.cvsignore
index e8fb221..87c055e 100644
--- a/.cvsignore
+++ b/.cvsignore
@@ -16,6 +16,6 @@ config.guess
diff --git a/.gitignore b/.gitignore
index 2b960a1..1202ec7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -16,7 +16,7 @@ config.guess
diff --git a/ b/
index 30ff461..63bc388 100644
--- a/
+++ b/
@@ -60,7 +60,7 @@ findutils-check-testfiles:
        find  $(srcdir) \( -path $(srcdir)/autom4te.cache -o  \
-                           -path $(srcdir)/gnulib-cvs     -o  \
+                           -path $(srcdir)/gnulib-git     -o  \
                            -name .git             -o  \
                            \( -type d -name CVS \)  \
                        \) -prune -o                  \
diff --git a/NEWS b/NEWS
index 12f2478..e4b9bd3 100644
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,12 @@ bugfix).
 ** Bug Fixes
+#21568: Switch to checking the gnulib code out with native git, not
+CVS.  This affects mainly those who check findutils code out of CVS.
+This is not the first time this bug has been fixed (the previous fix
+used "cvs update -D", which git-cvspserver silently does not
 #21039: Setting the POSIXLY_CORRECT environment variable now turns off
 warnings by default, because POSIX requires that only diagnostic
 messages (and -ok prompts) are printed on STDERR, and diagnostic
diff --git a/README-CVS b/README-CVS
index bc0471d..ec9ed7a 100644
@@ -2,7 +2,8 @@ This file describes how to build findutils starting from a set 
of code
 checked out of CVS, rather than from a released source distribution.
 1. Prerequisites
- * CVS
+ * CVS (to check out findutils itself)
+ * git (to check out the gnulib code)
  * A C compiler, linker and software development libraries (the standard
    C library)
  * GNU Autoconf version 2.61 or later (earlier versions *may* work)
@@ -21,7 +22,7 @@ checked out of CVS, rather than from a released source 
  This command will use CVS to check out the version of gnulib which is
  intended to work with the findutils source you already have, as
  configured by the file import-gnulib.config.  The gnulib code itself
- is left in the directory "gnulib-cvs".  The "gnulib" directory
+ is left in the directory "gnulib-git".  The "gnulib" directory
  contains just the gnulib files that findutils needs during the build
diff --git a/doc/find-maint.texi b/doc/find-maint.texi
index 5f176f1..c025452 100644
--- a/doc/find-maint.texi
+++ b/doc/find-maint.texi
@@ -484,7 +484,9 @@ GNU libc system with a bug in the regex implementation.
 @section How and Why we Import the Gnulib Code
 Gnulib does not have a release process which results in a source
 tarball you can download.  Instead, the code is simply made available
-by CVS.
+by GIT.   The code is also available via @code{git-cvspserver}, but
+since that lacks working support for @code{cvs update -D}, we don't
+use it.
 GNU projects vary in how they interact with Gnulib.  Many import a
 selection of code from Gnulib into the working directory and then
@@ -507,11 +509,11 @@ there which aren't there already.
 An analogous approach is taken with Gnulib.  The Gnulib code is
 imported from the CVS repository for Gnulib with a findutils helper
 script, @code{}.  That script fetches a copy of the
-Gnulib code into the subdirectory @file{gnulib-cvs} and then runs
+Gnulib code into the subdirectory @file{gnulib-git} and then runs
 @code{gnulib-tool}.  The @code{gnulib-tool} program copies the
 required parts of Gnulib into the findutils source tree in the
 subdirectory @file{gnulib}.  This process gives us the property that
-the code in @file{gnulib} and @code{gnulib-cvs} is not included in the
+the code in @file{gnulib} and @code{gnulib-git} is not included in the
 findutils CVS tree.   Both directories are listed in @file{.cvsignore}
 and so CVS ignores them.
@@ -560,9 +562,10 @@ is not already fixed in current Gnulib CVS):
 Download the Findutils source code from CVS (or use the tree you have
 @item Check out a copy of the Gnulib source
-An easy way to do this is to simply use @code{cp -ar} on the
address@hidden directory.   Have the Gnulib code checked out
-somewhere @emph{outside} your working CVS tree for findutils.
+An easy way to do this is to use @code{git clone} to clone a local
+gnulib repository you already generated with @code{}.
+Have the Gnulib code checked out somewhere @emph{outside} your working
+CVS tree for findutils.
 @item Import Gnulib from your local copy
 The @code{} tool has a @samp{-d} option which you can
 use to import the code from a local copy of Gnulib.
@@ -585,24 +588,18 @@ with the GNU coding standards, and email it to the Gnulib 
 @item Wait for the patch to be applied
 Once your bug fix has been applied, you can update your local directory
-from CVS, re-import the code into Findutils (still using the @code{-d}
+from git, re-import the code into Findutils (still using the @code{-d}
 option), and re-run the tests.  This verifies that the fix the Gnulib
 team made actually fixes your problem.
 @item Reimport the Gnulib code
-Update the findutils file @file{import-gnulib.config} to specify a
-date which is after the point at which the bug fix was committed to
-Gnulib.  Finally, re-import the Gnulib code directly from CVS by using
+Update the findutils file @file{import-gnulib.config} to specify git
+commit which is after the point at which the bug fix was committed to
+Gnulib.  You can do this with @code{git show HEAD}.  Finally,
+re-import the Gnulib code directly from git by using
 @samp{} without the @samp{-d} option, and run the
 tests again.  This verifies that there was no remaining local change
-that we were relying on to fix the bug.
-Be aware of the fact that the date specified in the
address@hidden file selects the latest changes for the
-given date, so if you modify @file{import-gnulib.config} as soon as
-someone tells you they they checked in a bugfix and you set
address@hidden to today's date, there will be some file version
-instability for the rest of the day.
+that we were relying on to fix the bug.   Make sure you checkjed
+everything in by running @code{git status}.
 @end table
 @node Documentation
diff --git a/import-gnulib.config b/import-gnulib.config
index 88513db..bbf99c2 100644
--- a/import-gnulib.config
+++ b/import-gnulib.config
@@ -1,7 +1,7 @@
 # findutils gnulib.config -*- sh -*-
 # What version of gnulib to use?
diff --git a/ b/
index 9d9f965..548b12a 100755
--- a/
+++ b/
@@ -31,6 +31,7 @@ unset CDPATH
 ## Defaults
 # cvsdir=/doesnotexist
@@ -54,8 +55,8 @@ EOF
 do_checkout () {
-    local cvsdir="$1"
-    echo checking out gnulib from CVS in $cvsdir
+    local gitdir="$1"
+    echo checking out gnulib from GIT in $gitdir
     if [ -z "$gnulib_version" ] ; then
        echo "Error: There should be a gnulib_version setting in $configfile, 
but there is not." >&2
@@ -63,68 +64,31 @@ do_checkout () {
-    if ! [ -d "$cvsdir" ] ; then
-       if mkdir "$cvsdir" ; then
-       echo "Created $cvsdir"
+    if ! [ -d "$gitdir" ] ; then
+       if mkdir "$gitdir" ; then
+       echo "Created $gitdir"
-       echo "Failed to create $cvsdir" >&2
+       echo "Failed to create $gitdir" >&2
        exit 1
-    # Decide if gnulib_version is probably a date or probably a tag.
-    if date -d yesterday >/dev/null ; then
-       # It looks like GNU date is available
-       if date -d "$gnulib_version" >/dev/null ; then
-       # Looks like a date.
-       cvs_sticky_option="-D"
-       else
-       echo "Warning: assuming $gnulib_version is a CVS tag rather than a 
date" >&2
-       cvs_sticky_option="-r"
-       fi
-    else
-       # GNU date unavailable, assume the version is a date
-       cvs_sticky_option="-D"
-    fi
-       # Change directory unconditionally (rater than using checkout
-       # -d) so that cvs does not pick up defaults from ./CVS.  Those
-       # defaults refer to our own CVS repository for our code, not
-       # to gnulib.
-       cd $cvsdir
-       # gnulib now uses git as master repository, but used to use
-       # CVS.   Check that we are not running against an old working
-       # directory which is still pointing at the old CVS repository.
-       rootfile=gnulib/CVS/Root
-       cvs_git_root=":pserver:address@hidden:/gnulib.git"
-       if test -d gnulib/CVS
-       then
-         if test x"$(cat $rootfile)" == x"$cvs_git_root"; then
-             echo "Using the git repository via git-cvs-pserver..."
-         else
-             echo "WARNING: Migrating from old CVS repository" >&2
-             # Force use of "cvs checkout" as opposed to update.
-             mv gnulib gnulib.before-git-migration
-         fi
-       fi
+       # Change directory unconditionally.  We used to do this to avoid
+       # the cvs client picking up defaults from findutils' ./CVS/*, but 
+       # now we just do it for the sake of a minimum change.
+       cd $gitdir
-       if test -d gnulib/CVS ; then
-         cd gnulib
-         cmd=update
-         root="" # use previous
-         args=
+       if test -d gnulib/.git ; then
+         echo "Git repository was already initialised."
-         cmd=checkout
-         root="-d $cvs_git_root"
-         args="-d gnulib HEAD"
+         echo "Cloning the git repository..."
+         git clone "$git_repo"
+       cd gnulib
        set -x
-       cvs -q $root $cmd $cvs_sticky_option "$gnulib_version" $args
+       git fetch origin
+       git checkout "$gnulib_version"
        set +x
@@ -269,6 +233,26 @@ EOF
+move_cvsdir() {
+    local cvs_git_root=":pserver:address@hidden:/gnulib.git"
+    if test -d gnulib-cvs/gnulib/CVS
+    then
+      if test x"$(cat gnulib-cvs/gnulib/CVS/Root)" == x"$cvs_git_root"; then
+          # We cannot use the git-cvspserver interface because 
+          # "update -D" doesn't work.
+          echo "WARNING: Migrating from git-cvs-pserver to native git..." >&2
+          savedir=gnulib-cvs.before-nativegit-migration
+      else
+          # The old CVS repository is not updated any more.
+          echo "WARNING: Migrating from old CVS repository to native git" >&2
+          savedir=gnulib-cvs.before-git-migration
+      fi
+      mv gnulib-cvs $savedir || exit 1
+      echo "Please delete $savedir eventually"
+    fi
 main() {
     ## Option parsing
     local gnulibdir=/doesnotexist
@@ -285,10 +269,18 @@ main() {
     # to use, even if we don't want to know the CVS version.
     . $configfile || exit 1
-    ## If -d was not given, do CVS checkout/update
+    ## If -d was not given, do update
     if [ $need_checkout = yes ] ; then
-       do_checkout gnulib-cvs
-       gnulibdir=gnulib-cvs/gnulib
+       if ! git version > /dev/null; then
+           cat >&2 <<EOF
+You now need the tool 'git' in order to check out the correct version
+of the gnulib code.  See for more information about git.
+           exit 1
+       fi
+       move_cvsdir
+       do_checkout gnulib-git
+       gnulibdir=gnulib-git/gnulib
        echo "Warning: using gnulib code which already exists in $gnulibdir" >&2

reply via email to

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