diff options
-rw-r--r-- | quilt.changes | 1 | ||||
-rw-r--r-- | quilt/scripts/inspect.in | 41 |
2 files changed, 20 insertions, 22 deletions
diff --git a/quilt.changes b/quilt.changes index af93d89..ff8a8c6 100644 --- a/quilt.changes +++ b/quilt.changes @@ -7,6 +7,7 @@ Thu Oct 25 15:05:42 CEST 2012 - jdelvare@suse.de - setup/inspect: Handle zip archives. - setup: Fix white space handling by check_for_existing_files. - setup: Check for existing directories before unpacking. +- inspect: Refactor code to pwd_to_dir. ------------------------------------------------------------------- Thu Oct 25 15:05:10 CEST 2012 - jdelvare@suse.de diff --git a/quilt/scripts/inspect.in b/quilt/scripts/inspect.in index 172e418..e8eff26 100644 --- a/quilt/scripts/inspect.in +++ b/quilt/scripts/inspect.in @@ -274,6 +274,22 @@ cat <<-'EOF' > $tmpdir/bin/wrapper esac } + pwd_to_dir() { + local subdir=$1 dir + + if [ -n "$subdir" ] + then + dir=$(cd "$subdir" && echo $PWD) + else + dir=$PWD + fi + dir=${dir/$RPM_BUILD_DIR} + dir=${dir##/} + dir=${dir// /\\ } + + echo "$dir" + } + tmpdir=${RPM_BUILD_DIR%/*} rm -f $tmpdir/data case "${0##*/}" in @@ -301,38 +317,19 @@ cat <<-'EOF' > $tmpdir/bin/wrapper patch) echo -n p >&4 subdir=$(patch_opt_d "$@") - if [ -n "$subdir" ] - then - dir=$(cd "$subdir" && echo $PWD) - else - dir=$PWD - fi - dir=${dir/$RPM_BUILD_DIR} - dir=${dir##/} - dir=${dir// /\\ } + dir=$(pwd_to_dir $subdir) echo "${0##*/} ${dir:-.} $unpackfile" \ $(strip_option "$@") $(reverse_option "$@") >&3 ;; tar) echo -n t >&4 subdir=$(tar_opt_C "$@") - if [ -n "$subdir" ] - then - dir=$(cd "$subdir" && echo $PWD) - else - dir=$PWD - fi - dir=${dir/$RPM_BUILD_DIR} - dir=${dir##/} - dir=${dir// /\\ } + dir=$(pwd_to_dir $subdir) echo "${0##*/} ${dir:-.} $unpackfile" >&3 ;; unzip) echo -n Z >&4 - dir=$PWD - dir=${dir/$RPM_BUILD_DIR} - dir=${dir##/} - dir=${dir// /\\ } + dir=$(pwd_to_dir) echo "${0##*/} ${dir:-.} $unpackfile" >&3 ;; esac |