Manage gnulib as a git submodule.

* .gitmodules: New file; manage gnulib as a submodule.  For future
compatibility with the "bootstrap" script, keep the gnulib
submodule in the gnulib directory (instead of the gnulib-git
directory as before).  This means we need to find a new directory
for the output of gnulib-tool; we will use "gl" for that.
* import-gnulib.sh (do_checkout): Replace with do_submodule.
(do_submodule): initialise and configure the gnulib module.
(main): call do_submodule instead of do_checkout.  Don't call
move_cvsdir, it's obsolete.
(move_cvsdir): delete
* Makefile.am (SUBDIRS): Rename gnulib to gl.
(ACLOCAL_AMFLAGS): Likewise.
(findutils-check-smells): Rename gnulib-git to gnulib.
* .gitignore: Rename gnulib to gl.
This commit is contained in:
James Youngman 2011-05-30 00:34:18 +01:00
parent de53ac2607
commit d09450a94c
12 changed files with 118 additions and 141 deletions

3
.gitignore vendored
View File

@ -14,10 +14,9 @@ stamp-h1
config.sub
config.rpath
config.guess
gnulib
gl
install-sh
link-warning.h
gnulib-git
tests
*~
patches

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "gnulib"]
path = gnulib
url = git://git.sv.gnu.org/gnulib.git

View File

@ -1,3 +1,40 @@
2011-05-30 James Youngman <jay@gnu.org>
Manage gnulib as a git submodule.
* .gitmodules: New file; manage gnulib as a submodule. For future
compatibility with the "bootstrap" script, keep the gnulib
submodule in the gnulib directory (instead of the gnulib-git
directory as before). This means we need to find a new directory
for the output of gnulib-tool; we will use "gl" for that.
* import-gnulib.sh (do_checkout): Replace with do_submodule.
(do_submodule): initialise and configure the gnulib module.
(main): call do_submodule instead of do_checkout. Don't call
move_cvsdir, it's obsolete.
(move_cvsdir): delete
(run_gnulib_tool): change gnulib to ${gldest} (and set that variable).
(hack_gnulib_tool_output): generate gl/Makefile.am, not
gnulib/Makefile.am.
(refresh_output_files): Rename gnulib to gl.
(update_version_file): Check the state of the submodule.
* Makefile.am (SUBDIRS): Rename gnulib to gl.
(ACLOCAL_AMFLAGS): Likewise.
* lib/Makefile.am (INCLUDES): Likewise.
(LDADD): Likewise.
(findutils-check-smells): Rename gnulib-git to gnulib.
* find/Makefile.am (INCLUDES): Change gnulib to gl.
(LDADD): Likewise.
* xargs/Makefile.am (INCLUDES): Change gnulib to gl.
(LDADD): Likewise.
* locate/Makefile.am (INCLUDES): Rename gnulib to gl.
(LDADD): Likewise.
* .gitignore: Rename gnulib to gl.
* configure.ac (AC_CONFIG_MACRO_DIR): Change to gl/m4.
(AC_CONFIG_FILES): use gl/Makefile and gl/lib/Makefile instead of
gnulib/Makefile and gnulib/lib/Makefile.
* find/fstype.c: Include gnulib include files as "foo.h", not
"../gnulib/lib/foo.h", because the relative path is not needed and
in any case has changed.
2011-05-29 James Youngman <jay@gnu.org>
Savannah bug #31424: Revert Interix-specific change.

View File

@ -9,14 +9,12 @@ DISTCLEANFILES = tool-versions.txt
# "tests" is the gnulib unit test dir.
SUBDIRS = gnulib tests build-aux lib find xargs locate doc po m4
SUBDIRS = gl tests build-aux lib find xargs locate doc po m4
ACLOCAL_AMFLAGS = -I gnulib/m4 -I m4
ACLOCAL_AMFLAGS = -I gl/m4 -I m4
TESTFILE_SUFFIXES = .exp .xo .xe .xi
# CONFIG_CLEAN_FILES = gnulib/lib/regex.c
tool-versions.txt: Makefile
( automake --version ; echo ; \
autoconf --version ; echo ; \
@ -49,7 +47,7 @@ findutils-check-testfiles:
findutils-check-smells:
find $(srcdir) \( -path $(srcdir)/autom4te.cache -o \
-path $(srcdir)/gnulib-git -o \
-path $(srcdir)/gnulib -o \
-name .git -o \
\( -type d -name CVS \) \
\) -prune -o \

View File

@ -6,7 +6,7 @@ AM_INIT_AUTOMAKE
AC_CONFIG_SRCDIR([find/pred.c])
AC_CONFIG_HEADERS([config.h])
AC_CANONICAL_HOST
AC_CONFIG_MACRO_DIR(gnulib/m4)
AC_CONFIG_MACRO_DIR(gl/m4)
dnl Set of available languages.
ALL_LINGUAS="be bg cs ca da de el eo es et fi fr ga gl hr hu id it ja ko lg lt ms nl pl pt pt_BR ro ru rw sk sl sr sv tr uk vi zh_CN zh_TW"
@ -93,7 +93,7 @@ gl_WARN_ADD([-Wdeclaration-after-statement])
gl_WARN_ADD([-Wall])
dnl Older versions of gnulib/m4/nls.m4 provide AM_MKINSTALLDIRS.
dnl Older versions of gl/m4/nls.m4 provide AM_MKINSTALLDIRS.
dnl The current version of gnulib does not, but the version of
dnl po/Makefile.in.in that comes with gettext-0.14.6 expects
dnl that @MKINSTALLDIRS@ will be expanded.
@ -222,8 +222,8 @@ build-aux/Makefile
doc/Makefile
find/Makefile
find/testsuite/Makefile
gnulib/Makefile
gnulib/lib/Makefile
gl/Makefile
gl/lib/Makefile
lib/Makefile
locate/Makefile
locate/testsuite/Makefile

View File

@ -30,8 +30,8 @@ endif
# We don't just include man_MANS in EXTRA_DIST because while the value of
# man_MANS is not always the same, we want to distribute all of those files.
EXTRA_DIST = defs.h sharefile.h find.1 ftsfind.1 oldfind.1
INCLUDES = -I../gnulib/lib -I$(top_srcdir)/lib -I$(top_srcdir)/gnulib/lib -I../intl -DLOCALEDIR=\"$(localedir)\"
LDADD = ./libfindtools.a ../lib/libfind.a ../gnulib/lib/libgnulib.a $(LIBINTL) $(LIB_CLOCK_GETTIME) $(LIB_EACCESS) $(LIB_SELINUX) $(LIB_CLOSE) $(MODF_LIBM) @FINDLIBS@
INCLUDES = -I../gl/lib -I$(top_srcdir)/lib -I$(top_srcdir)/gl/lib -I../intl -DLOCALEDIR=\"$(localedir)\"
LDADD = ./libfindtools.a ../lib/libfind.a ../gl/lib/libgnulib.a $(LIBINTL) $(LIB_CLOCK_GETTIME) $(LIB_EACCESS) $(LIB_SELINUX) $(LIB_CLOSE) $(MODF_LIBM) @FINDLIBS@
SUBDIRS = . testsuite
#$(PROGRAMS): ../lib/libfind.a

View File

@ -1,6 +1,6 @@
/* fstype.c -- determine type of file systems that files are on
Copyright (C) 1990, 1991, 1992, 1993, 1994, 2000,
2004, 2010 Free Software Foundation, Inc.
2004, 2010, 2011 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
the Free Software Foundation, either version 3 of the License, or
@ -52,11 +52,11 @@ extern int errno;
#endif
#include "defs.h"
#include "../gnulib/lib/dirname.h"
#include "dirname.h"
#include "xalloc.h"
/* Need declaration of function `xstrtoumax' */
#include "../gnulib/lib/xstrtol.h"
#include "xstrtol.h"
#include "extendbuf.h"
#include "mountlist.h"

1
gnulib Submodule

@ -0,0 +1 @@
Subproject commit 3532d15484ebc37feded387216d716bc1c3533f6

View File

@ -1,8 +1,8 @@
#! /bin/sh
#
# import-gnulib.sh -- imports a copy of gnulib into findutils
# Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009, 2010 Free Software
# Foundation, Inc.
# Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009, 2010,
# 2011 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
@ -19,10 +19,10 @@
#
##########################################################################
#
# This script is intended to populate the "gnulib" directory
# This script is intended to populate the "gl" directory
# with a subset of the gnulib code, as provided by "gnulib-tool".
#
# To use it, just run this script with the top-level sourec directory
# To use it, just run this script with the top-level source directory
# as your working directory.
# If CDPATH is set, it will sometimes print the name of the directory
@ -31,11 +31,9 @@
unset CDPATH
## Defaults
# cvsdir=/doesnotexist
git_repo="git://git.savannah.gnu.org/gnulib.git"
configfile="./import-gnulib.config"
need_checkout=yes
gnulib_changed=false
gldest=gl
# If $GIT_CLONE_DEPTH is not set, apply a default.
: ${GIT_CLONE_DEPTH:=4}
@ -58,50 +56,34 @@ to specify the directory containing the gnulib code.
EOF
}
do_checkout () {
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
exit 1
fi
if ! [ -d "$gitdir" ] ; then
if mkdir "$gitdir" ; then
echo "Created $gitdir"
else
echo "Failed to create $gitdir" >&2
exit 1
do_submodule () {
local sm_name="$1"
if test -f .gitmodules; then
if git config --file \
.gitmodules "submodule.${sm_name}.url" >/dev/null; then
# Submodule config in .gitmodules is already in place.
# Copy the submodule config into .git.
git submodule init || exit $?
# Update the gnulib module.
git submodule update || exit $?
else
# .gitmodules should include gnulib.
cat >&2 <<EOF
The .gitmodules file is present, but does not list ${sm_name}.
This version of findutils expects it to be there.
Please report this as a bug to bug-findutils@gnu.org.
The .gitmodules file contains this:
EOF
cat .gitmodules >&2
exit 1
fi
fi
# Change directory unconditionally before issuing git commands, because
# we're dealing with two git repositories; the gnulib one and the
# findutils one.
if ( cd $gitdir && test -d gnulib/.git ; ) ; then
echo "Git repository was already initialised."
else
echo "Cloning the git repository..."
( cd $gitdir && git clone --depth="${GIT_CLONE_DEPTH}" "$git_repo" ; )
fi
if ( cd $gitdir/gnulib &&
git diff --name-only --exit-code "$gnulib_version" ; ) ; then
# We are already at the correct version.
# Nothing to do
gnulib_changed=false
echo "Already at gnulib version $gnulib_version; no change"
else
gnulib_changed=true
set -x
( cd $gitdir/gnulib &&
git fetch origin &&
git checkout "$gnulib_version" ; )
set +x
# findutils should have .gitmodules
cat >&2 <<EOF
The .gitmodules file is missing. This version of findutils expects it
to be there. Please report this as a bug to bug-findutils@gnu.org.
EOF
exit 1
fi
}
@ -124,15 +106,18 @@ run_gnulib_tool() {
fi
if [ -d gnulib ]
if [ -d "${gldest}" ]
then
echo "Warning: directory gnulib already exists." >&2
echo "Warning: directory ${gldest} already exists." >&2
else
mkdir gnulib
mkdir "${gldest}"
fi
set -x
if "$tool" --import --symlink --with-tests --dir=. --lib=libgnulib --source-base=gnulib/lib --m4-base=gnulib/m4 --local-dir=gnulib-local $modules
if "$tool" --import --symlink --with-tests \
--dir=. --lib=libgnulib \
--source-base="${gldest}"/lib \
--m4-base="${gldest}"/m4 --local-dir=gnulib-local $modules
then
set +x
else
@ -195,7 +180,7 @@ hack_gnulib_tool_output() {
copyhack "${gnulibdir}"/"$file" "$dest" || exit
done
cat > gnulib/Makefile.am <<EOF
cat > gl/Makefile.am <<EOF
# Copyright (C) 2004, 2009 Free Software Foundation, Inc.
#
# This file is free software, distributed under the terms of the GNU
@ -214,7 +199,7 @@ EOF
refresh_output_files() {
autopoint -f &&
aclocal -I m4 -I gnulib/m4 &&
aclocal -I m4 -I gl/m4 &&
autoheader &&
autoconf &&
automake --add-missing --copy
@ -222,8 +207,11 @@ refresh_output_files() {
update_version_file() {
local gnulib_git_dir="$1"
local ver
outfile="lib/gnulib-version.c"
local outfile="lib/gnulib-version.c"
local gnulib_version="$( cd ${gnulib_git_dir} && git show-ref -s HEAD )"
if [ -z "$gnulib_version" ] ; then
ver="unknown (locally modified code; no version number available)"
else
@ -313,27 +301,6 @@ Example:
}
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
}
record_config_change() {
# $1: name of the import-gnulib.config file
# $2: name of the last.config file
@ -370,53 +337,25 @@ of the gnulib code. See http://git.or.cz/ for more information about git.
EOF
exit 1
fi
move_cvsdir
do_checkout gnulib-git
do_submodule gnulib
check_merge_driver
gnulibdir=gnulib-git/gnulib
gnulibdir=gnulib
else
echo "Warning: using gnulib code which already exists in $gnulibdir" >&2
fi
## If the config file changed since we last imported, or the gnulib
## code itself changed, we will need to re-run gnulib-tool.
lastconfig="./gnulib/last.config"
config_changed=false
if "$gnulib_changed" ; then
echo "The gnulib code changed, we need to re-import it."
else
if test -e "$lastconfig" ; then
if cmp "$lastconfig" "$configfile" ; then
echo "Both gnulib and the import config are unchanged."
else
echo "The gnulib import config was changed."
echo "We need to re-run gnulib-tool."
config_changed=true
fi
else
echo "$lastconfig does not exist, we need to run gnulib-tool."
config_changed=true
fi
fi
## Invoke gnulib-tool to import the code.
local tool="${gnulibdir}"/gnulib-tool
if $gnulib_changed || $config_changed ; then
if run_gnulib_tool "${tool}" &&
hack_gnulib_tool_output "${gnulibdir}" &&
refresh_output_files &&
update_licenses &&
update_version_file &&
record_config_change "$configfile" "$lastconfig"
then
echo Done.
else
echo FAILED >&2
exit 1
fi
if run_gnulib_tool "${tool}" &&
hack_gnulib_tool_output "${gnulibdir}" &&
refresh_output_files &&
update_licenses &&
update_version_file "${gnulibdir}"
then
echo Done.
else
echo "No change to the gnulib code or configuration."
echo "Therefore, no need to run gnulib-tool."
echo FAILED >&2
exit 1
fi
}

View File

@ -30,8 +30,8 @@ DISTCLEANFILES =
MAINTAINERCLEANFILES =
INCLUDES = -I../gnulib/lib -I$(top_srcdir)/gnulib/lib
LDADD = ../gnulib/lib/libgnulib.a $(LIBINTL)
INCLUDES = -I../gl/lib -I$(top_srcdir)/gl/lib
LDADD = ../gl/lib/libgnulib.a $(LIBINTL)
libfind_a_SOURCES += nextelem.h printquoted.h listfile.h \
regextype.h dircallback.h safe-atoi.h

View File

@ -20,11 +20,11 @@ locate_SOURCES = locate.c word_io.c
code_SOURCES = code.c word_io.c
locate_TEXINFOS = dblocation.texi
INCLUDES = -I$(top_srcdir)/lib -I../gnulib/lib -I$(top_srcdir)/gnulib/lib -I../intl -DLOCATE_DB=\"$(LOCATE_DB)\" -DLOCALEDIR=\"$(localedir)\"
INCLUDES = -I$(top_srcdir)/lib -I../gl/lib -I$(top_srcdir)/gl/lib -I../intl -DLOCATE_DB=\"$(LOCATE_DB)\" -DLOCALEDIR=\"$(localedir)\"
LDADD = ../lib/libfind.a ../gnulib/lib/libgnulib.a $(LIB_CLOSE) $(LIBINTL)
LDADD = ../lib/libfind.a ../gl/lib/libgnulib.a $(LIB_CLOSE) $(LIBINTL)
$(PROGRAMS) $(LIBPROGRAMS): ../lib/libfind.a ../gnulib/lib/libgnulib.a
$(PROGRAMS) $(LIBPROGRAMS): ../lib/libfind.a ../gl/lib/libgnulib.a
# We generate updatedb from the Makefile rather than with AC_OUTPUT in
# configure.ac in order to allow the user better control of what goes

View File

@ -3,12 +3,12 @@ AM_CFLAGS = $(WARN_CFLAGS)
localedir = $(datadir)/locale
bin_PROGRAMS = xargs
man_MANS = xargs.1
INCLUDES = -I.. -I../gnulib/lib -I$(top_srcdir)/gnulib/lib -I$(top_srcdir)/lib -I../intl -DLOCALEDIR=\"$(localedir)\"
LDADD = ../lib/libfind.a ../gnulib/lib/libgnulib.a $(LIB_CLOSE) $(LIBINTL)
INCLUDES = -I.. -I../gl/lib -I$(top_srcdir)/gl/lib -I$(top_srcdir)/lib -I../intl -DLOCALEDIR=\"$(localedir)\"
LDADD = ../lib/libfind.a ../gl/lib/libgnulib.a $(LIB_CLOSE) $(LIBINTL)
EXTRA_DIST = $(man_MANS)
SUBDIRS = . testsuite
$(PROGRAMS): ../lib/libfind.a ../gnulib/lib/libgnulib.a
$(PROGRAMS): ../lib/libfind.a ../gl/lib/libgnulib.a
dist-hook: findutils-check-manpages