summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile.in30
-rw-r--r--bin/quilt.in4
-rw-r--r--quilt.changes6
-rw-r--r--quilt.spec.in1
-rw-r--r--quilt/add.in2
-rw-r--r--quilt/pop.in6
-rw-r--r--quilt/push.in2
-rw-r--r--quilt/remove.in2
-rw-r--r--quilt/scripts/backup-files.in289
-rw-r--r--quilt/scripts/patchfns.in2
-rw-r--r--quilt/snapshot.in2
-rw-r--r--test/backup-files.test46
12 files changed, 334 insertions, 58 deletions
diff --git a/Makefile.in b/Makefile.in
index d2155df..02f8a0f 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -7,7 +7,6 @@ PACKAGE_BUGREPORT := @PACKAGE_BUGREPORT@
prefix := @prefix@
exec_prefix := @exec_prefix@
bindir := @bindir@
-libdir := @libdir@
datarootdir := @datarootdir@
datadir := @datadir@
docdir := @docdir@
@@ -53,11 +52,6 @@ LDFLAGS += @LDFLAGS@
LIBS := @LIBS@
EXEEXT := @EXEEXT@
-LIBOBJS := $(filter $(patsubst lib/%.c,lib/%.o,$(wildcard lib/*.c)), $(patsubst %,lib/%,@LIBOBJS@))
-ifneq ($(LIBOBJS),)
-CFLAGS += -Ilib
-endif
-
COMPAT_SYMLINKS := @COMPAT_SYMLINKS@
COMPAT_PROGRAMS := @COMPAT_PROGRAMS@
@@ -85,7 +79,7 @@ SRC += $(QUILT_SRC:%=quilt/%)
DIRT += $(QUILT_IN:%=quilt/%)
SCRIPTS_IN := patchfns inspect dependency-graph edmail \
- remove-trailing-ws
+ remove-trailing-ws backup-files
SCRIPTS_SRC := $(SCRIPTS_IN:%=%.in)
SCRIPTS := $(SCRIPTS_IN)
@@ -96,10 +90,8 @@ COMPAT := $(COMPAT_PROGRAMS:%=compat/%) $(COMPAT_SYMLINKS:%=compat/%)
SRC += $(wildcard compat/*.in) $(wildcard compat/*.sh)
DIRT += $(patsubst %.in,%,$(wildcard compat/*.in)) $(COMPAT_SYMLINKS:%=compat/%)
-LIB_SRC := backup-files.c quilt.el
-LIB := backup-files$(EXEEXT)
+LIB_SRC := quilt.el
SRC += $(LIB_SRC:%=lib/%)
-DIRT += lib/backup-files$(EXEEXT) $(LIB_SRC:%.c=lib/%.o)
DOC_IN := README quilt.1
DOC_SRC := $(DOC_IN:%=doc/%.in)
@@ -133,16 +125,13 @@ DIRT += test/.depend $(wildcard test/.*.ok)
# Settings for running the uninstalled version of quilt in the source tree:
PATH := $(CURDIR)/bin:$(CURDIR)/compat:$(PATH)
QUILT_DIR := $(CURDIR)/quilt
-QUILT_LIB := $(CURDIR)/lib
QUILTRC := $(CURDIR)/test/test.quiltrc
-export QUILT_DIR QUILT_LIB QUILTRC
+export QUILT_DIR QUILTRC
#-----------------------------------------------------------------------
all : configure scripts compat $(DOC:%=doc/%) $(MAN1) mofiles
-$(LIB:%=lib/%) :: $(LIBOBJS)
-
ifeq ($(USE_NLS),yes)
mofiles : $(LINGUAS:%=po/%.mo)
else
@@ -156,7 +145,7 @@ endif
$(MSGMERGE) -o $@ $@ $^
scripts : $(BIN:%=bin/%) $(QUILT:%=quilt/%) \
- $(SCRIPTS:%=quilt/scripts/%) $(LIB:%=lib/%) \
+ $(SCRIPTS:%=quilt/scripts/%) \
$(if $(PATCH_WRAPPER),bin/patch-wrapper)
dist : clean $(PACKAGE)-$(VERSION).tar.gz
@@ -264,8 +253,7 @@ $(PACKAGE).spec : $(PACKAGE).spec.in $(PACKAGE).changes Makefile
$(patsubst %.in,%,$(wildcard bin/*.in quilt/*.in quilt/scripts/*.in)) :: Makefile
% :: %.in
@echo "$< -> $@" >&2
- @$(SED) -e 's:@QUILT_LIB''@:$(libdir)/$(PACKAGE):g' \
- -e 's:@QUILT_DIR''@:$(datadir)/$(PACKAGE):g' \
+ @$(SED) -e 's:@QUILT_DIR''@:$(datadir)/$(PACKAGE):g' \
-e 's:@PERL''@:$(PERL):g' \
-e 's:@BASH''@:$(BASH):g' \
-e 's:@PATCH''@:$(PATCH):g' \
@@ -277,8 +265,6 @@ $(patsubst %.in,%,$(wildcard bin/*.in quilt/*.in quilt/scripts/*.in)) :: Makefil
$< > $@
@$(if $(filter $@,$(NON_EXEC_IN)),,chmod +x $@)
-lib/backup-files.o :: Makefile
-
configure : configure.ac aclocal.m4
autoconf
@echo "Please run ./configure"
@@ -329,9 +315,6 @@ ifneq ($(PATCH_WRAPPER),)
$(BUILD_ROOT)$(datadir)/$(PACKAGE)/wrapper/patch
endif
- $(INSTALL) -d $(BUILD_ROOT)$(libdir)/$(PACKAGE)
- $(INSTALL) -m 755 $(LIB:%=lib/%) $(BUILD_ROOT)$(libdir)/$(PACKAGE)/
-
$(INSTALL) -d $(BUILD_ROOT)$(docdir)/
$(INSTALL) -m 644 doc/README \
$(BUILD_ROOT)$(docdir)/
@@ -368,7 +351,6 @@ install: install-main install-compat
uninstall ::
rm -rf $(BIN:%=$(BUILD_ROOT)$(bindir)/%) \
- $(BUILD_ROOT)$(libdir)/$(PACKAGE) \
$(BUILD_ROOT)$(datadir)/$(PACKAGE) \
$(patsubst %,$(BUILD_ROOT)$(mandir)/man1/%, \
$(notdir $(MAN1))) \
@@ -392,7 +374,7 @@ test/.patch-wrapper.ok : bin/patch-wrapper
# Include a run-time generated list of dependencies for each test case
test/.depend : Makefile $(TESTS)
- @( printf "%s : bin/quilt quilt/scripts/patchfns $(LIB:%=lib/%) $(COMPAT)\n" $(TESTS); \
+ @( printf "%s : bin/quilt quilt/scripts/patchfns quilt/scripts/backup-files $(COMPAT)\n" $(TESTS); \
$(AWK) 'sub(/.*\$$ *quilt /, "") \
{ print FILENAME, ":", "quilt/"$$1}' $(TESTS); \
$(AWK) 'sub(/.*\<quilt_command /, "") && ($$1 !~ /[^a-z]/) \
diff --git a/bin/quilt.in b/bin/quilt.in
index 61114ad..30df4dc 100644
--- a/bin/quilt.in
+++ b/bin/quilt.in
@@ -9,8 +9,8 @@
export TEXTDOMAIN=quilt
export TEXTDOMAINDIR=@LOCALEDIR@
-: ${QUILT_DIR=@QUILT_DIR@} ${QUILT_LIB=@QUILT_LIB@}
-export QUILT_DIR QUILT_LIB
+: ${QUILT_DIR=@QUILT_DIR@}
+export QUILT_DIR
if [ -z "$QUILTRC" ]
then
diff --git a/quilt.changes b/quilt.changes
index 55274fe..4cc73cc 100644
--- a/quilt.changes
+++ b/quilt.changes
@@ -1,4 +1,10 @@
-------------------------------------------------------------------
+Wed Feb 1 16:58:22 CET 2012 - mquinson@debian.org
+
+- Make backup-files a shell script. This makes it possible to
+ package quilt as an architecture-indepdendent package.
+
+-------------------------------------------------------------------
Wed Feb 1 16:55:57 CET 2012 - jdelvare@suse.de
- Add a dedicated test case for backup-files.
diff --git a/quilt.spec.in b/quilt.spec.in
index 9df8ecb..e00d41a 100644
--- a/quilt.spec.in
+++ b/quilt.spec.in
@@ -47,7 +47,6 @@ rm -rf $RPM_BUILD_ROOT
/usr/bin/quilt
/usr/share/quilt/
/usr/share/emacs/
-/usr/lib/quilt/
/etc/bash_completion.d/quilt
%config(noreplace) /etc/quilt.quiltrc
%doc %{_mandir}/man1/guards.1*
diff --git a/quilt/add.in b/quilt/add.in
index dfd48f8..eee3c45 100644
--- a/quilt/add.in
+++ b/quilt/add.in
@@ -121,7 +121,7 @@ do
continue
fi
- if ! $QUILT_LIB/backup-files -b -s -L -B $QUILT_PC/$patch/ "$SUBDIR$file"
+ if ! $QUILT_DIR/scripts/backup-files -b -s -L -B $QUILT_PC/$patch/ "$SUBDIR$file"
then
printf $"Failed to back up file %s\n" "$SUBDIR$file" >&2
status=1
diff --git a/quilt/pop.in b/quilt/pop.in
index cbc21c1..efacf09 100644
--- a/quilt/pop.in
+++ b/quilt/pop.in
@@ -95,7 +95,7 @@ check_for_pending_changes()
local prefix=$QUILT_PC/$patch/
[ ${prefix:0:1} == / ] || prefix=$PWD/$prefix
if ! ( cd $workdir && \
- $QUILT_LIB/backup-files -B $prefix -rks - )
+ $QUILT_DIR/scripts/backup-files -B $prefix -r -k -s - )
then
printf $"Failed to copy files to temporary directory\n" >&2
rm -rf $workdir
@@ -162,7 +162,7 @@ remove_patch()
status=$?
else
printf $"Removing patch %s\n" "$(print_patch $patch)"
- $QUILT_LIB/backup-files $silent -r -t -B $QUILT_PC/$patch/ -
+ $QUILT_DIR/scripts/backup-files $silent -r -t -B $QUILT_PC/$patch/ -
status=$?
fi
remove_from_db $patch
@@ -264,7 +264,7 @@ else
# of one: This will automatically be the case in the usual
# situations, but we don't want to risk file corruption in weird
# corner cases such as files added to a patch but not modified.
- $QUILT_LIB/backup-files -L -s -B $QUILT_PC/$patch/ -
+ $QUILT_DIR/scripts/backup-files -L -s -B $QUILT_PC/$patch/ -
printf $"Now at patch %s\n" "$(print_patch $patch)"
fi
### Local Variables:
diff --git a/quilt/push.in b/quilt/push.in
index 17862fa..db84a47 100644
--- a/quilt/push.in
+++ b/quilt/push.in
@@ -140,7 +140,7 @@ rollback_patch()
{
local patch=$1
- $QUILT_LIB/backup-files $silent_unless_verbose -r -B $QUILT_PC/$patch/ -
+ $QUILT_DIR/scripts/backup-files $silent_unless_verbose -r -B $QUILT_PC/$patch/ -
}
cleanup_patch_output() {
diff --git a/quilt/remove.in b/quilt/remove.in
index 96a4e86..ff9aae5 100644
--- a/quilt/remove.in
+++ b/quilt/remove.in
@@ -86,7 +86,7 @@ do
fi
# Restore file from backup
- if ! $QUILT_LIB/backup-files -r -t -s -B $QUILT_PC/$patch/ "$SUBDIR$file"
+ if ! $QUILT_DIR/scripts/backup-files -r -t -s -B $QUILT_PC/$patch/ "$SUBDIR$file"
then
printf $"Failed to remove file %s from patch %s\n" \
"$SUBDIR$file" "$(print_patch $patch)" >&2
diff --git a/quilt/scripts/backup-files.in b/quilt/scripts/backup-files.in
new file mode 100644
index 0000000..f691ed4
--- /dev/null
+++ b/quilt/scripts/backup-files.in
@@ -0,0 +1,289 @@
+#! @BASH@
+
+set -e
+
+# File: backup-files.sh
+
+# Copyright (C) 2006 Steve Langasek <vorlon@debian.org>
+# portions Copyright (C) 2003, 2004, 2005, 2006 Andreas Gruenbacher
+# <agruen@suse.de>, SuSE Labs
+
+# 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; version 2 dated June, 1991.
+
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+
+
+# Create backup files of a list of files similar to GNU patch. A path
+# name prefix and suffix for the backup file can be specified with the
+# -B and -z options.
+
+usage () {
+ local progname="$1"
+ echo "Usage: $progname [-B prefix] [-z suffix] [-f {file|-}] [-s] [-k] [-t] [-L] [-b|-r|-x] {file|-} ...
+
+ Create hard linked backup copies of a list of files
+ read from standard input.
+
+ -b Create backup
+ -r Restore the backup
+ -x Remove backup files and empty parent directories
+ -k When doing a restore, keep the backup files
+ -B Path name prefix for backup files
+ -z Path name suffix for backup files
+ -s Silent operation; only print error messages
+ -f Read the filenames to process from file (- = standard input)
+ -t Touch original files after restore (update their mtimes)
+
+ -L Ensure that when finished, the source file has a link count of 1
+"
+}
+
+copy_file() {
+ local from="$1"
+ local to="$2"
+ cp -dp --remove-destination "$from" "$to"
+}
+
+link_or_copy_file() {
+ local from="$1"
+ local to="$2"
+ if ! ln "$from" "$to" 2>/dev/null ; then
+ copy_file "$from" "$to"
+ fi
+}
+
+ensure_nolinks() {
+ local filename="$1"
+ local link_count dirname basename tmpname
+
+ link_count=$(stat -c '%h' "$filename")
+ if [ -z "$link_count" ] || [ "$link_count" -gt 1 ]; then
+ dirname=$(dirname "$filename")
+ basename=$(basename "$filename")
+ # Temp file name is "path/to/.file.XXXXXX"
+ tmpname=$(mktemp "${dirname}/.${basename}.XXXXXX")
+ cp -dp "$filename" "$tmpname"
+ mv "$tmpname" "$filename"
+ fi
+}
+
+process_file() {
+ local file="$1"
+ local backup="${OPT_PREFIX}${file}${OPT_SUFFIX}"
+
+ if [ "$OPT_WHAT" == "backup" ]; then
+ if [ -e "$backup" ]; then
+ rm "$backup"
+ else
+ mkdir -p "$(dirname "$backup")"
+ fi
+ if [ ! -e "$file" ]; then
+ $ECHO "New file $file"
+ touch "$backup"
+ else
+ $ECHO "Copying $file"
+ if [ -n "$OPT_NOLINKS" -a "$(stat -c '%h' "$file")" = "1" ]; then
+ copy_file "$file" "$backup"
+ else
+ link_or_copy_file "$file" "$backup"
+ if [ -n "$OPT_NOLINKS" ]; then
+ ensure_nolinks "$file"
+ fi
+ fi
+ if [ -n "$OPT_TOUCH" ]; then
+ touch "$backup"
+ fi
+ fi
+ elif [ "$OPT_WHAT" == "restore" ]; then
+ mkdir -p "$(dirname "$file")"
+
+ if [ ! -e "$backup" ]; then
+ return 1
+ fi
+ if [ ! -s "$backup" ]; then
+ if [ -e "$file" ]; then
+ rm "$file"
+ fi
+ $ECHO "Removing $file"
+ if [ -z "$OPT_KEEP_BACKUP" ]; then
+ rm "$backup"
+ while [ -d "${backup%/*}" ] && ! [ -L "${backup%/*}" ]
+ do
+ backup="${backup%/*}"
+ rmdir --ignore-fail-on-non-empty "$backup" 2>/dev/null
+ if [ -d "$backup" ]; then
+ break
+ fi
+ done
+ fi
+ else
+ $ECHO "Restoring $file"
+ if [ -e "$file" ]; then
+ rm "$file"
+ fi
+ if [ -n "$OPT_NOLINKS" -a "$(stat -c '%h' "$backup")" != "1" ]; then
+ copy_file "$backup" "$file"
+ else
+ link_or_copy_file "$backup" "$file"
+ if [ -n "$OPT_NOLINKS" ]; then
+ ensure_nolinks "$file"
+ fi
+ fi
+
+ if [ -z "$OPT_KEEP_BACKUP" ]; then
+ rm "$backup"
+ while [ -d "${backup%/*}" ] && ! [ -L "${backup%/*}" ]
+ do
+ backup="${backup%/*}"
+ rmdir --ignore-fail-on-non-empty "$backup" 2>/dev/null
+ if [ -d "$backup" ]; then
+ break
+ fi
+ done
+ fi
+ if [ -n "$OPT_TOUCH" ]; then
+ touch "$file"
+ fi
+ fi
+ elif [ "$OPT_WHAT" == "remove" ]; then
+ if [ -e "$backup" ]; then
+ rm "$backup"
+ fi
+ while [ -d "${backup%/*}" ] && ! [ -L "${backup%/*}" ]
+ do
+ backup="${backup%/*}"
+ rmdir --ignore-fail-on-non-empty "$backup" 2>/dev/null
+ if [ -d "$backup" ]; then
+ break
+ fi
+ done
+ elif [ -z "$OPT_WHAT" ]; then
+ if [ -e "$file" ] && [ -n "$OPT_NOLINKS" ]; then
+ ensure_nolinks "$file"
+ fi
+ else
+ return 1
+ fi
+}
+
+walk() {
+ local path="$1"
+ if [ ! -f "$path" ]; then
+ return 0
+ fi
+
+ if [ "${path#$OPT_PREFIX}" == "$path" ]
+ then
+ # prefix does not match
+ return 0
+ fi
+ path="${path#$OPT_PREFIX}"
+
+ if [ -n "$OPT_SUFFIX" ] && [ "${path%$OPT_SUFFIX}" == "$path" ]
+ then
+ # suffix does not match
+ return 0
+ fi
+ path="${path%$OPT_SUFFIX}"
+
+ process_file "$path"
+}
+
+
+ECHO=echo
+declare -a FILELIST
+progname="$0"
+while [ $# -gt 0 ]; do
+ case $1 in
+ -b) OPT_WHAT=backup
+ ;;
+ -r) OPT_WHAT=restore
+ ;;
+ -x) OPT_WHAT=remove
+ ;;
+ -B) OPT_PREFIX=$2
+ shift
+ ;;
+ -f) OPT_FILE=$2
+ shift
+ ;;
+ -z) OPT_SUFFIX=$2
+ shift
+ ;;
+ -s) ECHO=:
+ ;;
+ -k) OPT_KEEP_BACKUP=1
+ ;;
+ -L) OPT_NOLINKS=1
+ ;;
+ -t) OPT_TOUCH=1
+ ;;
+ -?*) usage "$progname"
+ exit 0
+ ;;
+ *) FILELIST=("$@")
+ break
+ ;;
+ esac
+
+ shift
+done
+
+if [ -z "${OPT_PREFIX}${OPT_SUFFIX}" ]; then
+ usage "$progname"
+ exit 1
+fi
+if [ ${#FILELIST[@]} == 0 ] && [ -z "$OPT_FILE" ]; then
+ usage "$progname"
+ exit 1
+fi
+
+if [ -n "$OPT_FILE" ]; then
+ cat "$OPT_FILE" \
+ | while read nextfile; do
+ process_file "$nextfile"
+ done
+fi
+
+I=0
+while [ $I -lt ${#FILELIST[@]} ]; do
+
+ case "${FILELIST[$I]}" in
+ -)
+ path="${OPT_PREFIX%/*}"
+
+ find "$path" -mindepth 1 \( -type f -o -type d \) -print 2>/dev/null \
+ | while read
+ do
+ if [ -d "$REPLY" ]
+ then
+ if ! [ -r "$REPLY" ] || ! [ -x "$REPLY" ]
+ then
+ echo "$REPLY: Permission denied"
+ exit 1
+ fi
+ else
+ walk "$REPLY"
+ fi
+ done
+ if [ $? != 0 ]; then
+ exit 1
+ fi
+ ;;
+ *)
+ process_file "${FILELIST[$I]}"
+ ;;
+ esac
+
+ I=$(($I+1))
+done
diff --git a/quilt/scripts/patchfns.in b/quilt/scripts/patchfns.in
index 15b6b5c..6b788fd 100644
--- a/quilt/scripts/patchfns.in
+++ b/quilt/scripts/patchfns.in
@@ -925,7 +925,7 @@ apply_patch_temporarily()
local prefix=$QUILT_PC/$patch/
[ ${prefix:0:1} == / ] || prefix=$PWD/$prefix
if ! ( cd $workdir && \
- $QUILT_LIB/backup-files -B $prefix -rks ${@:--} )
+ $QUILT_DIR/scripts/backup-files -B $prefix -r -k -s ${@:--} )
then
printf $"Failed to copy files to temporary directory\n" >&2
return 1
diff --git a/quilt/snapshot.in b/quilt/snapshot.in
index 312003f..0554fa6 100644
--- a/quilt/snapshot.in
+++ b/quilt/snapshot.in
@@ -86,7 +86,7 @@ done \
}
{ print }
' \
-| $QUILT_LIB/backup-files -b -s -L -f - -B "$QUILT_PC/$snap_subdir/"
+| $QUILT_DIR/scripts/backup-files -b -s -L -f - -B "$QUILT_PC/$snap_subdir/"
### Local Variables:
### mode: shell-script
diff --git a/test/backup-files.test b/test/backup-files.test
index 0b4f571..b57374e 100644
--- a/test/backup-files.test
+++ b/test/backup-files.test
@@ -4,7 +4,7 @@ Unit test of the backup-files script.
$ echo foo > foo
$ echo bar > "space bar"
$ sleep 1
- $ %{QUILT_LIB}/backup-files -B backup/ -b foo
+ $ %{QUILT_DIR}/scripts/backup-files -B backup/ -b foo
> Copying foo
$ ls -l foo | awk '{ print $2 }'
@@ -14,12 +14,12 @@ Unit test of the backup-files script.
$ [ backup/foo -nt foo ] && echo "mtimes differ"
# Test remove
- $ %{QUILT_LIB}/backup-files -B backup/ -x foo
+ $ %{QUILT_DIR}/scripts/backup-files -B backup/ -x foo
$ ls -l foo | awk '{ print $2 }'
> 1
# Test silent backup with -L; it should copy, not link
- $ %{QUILT_LIB}/backup-files -B backup/ -b -s -L foo
+ $ %{QUILT_DIR}/scripts/backup-files -B backup/ -b -s -L foo
$ ls -l foo | awk '{ print $2 }'
> 1
@@ -30,7 +30,7 @@ Unit test of the backup-files script.
# Test restore without options
$ echo modified > foo
$ sleep 1
- $ %{QUILT_LIB}/backup-files -B backup/ -r foo
+ $ %{QUILT_DIR}/scripts/backup-files -B backup/ -r foo
> Restoring foo
$ cat foo
@@ -40,13 +40,13 @@ Unit test of the backup-files script.
# Test backup files with hard links
$ ln foo foo2
- $ %{QUILT_LIB}/backup-files -B backup/ -b -s -L foo
+ $ %{QUILT_DIR}/scripts/backup-files -B backup/ -b -s -L foo
$ ls -l foo | awk '{ print $2 }'
> 1
$ ls -l backup/foo | awk '{ print $2 }'
> 2
- $ %{QUILT_LIB}/backup-files -B backup/ -b -s -L foo2
+ $ %{QUILT_DIR}/scripts/backup-files -B backup/ -b -s -L foo2
$ ls -l foo | awk '{ print $2 }'
> 1
$ ls -l foo2 | awk '{ print $2 }'
@@ -58,7 +58,7 @@ Unit test of the backup-files script.
# Test restore of files with hard links
$ rm -f foo foo2
- $ %{QUILT_LIB}/backup-files -B backup/ -r -s foo
+ $ %{QUILT_DIR}/scripts/backup-files -B backup/ -r -s foo
$ ls -l foo | awk '{ print $2 }'
> 2
$ ls -l backup/foo2 | awk '{ print $2 }'
@@ -66,7 +66,7 @@ Unit test of the backup-files script.
$ [ -e backup/foo ] && echo "backup/foo not deleted"
$ [ ! -e foo2 ] || echo "file foo2 shouldn't exist"
- $ %{QUILT_LIB}/backup-files -B backup/ -r -s foo2
+ $ %{QUILT_DIR}/scripts/backup-files -B backup/ -r -s foo2
$ ls -l foo | awk '{ print $2 }'
> 2
$ ls -l foo2 | awk '{ print $2 }'
@@ -75,16 +75,16 @@ Unit test of the backup-files script.
$ [ -e backup ] && echo "backup directory not deleted"
# Test restore with -t
- $ %{QUILT_LIB}/backup-files -B backup/ -b -s foo
+ $ %{QUILT_DIR}/scripts/backup-files -B backup/ -b -s foo
$ touch -r foo foo.timeref
- $ %{QUILT_LIB}/backup-files -B backup/ -r -s -t foo
+ $ %{QUILT_DIR}/scripts/backup-files -B backup/ -r -s -t foo
$ ls -l foo | awk '{ print $2 }'
> 2
$ [ foo -nt foo.timeref ] || echo "touch failed"
# Test restore with -k
- $ %{QUILT_LIB}/backup-files -B backup/ -b -s -L foo "space bar"
+ $ %{QUILT_DIR}/scripts/backup-files -B backup/ -b -s -L foo "space bar"
$ touch -r "space bar" bar.timeref
$ ls -l backup/foo | awk '{ print $2 }'
> 2
@@ -92,7 +92,7 @@ Unit test of the backup-files script.
> 1
$ mkdir tmp
$ cd tmp
- $ %{QUILT_LIB}/backup-files -B ../backup/ -r -s -k foo "space bar"
+ $ %{QUILT_DIR}/scripts/backup-files -B ../backup/ -r -s -k foo "space bar"
$ cd ..
$ ls -l foo | awk '{ print $2 }'
@@ -111,7 +111,7 @@ Unit test of the backup-files script.
# Test restore all (-)
$ rm -f foo "space bar"
- $ %{QUILT_LIB}/backup-files -B backup/ -r -s -t -
+ $ %{QUILT_DIR}/scripts/backup-files -B backup/ -r -s -t -
$ cat foo
> foo
$ cat "space bar"
@@ -120,14 +120,14 @@ Unit test of the backup-files script.
# Backup and restore a non-existing files
$ mkdir "dir with spaces"
- $ %{QUILT_LIB}/backup-files -B backup/ -b -s -L new "dir with spaces/space file"
+ $ %{QUILT_DIR}/scripts/backup-files -B backup/ -b -s -L new "dir with spaces/space file"
$ echo data > new
$ echo data2 > "dir with spaces/space file"
$ ls -l backup/new | awk '{ print $5 }'
> 0
$ ls -l "backup/dir with spaces/space file" | awk '{ print $5 }'
> 0
- $ %{QUILT_LIB}/backup-files -B backup/ -r -s -
+ $ %{QUILT_DIR}/scripts/backup-files -B backup/ -r -s -
$ [ ! -e backup/new ] || echo "file backup/new shouldn't exist"
$ [ ! -e new ] || echo "file new shouldn't exist"
$ [ ! -e "backup/dir with spaces/space file" ] || echo "file backup/dir with spaces/space file shouldn't exist"
@@ -135,17 +135,17 @@ Unit test of the backup-files script.
# Test restore involving a dir name with spaces
$ echo data > "dir with spaces/space file"
- $ %{QUILT_LIB}/backup-files -B backup/ -b -L "dir with spaces/space file"
+ $ %{QUILT_DIR}/scripts/backup-files -B backup/ -b -L "dir with spaces/space file"
> Copying dir with spaces/space file
$ rm -rf "dir with spaces"
- $ %{QUILT_LIB}/backup-files -B backup/ -r -
+ $ %{QUILT_DIR}/scripts/backup-files -B backup/ -r -
> Restoring dir with spaces/space file
$ cat "dir with spaces/space file"
> data
$ [ -e backup ] && echo "backup directory not deleted"
# Test backup reading file list from a file
- $ %{QUILT_LIB}/backup-files -B backup/ -b -s -L -f -
+ $ %{QUILT_DIR}/scripts/backup-files -B backup/ -b -s -L -f -
< foo
< new
< space bar
@@ -159,7 +159,7 @@ Unit test of the backup-files script.
> foo
$ cat "backup/space bar"
> bar
- $ %{QUILT_LIB}/backup-files -B backup/ -r -s -f -
+ $ %{QUILT_DIR}/scripts/backup-files -B backup/ -r -s -f -
< foo
< new
< space bar
@@ -171,7 +171,7 @@ Unit test of the backup-files script.
> bar
# Test the special -L alone case
- $ %{QUILT_LIB}/backup-files -B backup/ -b -L -f -
+ $ %{QUILT_DIR}/scripts/backup-files -B backup/ -b -L -f -
< new
< foo
< space bar
@@ -183,20 +183,20 @@ Unit test of the backup-files script.
> 1
$ ls -l "space bar" | awk '{ print $2 }'
> 2
- $ %{QUILT_LIB}/backup-files -B backup/ -L -
+ $ %{QUILT_DIR}/scripts/backup-files -B backup/ -L -
$ ls -l foo | awk '{ print $2 }'
> 1
$ ls -l "space bar" | awk '{ print $2 }'
> 1
$ [ ! -e new ] || echo "file new shouldn't exist"
# Second call should be idempotent
- $ %{QUILT_LIB}/backup-files -B backup/ -L -
+ $ %{QUILT_DIR}/scripts/backup-files -B backup/ -L -
$ ls -l foo | awk '{ print $2 }'
> 1
$ ls -l "space bar" | awk '{ print $2 }'
> 1
$ [ ! -e new ] || echo "file new shouldn't exist"
- $ %{QUILT_LIB}/backup-files -B backup/ -r - | sort
+ $ %{QUILT_DIR}/scripts/backup-files -B backup/ -r - | sort
> Removing new
> Restoring foo
> Restoring space bar