diff options
Diffstat (limited to 'quilt/scripts/patchfns.in')
-rw-r--r-- | quilt/scripts/patchfns.in | 67 |
1 files changed, 17 insertions, 50 deletions
diff --git a/quilt/scripts/patchfns.in b/quilt/scripts/patchfns.in index e1fc237..d0c426e 100644 --- a/quilt/scripts/patchfns.in +++ b/quilt/scripts/patchfns.in @@ -41,6 +41,8 @@ if [ -n "$QUILT_COMMAND" ]; then unset args fi +. $QUILT_DIR/scripts/utilfns + # ======================================================== declare -a exit_handlers @@ -86,42 +88,6 @@ quote_re() echo "$1" | sed -e 's:\([][?{(|)}^$/.+*\\]\):\\\1:g' } -basename() -{ - local path=$1 - while [ "${path:(-1)}" = "/" ] - do - path=${path%/} - done - echo "${path##*/}" -} - -dirname() -{ - local path=$1 - while [ "${path:(-1)}" = "/" ] - do - path=${path%/} - done - local basename="${path##*/}" - path="${path:0:${#path}-${#basename}}" - while [ "${path:(-1)}" = "/" ] - do - path=${path%/} - done - if [ -n "$path" ] - then - echo "$path" - else - if [ ${1:0:1} = "/" ] - then - echo "/" - else - echo "." - fi - fi -} - patch_file_name() { echo "$QUILT_PATCHES/$1" @@ -641,10 +607,21 @@ find_patch_file() { local name="$1" - if [ -r "$name" ] + if [ ${name:0:1} = / ] then - echo "$name" - return + # Patch has absolute path + if [ -r "$name" ] + then + echo "$name" + return + fi + else + # Patch has a relative path + if [ -r "$SUBDIR$name" ] + then + echo "$SUBDIR$name" + return + fi fi local patch @@ -870,16 +847,6 @@ in_array() return 1 } -gen_tempfile() -{ - if [ "$1" = -d ] - then - mktemp -d ${2:-${TMPDIR:-/tmp}/quilt.}XXXXXX - else - mktemp ${1:-${TMPDIR:-/tmp}/quilt.}XXXXXX - fi -} - first_modified_by() { local file=$1 patch @@ -914,7 +881,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 |