summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruen@suse.de>2003-02-16 20:16:58 +0000
committerAndreas Gruenbacher <agruen@suse.de>2003-02-16 20:16:58 +0000
commit867131b0791c4276cfdd273c20c3136ab63557f3 (patch)
tree1cc8c29e66126becc5457c48cd434d11424a4be6
parent114573d37141d67fbfe8dec85169142cbc14a1e1 (diff)
downloadquilt-867131b0791c4276cfdd273c20c3136ab63557f3.tar.gz
Merge version of James's temp file patch (some further improvements,
hopefully). Also, fix some messages that seem to have been reset to a previous version during I18N, and update the test script.
-rw-r--r--configure.ac30
-rw-r--r--po/de.po10
-rw-r--r--po/quilt.pot4
-rw-r--r--quilt/add.in2
-rw-r--r--quilt/diff.in4
-rw-r--r--quilt/import.in6
-rw-r--r--quilt/refresh.in6
-rw-r--r--quilt/remove.in2
-rw-r--r--quilt/setup.in2
-rw-r--r--scripts/patchfns.in54
-rw-r--r--test/one.test12
11 files changed, 93 insertions, 39 deletions
diff --git a/configure.ac b/configure.ac
index f4bbe4d..708f59e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,7 +2,7 @@ dnl Process this file with autoconf to produce a configure script.
AC_INIT([quilt],[0.22],[quilt-dev@nongnu.org])
AC_CONFIG_AUX_DIR(config)
AC_PREREQ(2.53)
-AC_REVISION ($Revision: 1.9 $)
+AC_REVISION ($Revision: 1.10 $)
PACKAGE_RELEASE=1
AC_SUBST(PACKAGE_RELEASE)
@@ -72,7 +72,8 @@ fi
dnl Checks for mktemp (for creating temporary files and directories)
AC_ARG_WITH(mktemp, AC_HELP_STRING(
- [--with-mktemp], [name of the mktemp executable to use]),
+ [--with-mktemp], [name of the mktemp executable to use (or 'none'
+ to use a quilt internal mechanism)]),
[
MKTEMP="$withval"
AC_SUBST(MKTEMP)
@@ -80,17 +81,22 @@ AC_ARG_WITH(mktemp, AC_HELP_STRING(
],[
AC_PATH_PROG(MKTEMP, mktemp)
])
-if test -z "$MKTEMP" ; then
- AC_MSG_ERROR([Please specify the location of mktemp with the option '--with-mktemp'])
-fi
-
-AC_MSG_CHECKING(whether $MKTEMP -d works)
-if tempdir=`$MKTEMP -d /tmp/$PACKAGE_NAME.XXXXXX 2>/dev/null` && \
- rmdir "$tempdir" ; then
- AC_MSG_RESULT(yes)
+if test -z "$MKTEMP" -o "$MKTEMP" = "none" ; then
+ MKTEMP=internal_mktemp
else
- AC_MSG_RESULT(no)
- AC_MSG_ERROR([$MKTEMP does not create temporary directories with -d])
+ AC_MSG_CHECKING(whether $MKTEMP -d works)
+ if tempdir=`$MKTEMP -d /tmp/$PACKAGE_NAME.XXXXXX 2>/dev/null` && \
+ rmdir "$tempdir" ; then
+ AC_MSG_RESULT(yes)
+ else
+ AC_MSG_RESULT(no)
+ AC_MSG_ERROR([
+'$MKTEMP -d' does not create temporary directories.
+If you don't have a version of mktemp that can create directories, you
+can specify '--with-mktemp=none' and $PACKAGE_NAME will use its own
+internal tempfile generation mechanism.
+])
+ fi
fi
# Check for diff
diff --git a/po/de.po b/po/de.po
index 92bd5e3..cbcf7d8 100644
--- a/po/de.po
+++ b/po/de.po
@@ -226,8 +226,8 @@ msgid "Diff failed, aborting."
msgstr "Diff fehlgeschlagen, Abbruch."
#: ../quilt/diff.in:305
-msgid "More recent patches modify the same files."
-msgstr "Später angewandte Patches verändern dieselben Dateien."
+msgid "More recent patches modify files in $last_patch."
+msgstr "Später angewandte Patches verändern Dateien von $last_patch."
#: ../quilt/files.in:22
msgid "Usage: quilt files [-v] [patch]"
@@ -634,10 +634,10 @@ msgstr ""
"p1 angeben"
#: ../quilt/refresh.in:150
-msgid "More recent patches modify the same files. Enforce refresh with -f."
+msgid "More recent patches modify files in $patch. Enforce refresh with -f."
msgstr ""
-"Später angewandte Patches verändern die selben Datei(en). Auffrischen "
-"erzwingen mit -f."
+"Später angewandte Patches verändern Dateien von $patch. Auffrischen "
+"mit -f erzwingen."
#: ../quilt/refresh.in:157
msgid "Nothing in patch $patch"
diff --git a/po/quilt.pot b/po/quilt.pot
index b96bc84..fef8c38 100644
--- a/po/quilt.pot
+++ b/po/quilt.pot
@@ -171,7 +171,7 @@ msgid "Diff failed, aborting."
msgstr ""
#: ../quilt/diff.in:305
-msgid "More recent patches modify the same files."
+msgid "More recent patches modify files in $last_patch."
msgstr ""
#: ../quilt/files.in:22
@@ -469,7 +469,7 @@ msgid ""
msgstr ""
#: ../quilt/refresh.in:150
-msgid "More recent patches modify the same files. Enforce refresh with -f."
+msgid "More recent patches modify files in $patch. Enforce refresh with -f."
msgstr ""
#: ../quilt/refresh.in:157
diff --git a/quilt/add.in b/quilt/add.in
index 647df15..b20af1c 100644
--- a/quilt/add.in
+++ b/quilt/add.in
@@ -115,7 +115,7 @@ do
# As the file may likely be modified by hand
# now, create a copy to make sure nothing
# happens to the original file.
- tmpfile=$(@MKTEMP@ $file.XXXXXX) &&
+ tmpfile=$(gen_tempfile $file) &&
cp -f $file $tmpfile &&
mv -f $tmpfile $file
rm -f $tmpfile
diff --git a/quilt/diff.in b/quilt/diff.in
index f237ce1..3a52dea 100644
--- a/quilt/diff.in
+++ b/quilt/diff.in
@@ -221,7 +221,7 @@ then
patch_file=$(patch_file_name $last_patch)
pc_file=$(pc_file_name $last_patch)
patch_args=$(patch_args $last_patch)
- workdir=$(@MKTEMP@ -d $PWD/patch-scripts.XXXXXX)
+ workdir=$(gen_tempfile -d $PWD/quilt)
pwd=$PWD
if ! cd .pc/$last_patch
@@ -302,7 +302,7 @@ done
if [ -n "$files_were_shadowed" ]
then
- echo $"More recent patches modify the same files."
+ echo $"More recent patches modify files in $last_patch."
die 1
fi
die 0
diff --git a/quilt/import.in b/quilt/import.in
index f5acfd9..7724f4f 100644
--- a/quilt/import.in
+++ b/quilt/import.in
@@ -115,7 +115,7 @@ fi
case "$input_file" in
'')
- tmpfile=$(@MKTEMP@ /tmp/patch-scripts.XXXXXX)
+ tmpfile=$(gen_tempfile)
if ! cat > $tmpfile
then
echo $"Cannot read from standard input."
@@ -124,7 +124,7 @@ case "$input_file" in
fi
input_file=$tmpfile ;;
*.gz)
- tmpfile=$(@MKTEMP@ /tmp/patch-scripts.XXXXXX)
+ tmpfile=$(gen_tempfile)
if ! gzip -cd "$input_file" > $tmpfile
then
echo $"Cannot decompress file $input_file"
@@ -133,7 +133,7 @@ case "$input_file" in
fi
input_file=$tmpfile ;;
*.bz2)
- tmpfile=$(@MKTEMP@ /tmp/patch-scripts.XXXXXX)
+ tmpfile=$(gen_tempfile)
if ! bzip2 -cd "$input_file" > $tmpfile
then
echo $"Cannot decompress file $input_file"
diff --git a/quilt/refresh.in b/quilt/refresh.in
index 315238b..89b15e0 100644
--- a/quilt/refresh.in
+++ b/quilt/refresh.in
@@ -126,7 +126,7 @@ fi
trap "die 1" SIGTERM
-tmpfile=$(@MKTEMP@ /tmp/patch-scripts.XXXXXX)
+tmpfile=$(gen_tempfile)
for file in $(files_in_patch $patch)
do
@@ -147,7 +147,7 @@ do
if [ -n "$files_were_shadowed" -a -z "$opt_force" ]
then
- echo $"More recent patches modify the same files. Enforce refresh with -f." >&2
+ echo $"More recent patches modify files in $patch. Enforce refresh with -f." >&2
die 1
fi
done
@@ -172,7 +172,7 @@ then
cat $tmpfile \
| @SCRIPTS@/parse-patch -u patch $patch_file
else
- if ! tmpfile2=$(@MKTEMP@ /tmp/patch-scripts.XXXXXX)
+ if ! tmpfile2=$(gen_tempfile)
then
die 1
fi
diff --git a/quilt/remove.in b/quilt/remove.in
index cf7e412..4c0dbaa 100644
--- a/quilt/remove.in
+++ b/quilt/remove.in
@@ -109,7 +109,7 @@ do
fi
pc_file=$(pc_file_name $patch)
- tmpfile=$(@MKTEMP@ /tmp/patch-scripts.XXXXXX)
+ tmpfile=$(gen_tempfile)
grep -v -E '^'"$(quote_re $file)"'$' $pc_file > $tmpfile
mv -f $tmpfile $pc_file
rm -f $tmpfile
diff --git a/quilt/setup.in b/quilt/setup.in
index 1f90946..773ab9d 100644
--- a/quilt/setup.in
+++ b/quilt/setup.in
@@ -86,7 +86,7 @@ fi
case "$1" in
*.spec)
spec_file="$1"
- tmpfile=$(@MKTEMP@ /tmp/patch-scripts.XXXXXX)
+ tmpfile=$(gen_tempfile)
series_file=$tmpfile
if ! @SCRIPTS@/spec2series "$spec_file" > $tmpfile
then
diff --git a/scripts/patchfns.in b/scripts/patchfns.in
index 28f58de..a605b19 100644
--- a/scripts/patchfns.in
+++ b/scripts/patchfns.in
@@ -119,7 +119,7 @@ change_db_strip_level()
if [ -e $SERIES ]
then
- local tmpfile=$(@MKTEMP@ /tmp/patch-scripts.XXXXXX)
+ local tmpfile=$(gen_tempfile)
awk '
/^'"$(quote_re $patch)"'(\.patch|\.diff?)(|\.gz|\.bz2)([ \t]|$)/ \
{ for(i=2; i<=NF; i++)
@@ -166,7 +166,7 @@ insert_in_series()
patch_args=" $patch_args"
fi
- tmpfile=$(@MKTEMP@ /tmp/patch-scripts.XXXXXX) || return 1
+ tmpfile=$(gen_tempfile) || return 1
mkdir -p $(dirname $SERIES)
if [ -n "$top" ]
then
@@ -195,7 +195,7 @@ remove_from_series()
{
local patch=$1
- tmpfile=$(@MKTEMP@ /tmp/patch-scripts.XXXXXX) || return 1
+ tmpfile=$(gen_tempfile) || return 1
awk '
! /^'"$(quote_re $patch)"'(|\.patch|\.diff?)(|\.gz|\.bz2)([ \t]|$)/ \
{ print }
@@ -429,7 +429,7 @@ remove_from_db()
{
local patch=$1
local tmpfile
- if tmpfile=$(@MKTEMP@ /tmp/patch-scripts.XXXXXX)
+ if tmpfile=$(gen_tempfile)
then
grep -v -E "^$(quote_re $patch)\$" $DB > $tmpfile
mv -f $tmpfile $DB
@@ -497,7 +497,7 @@ refresh_file_list()
then
local tmpfile status
if ! mkdir -p $(dirname $pc_file) || \
- ! tmpfile=$(@MKTEMP@ /tmp/patch-scripts.XXXXXX)
+ ! tmpfile=$(gen_tempfile)
then
return 1
fi
@@ -620,6 +620,50 @@ in_array()
done
return 1
}
+
+gen_tempfile()
+{
+ # This is a substitute for the mktemp executable.
+ internal_mktemp()
+ {
+ local try n
+ if [ x"$1" = x"-d" ]
+ then
+ for ((n=0 ; $n<100 ; n++))
+ do
+ try=${2%XXXXXX}$RANDOM
+ mkdir -m 700 $try 2>/dev/null \
+ && break
+ done
+ else
+ local user_mask=$(umask)
+ umask 077
+ set -o noclobber
+ for ((n=0 ; $n<100 ; n++))
+ do
+ try=${1%XXXXXX}$RANDOM
+ echo -n "" 2> /dev/null > $try \
+ && break
+ done
+ set +o noclobber
+ umask $user_mask
+ fi
+ if [ $n -lt 100 ]
+ then
+ echo $try
+ else
+ return 1
+ fi
+ }
+
+ local dir
+ if [ x"$1" = x"-d" ]
+ then
+ dir=-d
+ shift
+ fi
+ @MKTEMP@ $dir ${1:-${TMPDIR:-/tmp}/quilt}.XXXXXX
+}
### Local Variables:
### mode: shell-script
### End:
diff --git a/test/one.test b/test/one.test
index 5f7d2b4..15cf951 100644
--- a/test/one.test
+++ b/test/one.test
@@ -56,9 +56,10 @@ Refreshed patch patch2
$ quilt add -p patch1 dir/file3
File dir/file3 modified by patch patch2
$ quilt pop
+Removing patch2
Removing dir/file3
-Removed patch2, now at patch1
+Now at patch patch1
$ quilt add file4
File file4 added to patch patch1
$ echo "This is file 4." > file4
@@ -68,6 +69,7 @@ $ quilt push
Applying patch2
patching file dir/file3
+Now at patch patch2
$ quilt new subdir/patch3.diff
Patch subdir/patch3 is now on top
$ quilt add file4
@@ -101,12 +103,14 @@ $ quilt refresh -f patch1
Refreshed patch patch1
$ echo "Another line here, too." >> dir/file3
$ quilt pop
+Removing subdir/patch3
patching file file4
-Removed subdir/patch3, now at patch2
+Now at patch patch2
$ quilt refresh patch2
Refreshed patch patch2
$ quilt pop -qa
-Removed patch2, now at patch1
-Removed patch1, no patches applied
+Removing patch2
+Removing patch1
+No patches applied
$ rm -r dir patches