diff options
author | Andreas Gruenbacher <agruen@suse.de> | 2004-05-31 15:22:43 +0000 |
---|---|---|
committer | Andreas Gruenbacher <agruen@suse.de> | 2004-05-31 15:22:43 +0000 |
commit | b704611db0b3e9bf4e9402745430aae1a68004dd (patch) | |
tree | 81b305eff4ba5f5dfc225bc0d8f4fe558bc331ba | |
parent | ced252dabbef9fd962a2f0d268a818c37815b8b4 (diff) | |
download | quilt-b704611db0b3e9bf4e9402745430aae1a68004dd.tar.gz |
- Rewrite spec2series to return what the new `quilt setup' needs,
and rename it to inspect.
- `quilt setup': Rewrite so that it supports multiple archives
per spec file. Always make the patches directory a symlink to
the original patch files instead of copying the patches.
- Update German translation.
-rw-r--r-- | AUTHORS | 2 | ||||
-rw-r--r-- | Makefile.in | 2 | ||||
-rw-r--r-- | TODO | 5 | ||||
-rw-r--r-- | po/Makefile | 2 | ||||
-rw-r--r-- | po/de.po | 78 | ||||
-rw-r--r-- | po/fr.po | 19 | ||||
-rw-r--r-- | po/quilt.pot | 60 | ||||
-rw-r--r-- | quilt.changes | 10 | ||||
-rw-r--r-- | quilt/setup.in | 266 | ||||
-rw-r--r-- | scripts/inspect.in | 182 | ||||
-rwxr-xr-x | scripts/spec2series.in | 227 |
11 files changed, 344 insertions, 509 deletions
@@ -16,7 +16,7 @@ Andreas Gruenbacher <agruen@suse.de> Package up as RPM. Gerd Knorr <kraxel@suse.de> - Contributed spec2series. + Contributed spec2series (= inspect now). Martin Quinson <Martin.Quinson@tuxfamily.org> Several little patches and improvements. diff --git a/Makefile.in b/Makefile.in index e80a879..007652c 100644 --- a/Makefile.in +++ b/Makefile.in @@ -64,7 +64,7 @@ QUILT := $(QUILT_IN) SRC += $(QUILT_SRC:%=quilt/%) DIRT += $(QUILT_IN:%=quilt/%) -SCRIPTS_IN := apatch rpatch patchfns parse-patch spec2series dependency-graph +SCRIPTS_IN := apatch rpatch patchfns parse-patch inspect dependency-graph SCRIPTS_SRC := $(SCRIPTS_IN:%=%.in) SCRIPTS := $(SCRIPTS_IN) SRC += $(SCRIPTS_SRC:%=scripts/%) @@ -41,8 +41,9 @@ quilt import: or the right documentation, or to merge them both. (-d{ona}?) quilt setup: - - - spec2series also prints -p1; omit. + + - Also recognize other uses of tar and patch (with options in the + command line), etc. rpatch: diff --git a/po/Makefile b/po/Makefile index 935a617..b1d4450 100644 --- a/po/Makefile +++ b/po/Makefile @@ -1,7 +1,7 @@ QUILT_IN := add applied delete diff files import new next patches \ pop previous push refresh remove series setup top unapplied \ fold fork snapshot edit -SCRIPTS_IN := apatch rpatch patchfns spec2series patchfns +SCRIPTS_IN := apatch rpatch patchfns inspect patchfns # scripts/parse-patch is perl based # LINGUAS = ... @@ -763,76 +763,36 @@ msgstr "" "-v\tAusführlichere, benutzerfreundliche Ausgabe." #: ../quilt/setup.in:27 -msgid "Usage: quilt setup [-d sourcedir] {seriesfile|specfile}" -msgstr "Verwendung: quilt setup [-d quellvz.] {seriesdatei|specdatei}" +msgid "Usage: quilt setup [-d path-prefix] [-v] {specfile|seriesfile}" +msgstr "Verwendung: quilt setup [-d pfad-prefix] [-v] {spec-datei|series-datei}" #: ../quilt/setup.in:30 msgid "" "\n" -"Initializes a source tree from a patch series file. The patch series\n" -"file must contain the name of the relevant tar archive, in addition to\n" -"the list of patches.\n" +"Initializes a source tree from an rpm spec file or a quilt series file.\n" "\n" -"-d\tThe directory that contains the archives and patches. Defaults\n" -"\tto the directory of the series/spec file.\n" +"-d\toptional path prefix (sub-directory).\n" "\n" -"-l\tMake the patches directory a symbolic link. If a series file is\n" -"\tspecified, also create a symlink to the series file." +"-v\tverbose debug output." msgstr "" "\n" -"Initialisiere einen Quellbaum aus einer series-Datei. Die series-Datei\n" -"muss den Namen der entsprechenden Tar-Archive und die Liste der Patches\n" -"enthalten.\n" +"Initialisiere einen Quellbaum aus einer rpm spec-Datei oder einer quilt series-Datei.\n" "\n" -"-d\tVerzeichnis, das Archive und Patches enthält. Vorgabewert ist das\n" -"Verzeichnis, das die series/spec-Datei enthält.\n" +"-d\tOptionaler Pfad-Präfix (Unterverzeichnis).\n" "\n" -"-l\tErzeuge eine Verknüpfung für das patches-Vezeichnis. Falls eine\n" -"series-Datei angegeben wird, erzeuge eine Verknüpfung auf diese Datei." +"-v\tAusführliche Ausgabe." -#: ../quilt/setup.in:111 -msgid "Series file $series_file not found" -msgstr "Seriendatei $series_file nicht gefunden" +#: ../quilt/setup.in:95 +msgid "Directory $prefix$dir/$QUILT_PATCHES exists" +msgstr "Verzeichnis $prefix$dir/$QUILT_PATCHES existiert" -#: ../quilt/setup.in:137 -msgid "Reading sources from $arg" -msgstr "Quellen werden von $arg gelesen" +#: ../quilt/setup.in:100 +msgid "File $prefix$dir/series exists" +msgstr "Datei $prefix$dir/series existiert" -#: ../quilt/setup.in:141 -msgid "Unpacking archive $source/$arg" -msgstr "Entpacke Archiv source/$arg" - -#: ../quilt/setup.in:151 -msgid "Directory $packagedir exists already." -msgstr "Verzeichnis $packagedir existiert bereits." - -#: ../quilt/setup.in:156 -msgid "File $packagedir exists." -msgstr "Datei $packagedir existiert." - -#: ../quilt/setup.in:171 -msgid "Creating link to patches directory $arg" -msgstr "Erzeuge Verknüpfung auf Patch-Verzeichnis $arg" - -#: ../quilt/setup.in:175 -msgid "Copying patch $source/$arg" -msgstr "Kopiere Patch $source/$arg" - -#: ../quilt/setup.in:188 -msgid "File $packagedir/series exists; will not override." -msgstr "Datei $packagedir/series existiert und wird nicht überschrieben." - -#: ../quilt/setup.in:195 ../quilt/setup.in:209 -msgid "Copying series file" -msgstr "Kopiere series-Datei" - -#: ../quilt/setup.in:205 -msgid "Creating link to series file $arg" -msgstr "Erzeuge Verknüpfung zur series-Datei" - -#: ../quilt/setup.in:240 -msgid "Directory $packagedir set up." -msgstr "Verzeichnis $packagedir aufgebaut." +#: ../quilt/setup.in:149 +msgid "Unpacking archive $arg1" +msgstr "Entpacke Archiv $arg1" #: ../quilt/snapshot.in:22 msgid "Usage: quilt snapshot [-d]" @@ -934,7 +894,3 @@ msgstr "Patch $patch scheint leer zu sein, entfernt" #: ../scripts/rpatch.in:131 msgid "Removing $patch" msgstr "Entferne $patch" - -#: ../scripts/spec2series.in:100 ../scripts/spec2series.in:192 -msgid " done" -msgstr " fertig" @@ -385,7 +385,8 @@ msgstr "" #: ../quilt/import.in:73 msgid "Option \\`-n' can only be used when importing a single patch" -msgstr "L'option « -n » ne peut être utilisé que lors de l'import d'un seul patch." +msgstr "" +"L'option « -n » ne peut être utilisé que lors de l'import d'un seul patch." #: ../quilt/import.in:90 msgid "Patch $patch is applied." @@ -518,10 +519,12 @@ msgid "" msgstr "" "\n" "Retire un ou plusieurs patches de la pile. Si aucun argument n'est\n" -"spécifié, le patch au sommet est retiré. Si un nombre est passé en argument,\n" +"spécifié, le patch au sommet est retiré. Si un nombre est passé en " +"argument,\n" "cela indique la quantité de patchs à retirer. Si un nom de patch est\n" "spécifié, il est retiré ainsi que tous ceux placés avant lui dans la\n" -"série. Le nom des patchs peut contenir le préfix patches/ de façon à pouvoir\n" +"série. Le nom des patchs peut contenir le préfix patches/ de façon à " +"pouvoir\n" "profiter de la complétion sur le nom de fichier.\n" "\n" "-a\tRetire tous les patches de la série.\n" @@ -604,10 +607,12 @@ msgid "" msgstr "" "\n" "Applique un ou plusieurs patches de la série. Si aucun argument n'est\n" -"spécifié, le prochain patch est appliqué. Si un nombre est passé en argument,\n" +"spécifié, le prochain patch est appliqué. Si un nombre est passé en " +"argument,\n" "cela indique la quantité de patchs à appliquer. Si un nom de patch est\n" "spécifié, il est appliqué ainsi que tous ceux placés avant lui dans la\n" -"série. Le nom des patchs peut contenir le préfix patches/ de façon à pouvoir\n" +"série. Le nom des patchs peut contenir le préfix patches/ de façon à " +"pouvoir\n" "profiter de la complétion sur le nom de fichier.\n" "\n" "-a\tApplique tous les patches de la série.\n" @@ -778,7 +783,7 @@ msgstr "" #: ../quilt/setup.in:27 #, fuzzy -msgid "Usage: quilt setup [-d sourcedir] [-v] specfile" +msgid "Usage: quilt setup [-d path-prefix] [-v] specfile" msgstr "" "Usage : quilt setup [-d répertoire_source] {fichier_séries|fichier_spec}" @@ -801,7 +806,7 @@ msgstr "" msgid "File $prefix$dir/series exists" msgstr "Le fichier $packagedir existe." -#: ../quilt/setup.in:123 +#: ../quilt/setup.in:148 #, fuzzy msgid "Unpacking archive $arg1" msgstr "Désarchivage depuis $source/$arg" diff --git a/po/quilt.pot b/po/quilt.pot index fb3c613..7fc6705 100644 --- a/po/quilt.pot +++ b/po/quilt.pot @@ -564,65 +564,29 @@ msgid "" msgstr "" #: ../quilt/setup.in:27 -msgid "Usage: quilt setup [-d sourcedir] {seriesfile|specfile}" +msgid "Usage: quilt setup [-d path-prefix] [-v] {specfile|seriesfile}" msgstr "" #: ../quilt/setup.in:30 msgid "" "\n" -"Initializes a source tree from a patch series file. The patch series\n" -"file must contain the name of the relevant tar archive, in addition to\n" -"the list of patches.\n" +"Initializes a source tree from an rpm spec file or a quilt series file.\n" "\n" -"-d\tThe directory that contains the archives and patches. Defaults\n" -"\tto the directory of the series/spec file.\n" +"-d\toptional path prefix (sub-directory).\n" "\n" -"-l\tMake the patches directory a symbolic link. If a series file is\n" -"\tspecified, also create a symlink to the series file." +"-v\tverbose debug output." msgstr "" -#: ../quilt/setup.in:111 -msgid "Series file $series_file not found" +#: ../quilt/setup.in:95 +msgid "Directory $prefix$dir/$QUILT_PATCHES exists" msgstr "" -#: ../quilt/setup.in:137 -msgid "Reading sources from $arg" +#: ../quilt/setup.in:100 +msgid "File $prefix$dir/series exists" msgstr "" -#: ../quilt/setup.in:141 -msgid "Unpacking archive $source/$arg" -msgstr "" - -#: ../quilt/setup.in:151 -msgid "Directory $packagedir exists already." -msgstr "" - -#: ../quilt/setup.in:156 -msgid "File $packagedir exists." -msgstr "" - -#: ../quilt/setup.in:171 -msgid "Creating link to patches directory $arg" -msgstr "" - -#: ../quilt/setup.in:175 -msgid "Copying patch $source/$arg" -msgstr "" - -#: ../quilt/setup.in:188 -msgid "File $packagedir/series exists; will not override." -msgstr "" - -#: ../quilt/setup.in:195 ../quilt/setup.in:209 -msgid "Copying series file" -msgstr "" - -#: ../quilt/setup.in:205 -msgid "Creating link to series file $arg" -msgstr "" - -#: ../quilt/setup.in:240 -msgid "Directory $packagedir set up." +#: ../quilt/setup.in:149 +msgid "Unpacking archive $arg1" msgstr "" #: ../quilt/snapshot.in:22 @@ -711,7 +675,3 @@ msgstr "" #: ../scripts/rpatch.in:131 msgid "Removing $patch" msgstr "" - -#: ../scripts/spec2series.in:100 ../scripts/spec2series.in:192 -msgid " done" -msgstr "" diff --git a/quilt.changes b/quilt.changes index 79610a9..e0eef1b 100644 --- a/quilt.changes +++ b/quilt.changes @@ -1,4 +1,14 @@ ------------------------------------------------------------------- +Mon May 31 05:03:30 CEST 2004 - agruen@suse.de + +- Rewrite spec2series to return what the new `quilt setup' needs, + and rename it to inspect. +- `quilt setup': Rewrite so that it supports multiple archives + per spec file. Always make the patches directory a symlink to + the original patch files instead of copying the patches. +- Update German translation. + +------------------------------------------------------------------- Sun May 16 12:15:13 CEST 2004 - agruen@suse.de - Clarify help text of `quilt add' (thanks to Tom Rini diff --git a/quilt/setup.in b/quilt/setup.in index 0e45538..cc523f1 100644 --- a/quilt/setup.in +++ b/quilt/setup.in @@ -24,46 +24,22 @@ fi usage() { - echo $"Usage: quilt setup [-d sourcedir] {seriesfile|specfile}" + echo $"Usage: quilt setup [-d path-prefix] [-v] {specfile|seriesfile}" if [ x$1 = x-h ] then echo $" -Initializes a source tree from a patch series file. The patch series -file must contain the name of the relevant tar archive, in addition to -the list of patches. +Initializes a source tree from an rpm spec file or a quilt series file. --d The directory that contains the archives and patches. Defaults - to the directory of the series/spec file. +-d optional path prefix (sub-directory). --l Make the patches directory a symbolic link. If a series file is - specified, also create a symlink to the series file." +-v verbose debug output." exit 0 else exit 1 fi } -parse_series() -{ - local series="$1" - - perl -e ' - while(<>) { - if (/^#\s*Sourcedir:\s*(\S+)/) { - print "SOURCEDIR $1\n"; - } elsif (/^#\s*[Ss]ource:\s*(\S+)\s*(-C\s*(\S+))?/) { - print "SOURCE $1 ", ($3 ? $3 : "."), "\n"; - } elsif (/^#\s*[Pp]atchdir:\s*(\S+)/) { - print "PATCHDIR $1\n"; - } elsif (/^([^#\s]+)/) { - print "PATCH $1\n"; - } - } - ' $series - echo "SERIES $series" -} - -options=`getopt -o d:lh -- "$@"` +options=`getopt -o d:vh -- "$@"` if [ $? -ne 0 ] then @@ -72,17 +48,19 @@ fi eval set -- "$options" +prefix= + while true do case "$1" in -d) - opt_source=$2 + prefix=${2%/}/ shift 2 ;; - -l) - opt_link=1 - shift ;; -h) usage -h ;; + -v) + verbose=-v + shift ;; --) shift break ;; @@ -94,151 +72,121 @@ 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 + echo $"Directory $prefix$dir/$QUILT_PATCHES exists" >&2 + status=1 + fi + if [ -e "$prefix$dir/series" ] + then + echo $"File $prefix$dir/series exists" >&2 + status=1 + fi + done + return $status +} + +tmpfile=$(gen_tempfile) +trap "rm -f $tmpfile" EXIT + case "$1" in *.spec) spec_file="$1" - tmpfile=$(gen_tempfile) - series_file=$tmpfile - if ! @SCRIPTS@/spec2series "$spec_file" > $tmpfile + + if ! @SCRIPTS@/inspect $verbose "$spec_file" > $tmpfile then exit 1 fi ;; *) - series_file=$1 - if ! [ -e "$series_file" ] - then - echo $"Series file $series_file not found" - exit 1 - fi + # parse series file + while read line; do + set -- $line + case "$@" in + "# Sourcedir: "*) + shift 2 + tar_dir="$@" ;; + "# Source: "*) + shift 2 + echo "tar ${tar_dir:-.} $@" ;; + "# Patchdir: "*) + shift 2 + patch_dir="$@" ;; + ''|'#'*) + ;; + *) + echo "patch ${patch_dir:-.} $@" ;; + esac + done < "$1" > $tmpfile ;; esac -if [ -n "$opt_source" ] -then - source="$opt_source" -elif [ -n "$spec_file" ] -then - source="$(dirname "$spec_file")" -else - source="$(dirname "$series_file")" -fi +check_for_existing_files || exit 1 -status=0 -packagedir=. -while read cmd arg arg2 +while read tag dir arg1 arg2 do - case $cmd in - SOURCEDIR) - # Directory for package sources - if [ -z "$source" ] - then - source="$arg" - echo $"Reading sources from $arg" - fi - ;; - SOURCE) - echo $"Unpacking archive $source/$arg" - mkdir -p "$arg2" && \ - cat_file "$source/$arg" \ - | tar xf - -C "${arg2:-.}" - ;; - PATCHDIR) - # Directory where package is expanded - packagedir="$arg" - if [ -d "$packagedir" ] - then - echo $"Directory $packagedir exists already." - status=1 - break - elif [ -e "$packagedir" ] - then - echo $"File $packagedir exists." - status=1 - break - fi + mkdir -p "$prefix$dir" + case "$tag" in + tar) + echo $"Unpacking archive $arg1" + cat_file "$arg1" \ + | tar xf - -C "$prefix$dir" ;; - PATCH) - if [ -n "$opt_link" ] - then - if ! [ -e "$packagedir/patches" ] - then - arg="$source" - if [ "${arg:0:1}" != "/" ] - then - arg="$PWD/$arg" - fi - echo $"Creating link to patches directory $arg" - ln -s "$arg" "$packagedir/patches" - fi - else - echo $"Copying patch $source/$arg" - mkdir -p "$packagedir/patches/" && \ - cp "$source/$arg" "$packagedir/patches/" - fi + esac +done < $tmpfile + +check_for_existing_files || exit 1 + +while read tag dir arg1 arg2 +do + case "$tag" in + tar) + tar_dir="$dir" + [ "$tar_dir" = . ] && tar_dir= + tar_file="$dir${dir:+/}$arg1" + tar_file="${tar_file#./}" ;; - SERIES) - if [ -n "$opt_link" ] + patch) + [ -e "$prefix$dir/$QUILT_PATCHES" ] \ + || ln -s "$(up $prefix$dir)" $prefix$dir/$QUILT_PATCHES + + if ! [ -e "$prefix$dir/series" ] then - # The patches dir is a symlink to the directory - # containing the patches. Don't write the series - # file into that directory. - if [ -e "$packagedir/series" ] - then - echo $"File $packagedir/series exists; will not override." >&2 - status=1 - elif [ -n "$spec_file" ] - then - # There is no series file to link to; the - # series file we are reading from is a - # temporary file. - echo $"Copying series file" - cp "$arg" "$packagedir/series" - else - # Create a symlink to the series file. We don't - # want to mess with changing relative symlink - # targets... - if [ "${arg:0:1}" != "/" ] - then - arg="$PWD/$arg" - fi - echo $"Creating link to series file $arg" - ln -s "$arg" "$packagedir/series" - fi - else - echo $"Copying series file" - mkdir -p $packagedir/patches - cp "$arg" "$packagedir/patches/series" + # (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" fi - ;; - *) - status=1 - break + echo "$arg1" $arg2 >> "$prefix$dir/series" ;; esac - s=$? - if [ $status -eq 0 ] - then - status=$s - [ $status != 0 ] && break - fi -done \ -< <(parse_series "$series_file") - -if [ -n "$tmpfile" ] -then - rm -f $tmpfile -fi - -if [ $status -ne 0 ] -then - exit 1 -fi - -if [ "$packagedir" != "." ] -then - echo $"Directory $packagedir set up." -fi +done < $tmpfile ### Local Variables: ### mode: shell-script ### End: diff --git a/scripts/inspect.in b/scripts/inspect.in new file mode 100644 index 0000000..4fcfba3 --- /dev/null +++ b/scripts/inspect.in @@ -0,0 +1,182 @@ +#! @BASH@ + +# This script is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# See the COPYING and AUTHORS files for more details. + +if ! [ -r @SCRIPTS@/patchfns ] +then + echo "Cannot read library @SCRIPTS@/patchfns" >&2 + exit 1 +fi +. @SCRIPTS@/patchfns +cd ${SUBDIR:-.} + +usage() { + echo "Usage: ${0##*/} specfile" + exit 1 +} + +if [ "$1" = -v ] +then + verbose=1 + shift +fi + +specfile=$1 +if [ $# -ne 1 -o ! -f "$specfile" ] +then + usage +fi + +if [ "${specfile:0:1}" != / ] +then + specfile="$PWD/$specfile" +fi +sourcedir=${specfile%/*} + +tmpdir="$(gen_tempfile -d ${TMPDIR-/tmp}/${0##*/})" +mkdir -p $tmpdir || exit 1 +trap "rm -rf $tmpdir" EXIT +mkdir -p $tmpdir/build +mkdir -p $tmpdir/bin + +# Redirect file descriptors +if [ -n "$verbose" ] +then + exec 3>&1 4>/dev/null +else + exec 3>&1 4>&2 2>/dev/null +fi + +# create md5 sums, also for uncompressed files +echo -n "### md5sum: " >&4 +shopt -s nullglob +for file in * +do + file=${file##*/} + case "$file" in + ready|bigpack|MD5SUMS|MD5SUMS.meta|*.spec|*.changes) + continue + ;; + esac + [ -f "$file" ] || continue + echo -n "." >&4 + echo "md5sum < $file" >&2 + set -- $(md5sum < $file) + echo "$1 $file" + case "$(file -b $file)" in + compress*|gzip*) + echo -n "g" >&4 + echo "md5sum < <(gzip -cd $file)" >&2 + set -- $(gzip -cd $file | md5sum) + echo "$1 $file" + ;; + bzip2*) + echo -n "b" >&4 + echo "md5sum < <(bzip2 -cd $file)" >&2 + set -- $(bzip2 -cd $file | md5sum) + echo "$1 $file" + ;; + esac +done > $tmpdir/md5sum +echo >&4 +shopt -u nullglob + +RPM=( @RPMBUILD@ --eval "%define _sourcedir $sourcedir" \ + --eval "%define _specdir $sourcedir" \ + --eval "%define _builddir $tmpdir/build" ) +PATH="$tmpdir/bin:$PATH" + +# wrapper script for patch and tar +cat <<-'EOF' > $tmpdir/bin/wrapper + #! @BASH@ + + # search the path for command $1 + path_search() { + local cmd=$1 dir + IFS=: + set -- $PATH + shift + + for dir in "$@"; do + if [ -x $dir/$cmd ] + then + echo $dir/$cmd + return 0 + fi + done + return 1 + } + + # find original data file by md5sum + original_file() { + local file=$1 + + set -- $(md5sum < $file) + while read md5sum file + do + if [ $1 = $md5sum ] + then + echo $file + return 0 + fi + done < $tmpdir/md5sum + return 1 + } + + # Extract the -p option from the command line + strip_option() { + while [ $# -ne 0 -a "${1:0:2}" != -p ] + do + shift + done + if [ "${1:0:2}" = -p ] + then + [ "$1" = -p ] && set -- "$1$2" + [ "$1" != -p1 ] && echo $1 + fi + } + + # put data into tmpfile + tmpdir=${RPM_BUILD_DIR%/*} + cat > $tmpdir/data + + unpackfile="$(original_file $tmpdir/data)" + if [ -n "$unpackfile" ] + then + dir=${PWD/$RPM_BUILD_DIR} + dir=${dir##/} + + case "${0##*/}" in + patch) + echo -n p >&4 + echo "${0##*/} ${dir:-.} $unpackfile" \ + $(strip_option "$@") >&3 + ;; + tar) + echo -n t >&4 + echo "${0##*/} ${dir:-.} $unpackfile" >&3 + ;; + esac + fi + + realcmd="$(path_search ${0##*/})" \ + && $realcmd "$@" < $tmpdir/data +EOF +chmod 755 $tmpdir/bin/wrapper +ln -s wrapper $tmpdir/bin/patch +ln -s wrapper $tmpdir/bin/tar + +# let rpm do all the dirty specfile stuff ... +set -- @RPMBUILD@ +echo -n "### ${1##*/}: " >&4 + +"${RPM[@]}" --nodeps -bp "$specfile" < /dev/null > /dev/null +echo >&4 +### Local Variables: +### mode: shell-script +### End: +# vim:filetype=sh diff --git a/scripts/spec2series.in b/scripts/spec2series.in deleted file mode 100755 index 729c3a2..0000000 --- a/scripts/spec2series.in +++ /dev/null @@ -1,227 +0,0 @@ -#! @BASH@ - -# This script is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 2 as -# published by the Free Software Foundation. -# -# See the COPYING and AUTHORS files for more details. - -# defaults -debug=0 -specfile="" -outfile="" - -function usage() { -cat <<EOF -Usage: quilt spec2series [ options ] specfile - --h print this text --d debug mode (prints lots additional info - as comments into the output file) --o <file> - specify output file, stdout if unspecified - -EOF -} - -# parse args -while test "$1" != ""; do - case "$1" in - -h | --help) - usage; exit 0 - ;; - -d | --debug) - debug=1; shift - ;; - -o | --outfile) - outfile="$2"; shift; shift - ;; - *) - specfile="$1" - break; - ;; - esac -done - -if test ! -f "$specfile"; then - usage - exit 1 -fi - -# get absolute patch for specfile location -specdir=`dirname $specfile` -specfile=`basename $specfile` -case "$specdir" in - .) specdir="`pwd`" - ;; - /*) # nothing - ;; - *) specdir="`pwd`/$specdir" - ;; -esac - -# create tmp work dir -WORK="${TMPDIR-/tmp}/rpmlog-$$" -mkdir -p "$WORK" || exit 1 -trap 'rm -rf "$WORK"' EXIT -mkdir -p "$WORK/build" -mkdir -p "$WORK/bin" - -# create md5 sums, also for uncompressed files -echo -n "### md5: " >&2 -(cd $specdir; for file in /dev/null *; do - case "$file" in - ready | bigpack | MD5SUMS | MD5SUMS.meta | *.spec | *.changes) - continue - ;; - esac - type="`file -b $file | cut -d" " -f1`" - case "$type" in - compress*) - echo -n "z" >&2 - set -- `zcat $file | md5sum` - echo "$1 zcat ${file}" - ;; - gzip) - echo -n "g" >&2 - set -- `zcat $file | md5sum` - echo "$1 zcat ${file}" - ;; - bzip2) - echo -n "b" >&2 - set -- `bzcat $file | md5sum` - echo "$1 bzcat ${file}" - ;; - esac - echo -n "." >&2 - set -- `md5sum < $file` - echo "$1 cat ${file}" -done) > $WORK/md5sum -echo $" done" >&2 - -# prepare rpm dir fixups and hooks -RPM="@RPMBUILD@ --rcfile=/usr/lib/rpm/rpmrc:$WORK/rpmrc" -PATH="$WORK/bin:$PATH" -grep ^macrofiles /usr/lib/rpm/rpmrc \ - | @SED@ -e "/macrofiles/s|$|:$WORK/rpmmacros|" \ - > $WORK/rpmrc -cat <<-EOF > "$WORK/rpmmacros" - %_sourcedir $specdir - %_specdir $specdir - %_builddir $WORK/build -EOF - -# wrapper script for patch and tar -cat <<-'EOF' > "$WORK/bin/patch" - #!/bin/sh - - # save stuff for log - unpackcmd=`basename $0` - unpackdir=`pwd` - unpackargs="$*" - uncompress="false" - unpackfile="[oops]" - - # sort of progress bar - case $unpackcmd in - tar) echo -n "t" >&2;; - patch) echo -n "p" >&2;; - *) echo -n "?" >&2;; - esac - - # find real binary - realcmd="" - test -x "/bin/$unpackcmd" && realcmd="/bin/$unpackcmd" - test -x "/usr/bin/$unpackcmd" && realcmd="/usr/bin/$unpackcmd" - test "$realcmd" = "" && exit 1 - - # put data into tmpfile, exec real cmd, return on failure - WORK=`dirname $RPM_BUILD_DIR` - cat > "$WORK/data" - if test -x /bin/$unpackcmd; then - cmddir="/bin" - fi - $realcmd $* < "$WORK/data" - retval="$?" - test "$retval" != "0" && exit $retval - - # find original data file by md5sum - set -- `md5sum < "$WORK/data"` - unpackfile="[$1]" - set -- `cat "$WORK/md5sum"` - while test "$1" != ""; do - if test "[$1]" = "$unpackfile"; then - uncompress="$2" - unpackfile="$3" - break - fi - shift - done - - # print results - unpackdir=`echo $unpackdir | @SED@ -e "s|$RPM_BUILD_DIR|BUILD|"` - echo -n "# log: [$unpackdir] $uncompress $unpackfile" >>$WORK/cmdlog - echo " | $unpackcmd $unpackargs" >>$WORK/cmdlog - if test "$unpackcmd" = "patch" -a \ - -f "$RPM_SOURCE_DIR/$unpackfile"; then - patchdir="${unpackdir#BUILD/}" - if test ! -f "$WORK/patchdir"; then - echo -n $patchdir > $WORK/patchdir - fi - if test "`cat $WORK/patchdir`" = "$patchdir"; then - level=`echo $unpackargs | tr " " "\n" | grep ^-p` - echo "$unpackfile $level" >> $WORK/patchlog - fi - fi - if test "$unpackcmd" = "tar" -a \ - -f "$RPM_SOURCE_DIR/$unpackfile"; then - echo -n "# Source: $unpackfile" >>$WORK/tarlog - if test "$unpackdir" != "BUILD"; then - echo -n " -C ${unpackdir#BUILD/}" >>$WORK/tarlog - fi - echo "" >>$WORK/tarlog - fi -EOF -chmod 755 "$WORK/bin/patch" -ln -s patch "$WORK/bin/tar" - -# let rpm do all the dirty specfile stuff ... -echo -n "### $(basename @RPMBUILD@): " >&2 -touch $WORK/patchlog -$RPM --nodeps --quiet -bp "$specdir/$specfile" </dev/null >/dev/null -echo $" done" >&2 - -# print results saved by the wrapper script -( - # header - echo "# Patch series file for quilt, created by $0" - echo "#" - echo "# Sourcedir: $specdir" - echo "# Specfile: $specfile" - if test -f $WORK/patchdir; then - echo "# Patchdir: `cat $WORK/patchdir`" - fi - echo "#" - - # additional info for trouble shooting - if test "$debug" = "1"; then - cat $WORK/md5sum | @SED@ -e 's/^/# md5: /' - echo "#" - - test -f $WORK/cmdlog && cat $WORK/cmdlog && echo "#" - fi - - # list tarballs + patches - test -f $WORK/tarlog && cat $WORK/tarlog && echo "#" - test -f $WORK/patchlog && cat $WORK/patchlog -)|( - if test "$outfile" != ""; then - cat > "$outfile" - else - cat - fi -) -### Local Variables: -### mode: shell-script -### End: -# vim:filetype=sh |