summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--po/de.po48
-rw-r--r--po/fr.po43
-rw-r--r--po/ja.po43
-rw-r--r--po/quilt.pot40
-rw-r--r--quilt.changes9
-rw-r--r--quilt/setup.in163
-rw-r--r--test/setup.test52
7 files changed, 274 insertions, 124 deletions
diff --git a/po/de.po b/po/de.po
index f60b995..6f98f9e 100644
--- a/po/de.po
+++ b/po/de.po
@@ -1378,47 +1378,59 @@ msgstr ""
"\n"
"-v\tAusführlichere, benutzerfreundliche Ausgabe.\n"
-#: quilt/setup.in:27
-msgid "Usage: quilt setup [-d path-prefix] [-v] {specfile|seriesfile}\\n"
+#: quilt/setup.in:31
+msgid "Directory %s exists\\n"
+msgstr "Verzeichnis %s existiert\\n"
+
+#: quilt/setup.in:37
+msgid "File %s exists\\n"
+msgstr "Datei %s existiert\\n"
+
+#: quilt/setup.in:93
+msgid ""
+"Usage: quilt setup [-d path-prefix] [-v] [--path dir1:dir2] {specfile|"
+"seriesfile}\\n"
msgstr ""
-"Verwendung: quilt setup [-d pfad-präfix] [-v] {spec-datei|series-datei}\\n"
+"Verwendung: quilt setup [-d pfad-präfix] [-v] [--path pfad:pfad] {spec-datei|"
+"series-datei}\\n"
-#: quilt/setup.in:30
+#: quilt/setup.in:96
msgid ""
"\n"
"Initializes a source tree from an rpm spec file or a quilt series file.\n"
"\n"
-"-d\toptional path prefix (sub-directory).\n"
+"-d\tOptional path prefix.\n"
+"\n"
+"--path\tDirectories to search when looking for tarballs. Defaults to \\`.'.\n"
"\n"
-"-v\tverbose debug output.\n"
+"-v\tVerbose debug output.\n"
msgstr ""
"\n"
"Initialisiere einen Quellbaum aus einer rpm spec-Datei oder einer quilt "
"series-Datei.\n"
"\n"
-"-d\tOptionaler Pfad-Präfix (Unterverzeichnis).\n"
+"-d\tOptionaler Pfad-Präfix.\n"
+"\n"
+"--path\tVerzeichnisse, in denen nach tar-Archiven gesucht wird. Wenn nicht\n"
+"\tanders angegeben, wird \\`.' durchsucht.\n"
"\n"
"-v\tAusführliche Ausgabe.\n"
-#: quilt/setup.in:96
-msgid "Directory %s exists\\n"
-msgstr "Verzeichnis %s existiert\\n"
-
-#: quilt/setup.in:102
-msgid "File %s exists\\n"
-msgstr "Datei %s existiert\\n"
-
-#: quilt/setup.in:118
+#: quilt/setup.in:158
msgid "The %%prep section of %s failed; results may be incomplete\\n"
msgstr ""
"Der %%prep-Abschnitt von %s ist fehlgeschlagen; die Ergebnisse sind "
"möglicherweise unvollständig\\n"
-#: quilt/setup.in:121
+#: quilt/setup.in:161
msgid "The -v option will show rpm's output\\n"
msgstr "Die Option -v zeigt die Ausgaben von rpm an\\n"
-#: quilt/setup.in:155
+#: quilt/setup.in:198
+msgid "File %s not found in search path\\n"
+msgstr "Datei %s nicht im Suchpfad gefunden\\n"
+
+#: quilt/setup.in:201
msgid "Unpacking archive %s\\n"
msgstr "Entpacke Archiv %s\\n"
diff --git a/po/fr.po b/po/fr.po
index e6345eb..8485204 100644
--- a/po/fr.po
+++ b/po/fr.po
@@ -1383,20 +1383,34 @@ msgstr ""
"\n"
"-v\tAffichage verbeux, plus simple lire.\n"
-#: quilt/setup.in:27
-msgid "Usage: quilt setup [-d path-prefix] [-v] {specfile|seriesfile}\\n"
+#: quilt/setup.in:31
+msgid "Directory %s exists\\n"
+msgstr "Le rpertoire %s existe\\n"
+
+#: quilt/setup.in:37
+msgid "File %s exists\\n"
+msgstr "Le fichier %s existe\\n"
+
+#: quilt/setup.in:93
+#, fuzzy
+msgid ""
+"Usage: quilt setup [-d path-prefix] [-v] [--path dir1:dir2] {specfile|"
+"seriesfile}\\n"
msgstr ""
"Usage : quilt setup [-d rpertoire_source] [-v] {fichier_sries|fichier_spec}"
"\\n"
-#: quilt/setup.in:30
+#: quilt/setup.in:96
+#, fuzzy
msgid ""
"\n"
"Initializes a source tree from an rpm spec file or a quilt series file.\n"
"\n"
-"-d\toptional path prefix (sub-directory).\n"
+"-d\tOptional path prefix.\n"
+"\n"
+"--path\tDirectories to search when looking for tarballs. Defaults to \\`.'.\n"
"\n"
-"-v\tverbose debug output.\n"
+"-v\tVerbose debug output.\n"
msgstr ""
"\n"
"Initialise un arbre de sources partir d'un fichier de\n"
@@ -1406,24 +1420,21 @@ msgstr ""
"\n"
"-v\taffichage verbeux pour le debug.\n"
-#: quilt/setup.in:96
-msgid "Directory %s exists\\n"
-msgstr "Le rpertoire %s existe\\n"
-
-#: quilt/setup.in:102
-msgid "File %s exists\\n"
-msgstr "Le fichier %s existe\\n"
-
-#: quilt/setup.in:118
+#: quilt/setup.in:158
msgid "The %%prep section of %s failed; results may be incomplete\\n"
msgstr ""
"La section %%prep de %s a chou ; les rsultats sont peut-tre incomplets\\n"
-#: quilt/setup.in:121
+#: quilt/setup.in:161
msgid "The -v option will show rpm's output\\n"
msgstr "L'option -v montre les affichages de rpm\\\\n"
-#: quilt/setup.in:155
+#: quilt/setup.in:198
+#, fuzzy
+msgid "File %s not found in search path\\n"
+msgstr "Le fichier %s n'est pas dans le patch %s.\\n"
+
+#: quilt/setup.in:201
msgid "Unpacking archive %s\\n"
msgstr "Dsarchivage de %s\\n"
diff --git a/po/ja.po b/po/ja.po
index b7db633..c405fd4 100644
--- a/po/ja.po
+++ b/po/ja.po
@@ -1340,19 +1340,33 @@ msgstr ""
"-v\t詳細で見やすい表示。\n"
"\n"
-#: quilt/setup.in:27
-msgid "Usage: quilt setup [-d path-prefix] [-v] {specfile|seriesfile}\\n"
+#: quilt/setup.in:31
+msgid "Directory %s exists\\n"
+msgstr "ディレクトリ %s は、すでに存在します\\n"
+
+#: quilt/setup.in:37
+msgid "File %s exists\\n"
+msgstr "ファイル %s は、すでに存在します\\n"
+
+#: quilt/setup.in:93
+#, fuzzy
+msgid ""
+"Usage: quilt setup [-d path-prefix] [-v] [--path dir1:dir2] {specfile|"
+"seriesfile}\\n"
msgstr ""
"使い方: quilt setup [-d path-prefix] [-v] {specファイル|seriesファイル}\\n"
-#: quilt/setup.in:30
+#: quilt/setup.in:96
+#, fuzzy
msgid ""
"\n"
"Initializes a source tree from an rpm spec file or a quilt series file.\n"
"\n"
-"-d\toptional path prefix (sub-directory).\n"
+"-d\tOptional path prefix.\n"
+"\n"
+"--path\tDirectories to search when looking for tarballs. Defaults to \\`.'.\n"
"\n"
-"-v\tverbose debug output.\n"
+"-v\tVerbose debug output.\n"
msgstr ""
"\n"
"rpmの specファイルまたは quiltの seriesファイルを使ってソースツリーを\n"
@@ -1362,25 +1376,22 @@ msgstr ""
"\n"
"-v\t詳細なデバッグ表示\n"
-#: quilt/setup.in:96
-msgid "Directory %s exists\\n"
-msgstr "ディレクトリ %s は、すでに存在します\\n"
-
-#: quilt/setup.in:102
-msgid "File %s exists\\n"
-msgstr "ファイル %s は、すでに存在します\\n"
-
-#: quilt/setup.in:118
+#: quilt/setup.in:158
msgid "The %%prep section of %s failed; results may be incomplete\\n"
msgstr ""
"%%prepセクションの解析に失敗しました。完全に作業が完了していない場合がありま"
"す\\n"
-#: quilt/setup.in:121
+#: quilt/setup.in:161
msgid "The -v option will show rpm's output\\n"
msgstr "-vオプションを使って、rpmの出力を表示できます"
-#: quilt/setup.in:155
+#: quilt/setup.in:198
+#, fuzzy
+msgid "File %s not found in search path\\n"
+msgstr "ファイル %s は、パッチ %s に含まれていません\\n"
+
+#: quilt/setup.in:201
msgid "Unpacking archive %s\\n"
msgstr "アーカイブ %s を展開しています\\n"
diff --git a/po/quilt.pot b/po/quilt.pot
index 827a130..f8b8d3d 100644
--- a/po/quilt.pot
+++ b/po/quilt.pot
@@ -965,37 +965,45 @@ msgid ""
"-v\tVerbose, more user friendly output.\n"
msgstr ""
-#: quilt/setup.in:27
-msgid "Usage: quilt setup [-d path-prefix] [-v] {specfile|seriesfile}\\n"
+#: quilt/setup.in:31
+msgid "Directory %s exists\\n"
msgstr ""
-#: quilt/setup.in:30
+#: quilt/setup.in:37
+msgid "File %s exists\\n"
+msgstr ""
+
+#: quilt/setup.in:93
+msgid ""
+"Usage: quilt setup [-d path-prefix] [-v] [--path dir1:dir2] {specfile|"
+"seriesfile}\\n"
+msgstr ""
+
+#: quilt/setup.in:96
msgid ""
"\n"
"Initializes a source tree from an rpm spec file or a quilt series file.\n"
"\n"
-"-d\toptional path prefix (sub-directory).\n"
+"-d\tOptional path prefix.\n"
"\n"
-"-v\tverbose debug output.\n"
-msgstr ""
-
-#: quilt/setup.in:96
-msgid "Directory %s exists\\n"
-msgstr ""
-
-#: quilt/setup.in:102
-msgid "File %s exists\\n"
+"--path\tDirectories to search when looking for tarballs. Defaults to \\`.'.\n"
+"\n"
+"-v\tVerbose debug output.\n"
msgstr ""
-#: quilt/setup.in:118
+#: quilt/setup.in:158
msgid "The %%prep section of %s failed; results may be incomplete\\n"
msgstr ""
-#: quilt/setup.in:121
+#: quilt/setup.in:161
msgid "The -v option will show rpm's output\\n"
msgstr ""
-#: quilt/setup.in:155
+#: quilt/setup.in:198
+msgid "File %s not found in search path\\n"
+msgstr ""
+
+#: quilt/setup.in:201
msgid "Unpacking archive %s\\n"
msgstr ""
diff --git a/quilt.changes b/quilt.changes
index 45db7af..b02dfb6 100644
--- a/quilt.changes
+++ b/quilt.changes
@@ -1,4 +1,13 @@
-------------------------------------------------------------------
+Sat Feb 11 15:15:07 CET 2006 - agruen@suse.de
+
+- quilt/setup.in: Add --path option for defining a tarball search
+ path. Fix a bug in check_for_existing_files. When a series file
+ is given as an argument, symlink to that series file in the
+ same way as we symlink to the patches. Improve the symlink
+ creation algorithm. Add testcase test/setup.test.
+
+-------------------------------------------------------------------
Sat Feb 11 15:10:03 CET 2006 - agruen@suse.de
- quilt/new.in: Try to explain how to choose another source tree
diff --git a/quilt/setup.in b/quilt/setup.in
index 7202bfa..3f2ac2e 100644
--- a/quilt/setup.in
+++ b/quilt/setup.in
@@ -22,17 +22,85 @@ then
fi
fi
+check_for_existing_files() {
+ local dir status=0
+ for dir in $(awk ' $1 == "patch" { print $2 }' $tmpfile | uniq)
+ do
+ if [ -e "$prefix$dir/$QUILT_PATCHES" ]
+ then
+ printf $"Directory %s exists\n" \
+ "$prefix$dir/$QUILT_PATCHES" >&2
+ status=1
+ fi
+ if [ -e "$prefix$dir/${QUILT_SERIES:-series}" ]
+ then
+ printf $"File %s exists\n" \
+ "$prefix$dir/${QUILT_SERIES:-series}" >&2
+ status=1
+ fi
+ done
+ return $status
+}
+
+find_tarball() {
+ if [ "${1:0:1}" = / ]
+ then
+ echo "$1"
+ return
+ fi
+
+ local IFS=:
+ for dir in $path
+ do
+ [ -z "$dir" ] && continue
+ if [ -e "$dir/$1" ]
+ then
+ echo "$dir/$1"
+ return
+ fi
+ done
+ return 1
+}
+
+create_symlink() {
+ local from=$1 to=$2 up
+ if [ "${from:0:1}" = / ]
+ then
+ ln -s "$from" "$to"
+ return
+ fi
+
+ set -- "$(echo "$PWD/$from" | sed -r -e 's://:/:g' \
+ -e ':again' \
+ -e 's:/[^/]+/\.\.(/|$):\1:g' \
+ -e 'tagain')" \
+ "$(echo "$PWD/$to" | sed -r -e 's://:/:g' \
+ -e ':again' \
+ -e 's:/[^/]+/\.\.(/|$):\1:g' \
+ -e 'tagain')"
+ while [ "${1%%/*}" = "${2%%/*}" ]
+ do
+ set -- "${1#*/}" "${2#*/}"
+ done
+ up=$(echo "${2%/*}" | sed -re 's:[^/]+:..:g')
+ set -- "${up:+$up/}$1"
+ set -- "${1%/}"
+ ln -s "${1:-.}" "$to"
+}
+
usage()
{
- printf $"Usage: quilt setup [-d path-prefix] [-v] {specfile|seriesfile}\n"
+ printf $"Usage: quilt setup [-d path-prefix] [-v] [--path dir1:dir2] {specfile|seriesfile}\n"
if [ x$1 = x-h ]
then
printf $"
Initializes a source tree from an rpm spec file or a quilt series file.
--d optional path prefix (sub-directory).
+-d Optional path prefix.
--v verbose debug output.
+--path Directories to search when looking for tarballs. Defaults to \`.'.
+
+-v Verbose debug output.
"
exit 0
else
@@ -40,7 +108,7 @@ Initializes a source tree from an rpm spec file or a quilt series file.
fi
}
-options=`getopt -o d:vh -- "$@"`
+options=`getopt -o d:vh --long path: -- "$@"`
if [ $? -ne 0 ]
then
@@ -62,6 +130,9 @@ do
-v)
verbose=-v
shift ;;
+ --path)
+ path="$path:$2"
+ shift 2 ;;
--)
shift
break ;;
@@ -73,45 +144,14 @@ then
usage
fi
-up() {
- if [ "${1:0:1}" = / ]
- then
- echo $1
- else
- local up=
- while ! [ "$1$up" -ef . -o "$1$up" -ef / ]
- do
- up=$up/..
- done
- echo ${up:1}
- fi
-}
-
-check_for_existing_files() {
- local dir status=0
- for dir in $(awk ' $1 = "patch" { print $2 }' $tmpfile | uniq)
- do
- if [ -e "$prefix$dir/$QUILT_PATCHES" ]
- then
- printf $"Directory %s exists\n" \
- "$prefix$dir/$QUILT_PATCHES" >&2
- status=1
- fi
- if [ -e "$prefix$dir/series" ]
- then
- printf $"File %s exists\n" "$prefix$dir/series" >&2
- status=1
- fi
- done
- return $status
-}
+[ -z "$path" ] && path=.
tmpfile=$(gen_tempfile)
trap "rm -f $tmpfile" EXIT
case "$1" in
*.spec)
- spec_file="$1"
+ spec_file=$1
if ! $QUILT_DIR/scripts/inspect $verbose "$spec_file" 2>&1 > $tmpfile
then
@@ -123,6 +163,7 @@ case "$1" in
fi
;;
*)
+ series_file=$1
# parse series file
while read line; do
set -- $line
@@ -141,7 +182,7 @@ case "$1" in
*)
echo "patch ${patch_dir:-.} $@" ;;
esac
- done < "$1" > $tmpfile
+ done < "$series_file" > $tmpfile
;;
esac
@@ -152,15 +193,18 @@ do
mkdir -p "$prefix$dir"
case "$tag" in
tar)
- printf $"Unpacking archive %s\n" "$arg1"
- cat_file "$arg1" \
+ if ! tarball=$(find_tarball "$arg1")
+ then
+ printf $"File %s not found in search path\n" "$arg1" >&2
+ exit 1
+ fi
+ printf $"Unpacking archive %s\n" "$tarball"
+ cat_file "$tarball" \
| tar xf - -C "$prefix$dir"
;;
esac
done < $tmpfile
-check_for_existing_files || exit 1
-
while read tag dir arg1 arg2
do
case "$tag" in
@@ -171,24 +215,27 @@ do
;;
patch)
[ -e "$prefix$dir/$QUILT_PATCHES" ] \
- || ln -s "$(up $prefix$dir)" $prefix$dir/$QUILT_PATCHES
-
- if ! [ -e "$prefix$dir/series" ]
+ || create_symlink "" "$prefix$dir/$QUILT_PATCHES"
+ if [ -n "$series_file" ]
then
- # (There is no reliable way to associate archives with
- # patches; we assume that all pathes applied after
- # archive extraction belong to that archive.)
- ( echo "# Patch series file for quilt," \
- "created by ${0##*/}"
- [ -n "$tar_dir" ] \
- && echo "# Sourcedir: $tar_dir"
- [ -n "$tar_file" ] \
- && echo "# Source: $tar_file"
- echo "# Patchdir: $dir"
- echo "#"
- ) > "$prefix$dir/series"
+ [ -e "$prefix$dir/${QUILT_SERIES:-series}" ] \
+ || create_symlink "$series_file" \
+ "$prefix$dir/${QUILT_SERIES:-series}"
+ else
+ if ! [ -e "$prefix$dir/${QUILT_SERIES:-series}" ]
+ then
+ ( echo "# Patch series file for quilt," \
+ "created by ${0##*/}"
+ [ -n "$tar_dir" ] \
+ && echo "# Sourcedir: $tar_dir"
+ [ -n "$tar_file" ] \
+ && echo "# Source: $tar_file"
+ echo "# Patchdir: $dir"
+ echo "#"
+ ) > "$prefix$dir/${QUILT_SERIES:-series}"
+ fi
+ echo "$arg1" $arg2 >> "$prefix$dir/series"
fi
- echo "$arg1" $arg2 >> "$prefix$dir/series"
;;
esac
done < $tmpfile
diff --git a/test/setup.test b/test/setup.test
new file mode 100644
index 0000000..eed1de2
--- /dev/null
+++ b/test/setup.test
@@ -0,0 +1,52 @@
+$ rm -rf d
+$ mkdir -p d/dir
+$ cd d
+$ echo 1 > dir/foo.orig
+$ echo 2 > dir/foo
+$ diff -u dir/foo.orig dir/foo > foo.diff
+$ mv dir/foo.orig dir/foo
+$ tar cf - dir | gzip > dir.tar.gz
+$ rm -rf dir
+$ cat > series
+< # Source: dir.tar.gz
+< # Patchdir: dir
+< #
+< foo.diff -p1
+$ quilt setup series
+> Unpacking archive ./dir.tar.gz
+$ cd dir
+$ ls -l patches series | sed -e 's:.* -> ::'
+> ..
+> ../series
+$ quilt push -qa
+> Applying patch patches/foo.diff
+> Now at patch patches/foo.diff
+$ cd ..
+$ rm -rf dir
+$ quilt setup -d other series
+> Unpacking archive ./dir.tar.gz
+$ cd other/dir
+$ ls -l patches series | sed -e 's:.* -> ::'
+> ../..
+> ../../series
+$ quilt push -qa
+> Applying patch patches/foo.diff
+> Now at patch patches/foo.diff
+$ cd ../..
+$ rm -rf other
+$ mkdir dir1
+$ mv foo.diff series dir1
+$ cd dir1
+$ quilt setup -d ../other series
+> File dir.tar.gz not found in search path
+$ quilt setup --path .. -d ../other series
+> Unpacking archive ../dir.tar.gz
+$ cd ../other/dir
+$ ls -l patches series | sed -e 's:.* -> ::'
+> ../../dir1
+> ../../dir1/series
+$ quilt push -qa
+> Applying patch patches/foo.diff
+> Now at patch patches/foo.diff
+$ cd ..
+$ rm -rf d