From: Jim Meyering Date: Mon, 15 Jan 2007 10:31:51 +0000 (+0100) Subject: * bootstrap (gnulib_tool): When adding to .cvsignore and .gitignore, X-Git-Tag: COREUTILS-6_8~76 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d1ad73e0bf6a1b6c62e424c1f28cf344fca10600;p=thirdparty%2Fcoreutils.git * bootstrap (gnulib_tool): When adding to .cvsignore and .gitignore, emit foo.h, for each foo_.h. This yields one false-positive, fts.h, but that's ok, since fts_.h will eventually be renamed. --- diff --git a/ChangeLog b/ChangeLog index 3e23374de7..b82902a784 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2007-01-15 Jim Meyering + * bootstrap (gnulib_tool): When adding to .cvsignore and .gitignore, + emit foo.h, for each foo_.h. This yields one false-positive, fts.h, + but that's ok, since fts_.h will eventually be renamed. + * src/remove.c (remove_dir): Don't use errno in diagnostic. Root-only test failure reported by Alex van Hout and Jon Grosshart in . diff --git a/bootstrap b/bootstrap index a5065aaa46..28fb9ef15c 100755 --- a/bootstrap +++ b/bootstrap @@ -2,7 +2,7 @@ # Bootstrap this package from CVS. -# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# Copyright (C) 2003, 2004, 2005, 2006, 2007 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 @@ -350,6 +350,16 @@ version_controlled_file() { test $found = yes } +# If $STR is not already on a line by itself in $FILE, insert it, +# sorting the new contents of the file and replacing $FILE with the result. +insert_sorted_if_absent() { + file=$1 + str=$2 + echo "$str" | sort -u - $file | cmp -s - $file \ + || echo "$str" | sort -u - $file -o $file \ + || exit +} + slurp() { for dir in . `(cd $1 && find * -type d -print)`; do copied= @@ -392,8 +402,12 @@ slurp() { for dot_ig in .cvsignore .gitignore; do ig=$dir/$dot_ig if test -n "$copied" && test -f $ig; then - echo "$copied" | sort -u - $ig | cmp -s - $ig || - echo "$copied" | sort -u - $ig -o $ig || exit + insert_sorted_if_absent $ig "$copied" + # If an ignored file name ends with _.h, then also add + # the name with just ".h". Many gnulib headers are generated, + # e.g., stdint_.h -> stdint.h, dirent_.h ->..., etc. + f=`echo "$copied"|sed 's/_\.h$/.h/'` + insert_sorted_if_absent $ig "$f" fi done done