gnulib: update

This commit is contained in:
Akim Demaille
2013-02-19 09:32:43 +01:00
parent 29248b4c13
commit 42fef01256
2 changed files with 23 additions and 23 deletions

View File

@@ -1,6 +1,6 @@
#! /bin/sh #! /bin/sh
# Print a version string. # Print a version string.
scriptversion=2012-12-28.10; # UTC scriptversion=2013-01-20.16; # UTC
# Bootstrap this package from checked-out sources. # Bootstrap this package from checked-out sources.
@@ -306,34 +306,34 @@ if test -n "$checkout_only_file" && test ! -r "$checkout_only_file"; then
die "Bootstrapping from a non-checked-out distribution is risky." die "Bootstrapping from a non-checked-out distribution is risky."
fi fi
# Ensure that lines starting with ! sort last, per gitignore conventions # Strip blank and comment lines to leave significant entries.
# for whitelisting exceptions after a more generic blacklist pattern. gitignore_entries() {
sort_patterns() { sed '/^#/d; /^$/d' "$@"
sort -u "$@" | sed '/^!/ {
H
d
}
$ {
P
x
s/^\n//
}' | sed '/^$/d'
} }
# If $STR is not already on a line by itself in $FILE, insert it, # If $STR is not already on a line by itself in $FILE, insert it at the start.
# sorting the new contents of the file and replacing $FILE with the result. # Entries are inserted at the start of the ignore list to ensure existing
insert_sorted_if_absent() { # entries starting with ! are not overridden. Such entries support
# whitelisting exceptions after a more generic blacklist pattern.
insert_if_absent() {
file=$1 file=$1
str=$2 str=$2
test -f $file || touch $file test -f $file || touch $file
echo "$str" | sort_patterns - $file | cmp -s - $file > /dev/null \ test -r $file || die "Error: failed to read ignore file: $file"
|| { echo "$str" | sort_patterns - $file > $file.bak \ duplicate_entries=$(gitignore_entries $file | sort | uniq -d)
&& mv $file.bak $file; } \ if [ "$duplicate_entries" ] ; then
|| die "insert_sorted_if_absent $file $str: failed" die "Error: Duplicate entries in $file: " $duplicate_entries
fi
linesold=$(gitignore_entries $file | wc -l)
linesnew=$(echo "$str" | gitignore_entries - $file | sort -u | wc -l)
if [ $linesold != $linesnew ] ; then
{ echo "$str" | cat - $file > $file.bak && mv $file.bak $file; } \
|| die "insert_if_absent $file $str: failed"
fi
} }
# Adjust $PATTERN for $VC_IGNORE_FILE and insert it with # Adjust $PATTERN for $VC_IGNORE_FILE and insert it with
# insert_sorted_if_absent. # insert_if_absent.
insert_vc_ignore() { insert_vc_ignore() {
vc_ignore_file="$1" vc_ignore_file="$1"
pattern="$2" pattern="$2"
@@ -344,7 +344,7 @@ insert_vc_ignore() {
# .gitignore entry. # .gitignore entry.
pattern=$(echo "$pattern" | sed s,^,/,);; pattern=$(echo "$pattern" | sed s,^,/,);;
esac esac
insert_sorted_if_absent "$vc_ignore_file" "$pattern" insert_if_absent "$vc_ignore_file" "$pattern"
} }
# Die if there is no AC_CONFIG_AUX_DIR($build_aux) line in configure.ac. # Die if there is no AC_CONFIG_AUX_DIR($build_aux) line in configure.ac.

2
gnulib

Submodule gnulib updated: c67e3c0414...38e8c084b9