Check gnulib out with native git, rather than git-cvspserver. This fixes Savannah bug #21568, for the second time.

This commit is contained in:
James Youngman 2007-11-29 11:07:19 +00:00
parent 31be13fc29
commit 2f0f45ff8f
9 changed files with 104 additions and 82 deletions

View File

@ -16,6 +16,6 @@ config.guess
gnulib
install-sh
link-warning.h
gnulib-cvs
gnulib-git
tests
findutils-*

2
.gitignore vendored
View File

@ -16,7 +16,7 @@ config.guess
gnulib
install-sh
link-warning.h
gnulib-cvs
gnulib-git
tests
*~
patches

View File

@ -1,5 +1,24 @@
2007-11-29 James Youngman <jay@gnu.org>
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".
* import-gnulib.sh (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
gnulib.
* .gitignore: Ignore gnulib-git, not gnulib-cvs
* .cvsignore: Ditto
* Makefile.am (findutils-check-smells): Change from gnulib-cvs to
gnulib-git.
* README-CVS: Mention the extra dependency on git.
* NEWS: Mention this change.
Add test case for Savannah bug #20803 (-prune return value).
* find/testsuite/find.posix/prune-result.exp: New test for
Savannah bug #20803.

View File

@ -60,7 +60,7 @@ findutils-check-testfiles:
findutils-check-smells:
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 \

6
NEWS
View File

@ -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
support).
#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

View File

@ -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 distribution.
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
process.

View File

@ -484,7 +484,10 @@ 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
we decided not to use this, since @code{import-gnulib.sh} depended on
@code{cvs update -D}, which at the time @code{git-cvspserver} did not
support.
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 +510,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{import-gnulib.sh}. 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 +563,14 @@ is not already fixed in current Gnulib CVS):
Download the Findutils source code from CVS (or use the tree you have
already)
@item Check out a copy of the Gnulib source
An easy way to do this is to simply use @code{cp -ar} on the
@file{gnulib-cvs} directory. Have the Gnulib code checked out
somewhere @emph{outside} your working CVS tree for findutils.
Check out a copy of the Gnulib source tree. The
@code{import-gnulib.sh} script may have generated a shallow git clone
as opposed to a normal, full clone in the directory @file{gnulib-git}.
This means that you may not be able to clone the repository that
@code{import-gnulib.sh} generates. However, you can make a normal
(full) clone with @code{git clone
git_repo="git://git.savannah.gnu.org/gnulib.git"}. Do this somewhere
outside the findutils source tree.
@item Import Gnulib from your local copy
The @code{import-gnulib.sh} tool has a @samp{-d} option which you can
use to import the code from a local copy of Gnulib.
@ -585,24 +593,18 @@ with the GNU coding standards, and email it to the Gnulib mailing
list.
@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 rev-parse HEAD}. Finally,
re-import the Gnulib code directly from git by using
@samp{import-gnulib.sh} 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
@file{import-gnulib.config} 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
@var{gnulib_version} 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 checked
everything in by running @code{git status}.
@end table
@node Documentation

View File

@ -1,7 +1,7 @@
# findutils gnulib.config -*- sh -*-
# What version of gnulib to use?
gnulib_version="2007-11-10"
gnulib_version="a1d5bf4615a98dd53267bf49646a09b823df3fe2"
destdir="gnulib"

View File

@ -31,6 +31,7 @@ unset CDPATH
## Defaults
# cvsdir=/doesnotexist
git_repo="git://git.savannah.gnu.org/gnulib.git"
configfile="./import-gnulib.config"
need_checkout=yes
@ -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,33 @@ do_checkout () {
fi
if ! [ -d "$cvsdir" ] ; then
if mkdir "$cvsdir" ; then
echo "Created $cvsdir"
if ! [ -d "$gitdir" ] ; then
if mkdir "$gitdir" ; then
echo "Created $gitdir"
else
echo "Failed to create $cvsdir" >&2
echo "Failed to create $gitdir" >&2
exit 1
fi
fi
# 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
# 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
# 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:anonymous@pserver.git.sv.gnu.org:/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
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."
else
cmd=checkout
root="-d $cvs_git_root"
args="-d gnulib HEAD"
echo "Cloning the git repository..."
# In the future we may use a shallow clone to
# save bandwidth.
git clone "$git_repo"
fi
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 +235,26 @@ EOF
}
move_cvsdir() {
local cvs_git_root=":pserver:anonymous@pserver.git.sv.gnu.org:/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 +271,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 http://git.or.cz/ for more information about git.
EOF
exit 1
fi
move_cvsdir
do_checkout gnulib-git
gnulibdir=gnulib-git/gnulib
else
echo "Warning: using gnulib code which already exists in $gnulibdir" >&2
fi