From a4b720fa029631352cb23df581c7b2aea39ee2c8 Mon Sep 17 00:00:00 2001 From: James Youngman Date: Wed, 28 Feb 2007 23:57:54 +0000 Subject: [PATCH] New method of checking out and configuring gnulib - define which version we need to use, and remember which version we used --- .cvsignore | 1 + ChangeLog | 24 ++++++++ Makefile.am | 3 +- NEWS | 8 +++ README-CVS | 43 +++++++------ configure.in | 2 +- find/parser.c | 2 + import-gnulib.config | 40 ++++++++++++ import-gnulib.sh | 139 +++++++++++++++++++++++++----------------- lib/.cvsignore | 1 + lib/Makefile.am | 16 +++-- lib/gnulib-version.h | 21 +++++++ lib/gnulib-version.sh | 50 +++++++++++++++ locate/code.c | 2 + locate/locate.c | 3 +- xargs/xargs.c | 2 + 16 files changed, 271 insertions(+), 86 deletions(-) create mode 100644 import-gnulib.config create mode 100644 lib/gnulib-version.h create mode 100644 lib/gnulib-version.sh diff --git a/.cvsignore b/.cvsignore index f9ae1800..23d98498 100644 --- a/.cvsignore +++ b/.cvsignore @@ -14,3 +14,4 @@ config.sub config.rpath config.guess gnulib +gnulib-cvs diff --git a/ChangeLog b/ChangeLog index 67a241f7..5ed6a511 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,27 @@ +2007-02-28 James Youngman + + * import-gnulib.config: New file. Specifies which version of + Gnulib we need to check out and build from. + + * import-gnulib.sh: Use import-gnulib.config. + + * README-CVS: Describe the new method of building from CVS. + + * lib/gnulib-version.h, lib/gnulib-version.sh: New files; code for + reporting which version of Gnulib we built findutils from. + + * lib/Makefile.am: Build gnulib-version.c out of + ./gnulib-version.config by using lib/gnulib-version.sh. + + * Makefile.am: Ship import-gnulib.config and import-gnulib.sh. + + * .cvsignore: Ignore gnulib-cvs + + * lib/.cvsignore: Ignore gnulib-version.c + + * find/parser.c, locate/code.c, locate/locate.c, xargs/xargs.c: + Report which version of Gnulib we were built from. + 2007-02-27 James Youngman * import-gnulib.sh, find/defs.h, find/fstype.c, find/tree.c, diff --git a/Makefile.am b/Makefile.am index 457703b0..f1eb84bd 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,7 +2,7 @@ AUTOMAKE_OPTIONS=gnits # readme-alpha EXTRA_DIST = COPYING ChangeLog TODO install-sh config.h.in stamp-h.in \ - THANKS config.rpath + THANKS config.rpath import-gnulib.sh import-gnulib.config SUBDIRS = gnulib lib find xargs locate doc po m4 ACLOCAL_AMFLAGS = -I gnulib/m4 -I m4 @@ -54,3 +54,4 @@ findutils-check-testfiles: distcount=`ls $(distdir)/*/testsuite/*/*.xe | wc -l` && srccount=`ls $(srcdir)/*/testsuite/*/*.xe | wc -l` && echo source $$srccount distributed $$distcount && test $$distcount -eq $$srccount @echo ; echo Checking to see if we distributed the full set of .xi files distcount=`ls $(distdir)/*/testsuite/inputs/*.xi | wc -l` && srccount=`ls $(srcdir)/*/testsuite/inputs/*.xi | wc -l` && echo source $$srccount distributed $$distcount && test $$distcount -eq $$srccount + diff --git a/NEWS b/NEWS index bba2f96e..2953afae 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,13 @@ GNU findutils NEWS - User visible changes. -*- outline -*- (allout)* +* Major changes in release 4.2.31-CVS + +Findutils has switched to a new way of building the code from gnulib. +There should be no functional difference; the change should not be +visible to those using the findutils binaries, except for changes to +the output of "find --version", which should now show the version of +Gnulib which was used. + * Major changes in release 4.2.30 ** Bug Fixes diff --git a/README-CVS b/README-CVS index 99d5885b..bc0471d2 100644 --- a/README-CVS +++ b/README-CVS @@ -5,34 +5,35 @@ checked out of CVS, rather than from a released source distribution. * CVS * A C compiler, linker and software development libraries (the standard C library) - * GNU Autoconf version 2.57 or later (earlier versions *may* work) - * GNU Automake version 1.7 or later (earlier versions *may* work) + * GNU Autoconf version 2.61 or later (earlier versions *may* work) + * GNU Automake version 1.9 or later (earlier versions *may* work) * GNU m4 version 1.4 or later * GNU gettext (unless you use configure --disable-nls) -2. Obtain a copy of Gnulib - - To obtain a copy of the gnulib library, check it out via anonymous CVS - from the GNU CVS server. Make sure you check it out into a separate - directory, away from the findutils sources. - - CVS_RSH=ssh - export CVS_RSH - cvs -z3 -d:ext:anoncvs@savannah.gnu.org:/cvsroot/gnulib co gnulib - -3. Generate a gnulib installation within the fileutils source tree +2. Generate a gnulib installation within the fileutils source tree Change your working directory to the findutils source directory (that is, the directory containing this file). Then run the following command:- - sh import-gnulib.sh + sh import-gnulib.sh -4. Generate the configure scripts and Makefile.in files. + 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 + contains just the gnulib files that findutils needs during the build + process. - autoreconf -i + If you want to build findutils with a different version of gnulib, + just edit import-gnulib.config to change the version and then re-run + import-gnulib.sh. When specifying the version, you can specify + either the date or a CVS tag. If making any kind of release, please + use a fully identifying version (rather than just, say, "HEAD"). - ... or use the alternative method ... + The import-gnulib.sh script will also run Autoconf and Automake to + generate the "configure" script and "Makefile.in" files. Should you + need to do this manually, you can do it like this :- aclocal -I m4 -I gnulib/m4 && \ autoheader && \ @@ -40,6 +41,8 @@ checked out of CVS, rather than from a released source distribution. automake --add-missing --copy -5. Run "configure" and "make" in the normal way. If you have GNU - libintl installed, you can just run "configure". Otherwise, run - "configure --disable-nls". +3. Run "configure" and "make" in the normal way. + + If you have GNU libintl installed, you can just run "configure". + Otherwise, run "configure --disable-nls". + diff --git a/configure.in b/configure.in index eac99432..da9f4761 100644 --- a/configure.in +++ b/configure.in @@ -1,5 +1,5 @@ dnl Process this file with autoconf to produce a configure script. -AC_INIT([GNU findutils], 4.2.30, [bug-findutils@gnu.org]) +AC_INIT([GNU findutils], 4.2.31-CVS, [bug-findutils@gnu.org]) AM_INIT_AUTOMAKE AC_CONFIG_SRCDIR([find/pred.c]) diff --git a/find/parser.c b/find/parser.c index 3bd243ff..4dfcc279 100644 --- a/find/parser.c +++ b/find/parser.c @@ -34,6 +34,7 @@ #include "nextelem.h" #include "stdio-safer.h" #include "regextype.h" +#include "gnulib-version.h" #ifdef HAVE_FCNTL_H #include @@ -1687,6 +1688,7 @@ parse_version (const struct parser_table* entry, char **argv, int *arg_ptr) fflush (stderr); printf (_("GNU find version %s\n"), version_string); + printf (_("Built using GNU gnulib version %s\n"), gnulib_version); printf (_("Features enabled: ")); #if CACHE_IDS diff --git a/import-gnulib.config b/import-gnulib.config new file mode 100644 index 00000000..9f4f7b89 --- /dev/null +++ b/import-gnulib.config @@ -0,0 +1,40 @@ +# What version of gnulib to use? +# To late: gnulib_version="2005-07-30" +# ?Too early gnulib_version="2005-07-10" + +gnulib_version="2005-07-26" +# 4.2.29: At or after 2005-07-11 12:21:55 +0100 (lib/getcwd.h) +# 4.2.29: At or after 2005-07-11 12:21:55 +0100 (lib/time_r.h) +# 4.2.29: At or after 2005-07-15 22:01:41 +0100 (lib/quotearg.c) +# 4.2.29: At or after 2005-07-26 22:55:31 +0100 (m4/getopt.m4) + + +# 4.2.29: Before 2005-09-19 18:28:14 +0100 (lib/quotearg.c) +# 4.2.29: Before 2006-03-12 07:58:12 +0000 (lib/time_r.h) + + +destdir="gnulib" + +# Random extra gnulib files needed for findutils. +extra_files=' +build-aux/config.guess +build-aux/config.rpath +build-aux/config.sub +build-aux/depcomp +build-aux/install-sh +build-aux/mdate-sh +build-aux/missing +build-aux/texinfo.tex +' + +# Modules needed for findutils. +# We need regex to ensure that we can build on platforms like +# Solaris which lack those functions. +modules="\ +alloca argmatch dirname error fileblocks fnmatch-gnu \ +getline getopt human idcache lstat malloc memcmp memset mktime \ +modechange pathmax quotearg realloc regex rpmatch savedir stat stdio-safer \ +stpcpy strdup strftime strstr strtol strtoul strtoull strtoumax \ +xalloc xalloc-die xgetcwd xstrtol xstrtoumax yesno human filemode \ +getline stpcpy canonicalize mountlist closeout gettext stat-macros" + diff --git a/import-gnulib.sh b/import-gnulib.sh index 172b1342..c9075889 100755 --- a/import-gnulib.sh +++ b/import-gnulib.sh @@ -1,7 +1,7 @@ #! /bin/sh # # import-gnulib.sh -- imports a copy of gnulib into findutils -# Copyright (C) 2003,2004,2005,2006,2007 Free Software Foundation, Inc. +# Copyright (C) 2003,2004,2005,2006 Free Software Foundation, Inc. # # 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 @@ -20,53 +20,79 @@ # ########################################################################## # -# This script is intended to populate the "gnulib" directory +# This script is intended to populate the "gnulib" directory # with a subset of the gnulib code, as provided by "gnulib-tool". # -# To use it, run this script, speficying the location of the -# gnulib code as the only argument. Some sanity-checking is done +# To use it, run this script, speficying the location of the +# gnulib code as the only argument. Some sanity-checking is done # before we commit to modifying things. The gnulib code is placed -# in the "gnulib" subdirectory, which is where the buid files expect -# it to be. -# +# in the "gnulib" subdirectory, which is where the buid files expect +# it to be. +# -# If CDPATH is set, it will sometimes print the name of the directory -# to which you have moved. Unsetting CDPATH prevents this, as does +# If CDPATH is set, it will sometimes print the name of the directory +# to which you have moved. Unsetting CDPATH prevents this, as does # prefixing it with ".". unset CDPATH +configfile="./import-gnulib.config" +cvsdir="gnulib-cvs" -destdir="gnulib" +source $configfile - -# Modules needed for findutils itself. -findutils_modules="\ -alloca argmatch dirname error fileblocks fnmatch-gnu \ -getline getopt human idcache lstat malloc memcmp memset mktime \ -modechange pathmax quotearg realloc regex rpmatch savedir stat stdio-safer \ -stpcpy strdup strftime strstr strtol strtoul strtoull strtoumax \ -xalloc xalloc-die xgetcwd xstrtol xstrtoumax yesno human filemode \ -getline stpcpy canonicalize mountlist closeout gettext stat-macros" - -# We need regex to ensure that we can build on platforms like -# Solaris which lack those functions. - -modules="$findutils_modules $intl_modules" -export modules - -if test $# -lt 1 +if [ -z "$gnulib_version" ] then - echo "You need to specify the name of the directory containing gnulib" >&2 + echo "Error: There should be a gnulib_version setting in $configfile, but there is not." >&2 exit 1 fi -if test -d "$1" -then - true + +if ! [ -d "$cvsdir" ] ; then + if mkdir "$cvsdir" ; then + echo "Created $cvsdir" + else + echo "Failed to create $cvsdir" >&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 - echo "$1 is not a directory" >&2 - exit 1 + # 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 + if test -d gnulib/CVS ; then + cd gnulib + cmd=update + root="" # use previous + else + root="-d :pserver:anonymous@cvs.sv.gnu.org:/sources/gnulib" + cmd=checkout + args=gnulib + fi + set -x + cvs -q -z3 $root $cmd $cvs_sticky_option "$gnulib_version" $args + set +x +) + +set x $cvsdir/gnulib ; shift + if test -f "$1"/gnulib-tool then true @@ -83,17 +109,15 @@ else exit 1 fi - -# exec "$1"/gnulib-tool --create-testdir --dir="$destdir" --lib=libgnulib $modules if [ -d gnulib ] then - echo "Warning: directory gnulib already exists." >&2 -else - mkdir gnulib + echo "Warning: directory gnulib already exists, removing it." >&2 + rm -rf gnulib fi +mkdir gnulib - +printf "Running gnulib-tool..." if "$1"/gnulib-tool --import --dir=. --lib=libgnulib --source-base=gnulib/lib --m4-base=gnulib/m4 $modules then : OK @@ -101,6 +125,19 @@ else echo "gnulib-tool failed, exiting." >&2 exit 1 fi +echo done + + + +## for file in $extra_files; do +## bn="$(basename $file)" +## case "$file" in +## */mdate-sh | */texinfo.tex) dest=doc; destfile=doc/"$bn";; +## *) dest=.; destfile="$bn";; +## esac +## cmp "$file" "$destfile" || cp -fpv "$1"/"$file" "$dest" || exit 1 +## done + @@ -119,21 +156,9 @@ SUBDIRS = lib EOF -## ( -## cat <&2 + exit 1 +fi + + +cat > "${outfile}".new < /dev/null + then + # nothing to do + rm "${outfile}".new + exit 0 + fi +fi +mv "${outfile}".new "${outfile}" diff --git a/locate/code.c b/locate/code.c index 2caa40ba..99b79c92 100644 --- a/locate/code.c +++ b/locate/code.c @@ -77,6 +77,7 @@ #include "locatedb.h" #include #include "closeout.h" +#include "gnulib-version.h" char *xmalloc PARAMS((size_t)); @@ -163,6 +164,7 @@ main (int argc, char **argv) else if (0 == strcmp(argv[1], "--version")) { printf (_("GNU findutils version %s\n"), version_string); + printf (_("Built using GNU gnulib version %s\n"), gnulib_version); return 0; } diff --git a/locate/locate.c b/locate/locate.c index c94a826f..02e18944 100644 --- a/locate/locate.c +++ b/locate/locate.c @@ -135,7 +135,7 @@ extern int errno; #include "quotearg.h" #include "printquoted.h" #include "regextype.h" - +#include "gnulib-version.h" /* Note that this evaluates C many times. */ #ifdef _LIBC @@ -1229,6 +1229,7 @@ main (int argc, char **argv) case 'v': printf (_("GNU locate version %s\n"), version_string); + printf (_("Built using GNU gnulib version %s\n"), gnulib_version); return 0; case 'w': diff --git a/xargs/xargs.c b/xargs/xargs.c index 3198214e..d44d28c3 100644 --- a/xargs/xargs.c +++ b/xargs/xargs.c @@ -168,6 +168,7 @@ typedef int boolean; #include #include "closeout.h" +#include "gnulib-version.h" void error PARAMS ((int status, int errnum, char *message,...)); @@ -572,6 +573,7 @@ main (int argc, char **argv) case 'v': printf (_("GNU xargs version %s\n"), version_string); + printf (_("Built using GNU gnulib version %s\n"), gnulib_version); return 0; default: