changeset 16854:f12c273c2b6c

bootstrap: .gitignore files created by autopoint, libtool I ran into this problem when bootstrapping the latest diffutils. After './bootstrap', 'git status' reported lots of untracked files m4/codeset.m4, m4/gettext.m4, etc. These files were created by autopoint and do not need to be version-controlled. * build-aux/bootstrap: Put into .gitignore the files that autopoint and libtool create, by keeping track of files that exist after but not before these programs are run. (version_controlled_file): Move up. 2nd arg is now full file name, not base name; this is more convenient. Put CVS at the end, as it's now somewhat deprecated.
author Paul Eggert <eggert@cs.ucla.edu>
date Mon, 14 May 2012 14:25:20 -0700
parents cbe016b280f4
children 74e5bc0e092e
files ChangeLog build-aux/bootstrap
diffstat 2 files changed, 79 insertions(+), 36 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2012-05-14  Paul Eggert  <eggert@cs.ucla.edu>
+
+	bootstrap: .gitignore files created by autopoint, libtool
+	I ran into this problem when bootstrapping the latest diffutils.
+	After './bootstrap', 'git status' reported lots of untracked files
+	m4/codeset.m4, m4/gettext.m4, etc.  These files were created by
+	autopoint and do not need to be version-controlled.
+	* build-aux/bootstrap: Put into .gitignore the files that
+	autopoint and libtool create, by keeping track of files that exist
+	after but not before these programs are run.
+	(version_controlled_file): Move up.  2nd arg is now full file
+	name, not base name; this is more convenient.  Put CVS at the end,
+	as it's now somewhat deprecated.
+
 2012-05-14  Jim Meyering  <meyering@redhat.com>
 
 	ignore-value.h: remove unused _GL_ATTRIBUTE_DEPRECATED definition
--- a/build-aux/bootstrap
+++ b/build-aux/bootstrap
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Print a version string.
-scriptversion=2012-05-13.09; # UTC
+scriptversion=2012-05-14.21; # UTC
 
 # Bootstrap this package from checked-out sources.
 
@@ -754,6 +754,22 @@
   }
 }
 
+version_controlled_file() {
+  parent=$1
+  file=$2
+  if test -d .git; then
+    git rm -n "$file" > /dev/null 2>&1
+  elif test -d .svn; then
+    svn log -r HEAD "$file" > /dev/null 2>&1
+  elif test -d CVS; then
+    grep -F "/${file##*/}/" "$parent/CVS/Entries" 2>/dev/null |
+             grep '^/[^/]*/[0-9]' > /dev/null
+  else
+    echo "$me: no version control for $file?" >&2
+    false
+  fi
+}
+
 # NOTE: we have to be careful to run both autopoint and libtoolize
 # before gnulib-tool, since gnulib-tool is likely to provide newer
 # versions of files "installed" by these two programs.
@@ -766,43 +782,56 @@
 grep '^[	 ]*AM_GNU_GETTEXT_VERSION(' configure.ac >/dev/null || \
     with_gettext=no
 
-if test $with_gettext = yes; then
-  # Released autopoint has the tendency to install macros that have been
-  # obsoleted in current gnulib, so run this before gnulib-tool.
-  echo "$0: $AUTOPOINT --force"
-  $AUTOPOINT --force || exit
-fi
+if test $with_gettext = yes || test $use_libtool = 1; then
+
+  tempbase=.bootstrap$$
+  trap "rm -f $tempbase.0 $tempbase.1" 1 2 13 15
+
+  > $tempbase.0 > $tempbase.1 &&
+  find . ! -type d -print | sort > $tempbase.0 || exit
+
+  if test $with_gettext = yes; then
+    # Released autopoint has the tendency to install macros that have been
+    # obsoleted in current gnulib, so run this before gnulib-tool.
+    echo "$0: $AUTOPOINT --force"
+    $AUTOPOINT --force || exit
+  fi
 
-# Autoreconf runs aclocal before libtoolize, which causes spurious
-# warnings if the initial aclocal is confused by the libtoolized
-# (or worse out-of-date) macro directory.
-# libtoolize 1.9b added the --install option; but we support back
-# to libtoolize 1.5.22, where the install action was default.
-if test $use_libtool = 1; then
-  install=
-  case $($LIBTOOLIZE --help) in
-    *--install*) install=--install ;;
-  esac
-  echo "running: $LIBTOOLIZE $install --copy"
-  $LIBTOOLIZE $install --copy
-fi
+  # Autoreconf runs aclocal before libtoolize, which causes spurious
+  # warnings if the initial aclocal is confused by the libtoolized
+  # (or worse out-of-date) macro directory.
+  # libtoolize 1.9b added the --install option; but we support back
+  # to libtoolize 1.5.22, where the install action was default.
+  if test $use_libtool = 1; then
+    install=
+    case $($LIBTOOLIZE --help) in
+      *--install*) install=--install ;;
+    esac
+    echo "running: $LIBTOOLIZE $install --copy"
+    $LIBTOOLIZE $install --copy
+  fi
 
-version_controlled_file() {
-  dir=$1
-  file=$2
-  found=no
-  if test -d CVS; then
-    grep -F "/$file/" $dir/CVS/Entries 2>/dev/null |
-             grep '^/[^/]*/[0-9]' > /dev/null && found=yes
-  elif test -d .git; then
-    git rm -n "$dir/$file" > /dev/null 2>&1 && found=yes
-  elif test -d .svn; then
-    svn log -r HEAD "$dir/$file" > /dev/null 2>&1 && found=yes
-  else
-    echo "$me: no version control for $dir/$file?" >&2
-  fi
-  test $found = yes
-}
+  set -x
+  find . ! -type d -print | sort >$tempbase.1
+  old_IFS=$IFS
+  IFS=$nl
+  for file in $(comm -13 $tempbase.0 $tempbase.1); do
+    IFS=$old_IFS
+    parent=${file%/*}
+    version_controlled_file "$parent" "$file" || {
+      for dot_ig in x $vc_ignore; do
+        test $dot_ig = x && continue
+        ig=$parent/$dot_ig
+        insert_vc_ignore "$ig" "${file##*/}"
+      done
+    }
+  done
+  IFS=$old_IFS
+  set +x
+
+  rm -f $tempbase.0 $tempbase.1
+  trap - 1 2 13 15
+fi
 
 # Import from gnulib.