quilt-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Quilt-dev] quilt & bash3


From: Dirk Jagdmann
Subject: Re: [Quilt-dev] quilt & bash3
Date: Mon, 24 Jan 2005 20:36:52 +0100
User-agent: Mozilla Thunderbird 1.0 (X11/20041206)

Are you using the current CVS version? Could you please run the command
with the --trace=verbose option, and post the stderr output, e.g.,
  quilt --trace=verbose refresh 2>log

Just installed the CVS version, but the error remains. I have attached the verbose trace.

Was the bash package built with -DDONT_REPORT_SIGPIPE? You really want
that...

It was build with a plain "./configure". If it helps I could do that, but I would like to understand the error/message beforehand.

--
---> doj / cubic
----> http://cubic.org/~doj
-----> http://llg.cubic.org
. /usr/local/share/quilt/refresh
+ . /usr/local/share/quilt/refresh
#! /bin/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.

# Read in library functions
if [ "$(type -t patch_file_name)" != function ]
then
        if ! [ -r /usr/local/share/quilt/scripts/patchfns ]
        then
                echo "Cannot read library 
/usr/local/share/quilt/scripts/patchfns" >&2
                exit 1
        fi
        . /usr/local/share/quilt/scripts/patchfns
fi
type -t patch_file_name
+++ type -t patch_file_name
++ '[' '' '!=' function ']'
++ '[' -r /usr/local/share/quilt/scripts/patchfns ']'
++ . /usr/local/share/quilt/scripts/patchfns
# This file contains the common functions used in all quilt script
# It is meant to be sourced by bash scripts.

#  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.

export TEXTDOMAIN=quilt
+++ export TEXTDOMAIN=quilt
+++ TEXTDOMAIN=quilt
export TEXTDOMAINDIR=/usr/local/share/locale
+++ export TEXTDOMAINDIR=/usr/local/share/locale
+++ TEXTDOMAINDIR=/usr/local/share/locale

: ${LC_CTYPE:=$LANG}
+++ : address@hidden
: ${LC_MESSAGES:=$LANG}
+++ : en_US
ORIGINAL_LANG=$LANG
+++ ORIGINAL_LANG=
export LANG=POSIX
+++ export LANG=POSIX
+++ LANG=POSIX

export QUILT_PATCHES QUILT_PC SUBDIR SERIES DB
+++ export QUILT_PATCHES QUILT_PC SUBDIR SERIES DB
DB_VERSION=2
+++ DB_VERSION=2

: ${QUILT_PATCHES:=patches}
+++ : patches
: ${QUILT_PC:=.pc}
+++ : .pc

unset CDPATH
+++ unset CDPATH
shopt -s dotglob
+++ shopt -s dotglob

if [ -e "$QUILTRC" ]
then
        source "$QUILTRC"
fi
+++ '[' -e /etc/quilt.quiltrc ']'

# Add default arguments for this command
if [ -n "$QUILT_COMMAND" ]; then
        args="QUILT_$(echo $QUILT_COMMAND | tr a-z A-Z)_ARGS"
        eval set -- ${!args} \"address@hidden"
        unset args
fi
+++ '[' -n refresh ']'
echo $QUILT_COMMAND | tr a-z A-Z
++++ echo refresh
++++ tr a-z A-Z
+++ args=QUILT_REFRESH_ARGS
+++ eval set -- '"$@"'
set -- "$@"
++++ set --
+++ unset args

# ========================================================

#declare -a exit_handlers
#
#add_exit_handler() {
#       address@hidden
#}
#
#remove_exit_handler() {
#       declare -a handlers
#       local h
#       for h in "address@hidden"; do
#               [ "$h" = "$1" ] && continue
#               address@hidden
#       done
#       exit_handlers=( "address@hidden" )
#}
#
#run_exit_handlers() {
#       local h
#       for h in "address@hidden"; do
#               eval $h
#       done
#}
#
#trap run_exit_handlers EXIT

# ========================================================

# Quote a string for use in a basic regular expression.
quote_bre()
{
        echo "$1" | sed -e 's:\([][^$/.*\\]\):\\\1:g'
}

# Quote a string for use in an extended regular expression.
quote_re()
{
        echo "$1" | sed -e 's:\([][?{(|)}^$/.+*\\]\):\\\1:g'
}

basename()
{
        local path="${1//\/\//}"
        path="${path%%/}"
        echo "${path##*/}"
}

dirname()
{
        local path="${1//\/\//}"
        path="${path%%/}"
        local basename="${path##*/}"
        path="${path:0:${#path}-${#basename}}"
        [ x"$path" != x"/" ] && path="${path%/}"
        echo "${path:-.}"
}

patch_file_name()
{
        echo "$QUILT_PATCHES/$1"
}

# The -pN option and possibly others that should be passed to patch.
patch_args()
{
        local patch=$1

        if [ -e $SERIES ]
        then
                /usr/local/bin/gawk '
                $1 == "'"$patch"'" \
                        { if (NF >= 2)
                                for (i=2; i <= NF; i++)
                                        print $i
                          else
                                print "-p1" ;
                          exit
                        }
                ' $SERIES
        fi
}

patch_strip_level()
{
        local patch=$1 i
        for i in $(patch_args $patch)
        do
                case $i in
                -p)
                        echo $2
                        return ;;
                -p*)
                        echo ${i:2}
                        return ;;
                esac
        done
        echo "1"
}

change_db_strip_level()
{
        local level=$1 patch=$2

        if [ x$level != x-p1 ]
        then
                level="$level"
        else
                level=""
        fi

        if [ -e $SERIES ]
        then
                local tmpfile=$(gen_tempfile)
                /usr/local/bin/gawk '
                /^'"$(quote_re $patch)"'([ \t]|$)/ \
                        { for(i=2; i<=NF; i++)
                                if ($i ~ /^-p/) {
                                        $i="'"$level"'"
                                        break
                                }
                          if (i > NF && "'"$level"'" != "")
                                 $i="'"$level"'"
                        }
                        { print }
                ' $SERIES > $tmpfile
                if ! cmp $SERIES $tmpfile >/dev/null 2>/dev/null
                then
                        cat $tmpfile > $SERIES
                fi
                rm -f $tmpfile
        else
                return 1
        fi
}

patch_in_series()
{
        local patch=$1

        if ! [ -e $SERIES ]
        then
                return 1
        else
                grep -q -E "^$(quote_re $patch)([ \t]|$)" $SERIES
        fi
}

# Insert new patch after topmost patch
insert_in_series()
{
        local patch=$1 patch_args=$2
        local top=$(top_patch) tmpfile

        if [ -n "$patch_args" ]
        then
                patch_args=" $patch_args"
        fi

        tmpfile=$(gen_tempfile) || return 1
        mkdir -p $(dirname $SERIES)
        if [ -n "$top" ]
        then
                /usr/local/bin/gawk '
                                { print }
                /^'"$(quote_re $top)"'([ \t]|$)/ \
                                { print "'"$patch$patch_args"'" }
                ' $SERIES > $tmpfile
                status=$?
                if [ $status -ne 0 ]
                then
                        rm -f $tmpfile
                        return 1
                fi
        else
                echo "$patch$patch_args" > $tmpfile
                if [ -e $SERIES ]
                then
                        cat $SERIES >> $tmpfile
                fi
        fi
        cat $tmpfile > $SERIES
        rm -f $tmpfile
}

remove_from_series()
{
        local patch=$1

        tmpfile=$(gen_tempfile) || return 1
        /usr/local/bin/gawk '
        ! /^'"$(quote_re $patch)"'([ \t]|$)/ \
                                { print }
        ' $SERIES > $tmpfile
        if [ $? -ne 0 ]
        then
                rm -f $tmpfile
                return 1
        fi
        cat $tmpfile > $SERIES
        rm -f $tmpfile
}

rename_in_series()
{
        local from=$1 to=$2

        tmpfile=$(gen_tempfile) || return 1
        /usr/local/bin/gawk '
        /^'"$(quote_re $from)"'([ \t]|$)/ \
                { sub(/'"$(quote_re $from)"'/, "'"${to//\"/\\\"}"'")
                  good=1 }
                { print }
        END     { exit(! good) }
        ' $SERIES > $tmpfile
        if [ $? -ne 0 ]
        then
                rm -f $tmpfile
                return 1
        fi
        cat $tmpfile > $SERIES
        rm -f $tmpfile
}

rename_in_db()
{
        local from=$1 to=$2
        local tmpfile
        tmpfile=$(gen_tempfile) || return 1
        /usr/local/bin/gawk '
        /^'"$(quote_re $from)"'$/ \
                { sub(/'"$(quote_re $from)"'/, "'"${to//\"/\\\"}"'")
                  good=1 }
                { print }
        END     { exit(! good) }
        ' $DB > $tmpfile
        if [ $? -eq 0 ]
        then
                mv -f $tmpfile $DB
        else
                rm -f $tmpfile
                return 1
        fi
}

backup_file_name()
{
        local patch=$1
        while [ $# -gt 1 ]
        do
                echo "$QUILT_PC/$patch/$2"
                shift
        done
}

cat_series()
{
        if [ -e $SERIES ]
        then
                sed -e '/^$/d' -e '/^#/d' -e 's/^[ '$'\t'']*//' \
                      -e 's/[ '$'\t''].*//' $SERIES
        else
                return 1
        fi
}

top_patch()
{
        [ -e $DB ] && tail -n 1 $DB
}

is_numeric()
{
        echo $1 | grep -q '^[0-9]*$'
}

is_applied_last()
{
        local patch=$1
        [ "$(top_patch)" == $patch ]
}

is_applied()
{
        local patch=$1
        [ -e $DB ] || return 1
        grep -q -E "^$(quote_re $patch)\$" $DB
}

applied_patches()
{
        [ -e $DB ] || return 1
        cat $DB
}

applied_before()
{
        local patch=$1

        if [ -n "$patch" ]
        then
                /usr/local/bin/gawk '
                $0 == "'"$patch"'"      { exit }
                                        { print }
                ' $DB
        fi
}
                
patches_before()
{
        local patch=$1

        if [ -n "$patch" ]
        then
                cat_series \
                | /usr/local/bin/gawk '
                $0 == "'"$patch"'"      { exit }
                                        { print }
                '
        fi
}

patches_after()
{
        local patch=$1
        if [ -n "$patch" ]
        then
                cat_series \
                | /usr/local/bin/gawk '
                seen                    { print }
                $0 == "'"$patch"'"      { seen=1 }
                '
        else
                cat_series
        fi
}

# List all patches that have been applied on top of patch $1
patches_on_top_of()
{
        local patch=$1
        [ -e $DB ] || return
        /usr/local/bin/gawk '
        $0 == "'"$patch"'"      { seen=1 ; next }
        seen                    { print }
        ' $DB
}

# Print the name of the patch that modified the file $2 next after
# patch $1, or print nothing if patch $1 is on top.
next_patch_for_file()
{
        local patch=$1 file=$2
        local patches_on_top=$(patches_on_top_of $patch)

        if [ -n "$patches_on_top" ]
        then
                for patch in $patches_on_top
                do
                        if [ -f $(backup_file_name $patch $file) ]
                        then
                                echo $patch
                                break
                        fi
                done
        fi
}

add_to_db()
{
        echo $1 >> $DB
}

remove_from_db()
{
        local patch=$1
        local tmpfile
        if tmpfile=$(gen_tempfile)
        then
                grep -v -E "^$(quote_re $patch)\$" $DB > $tmpfile
                mv -f $tmpfile $DB
                rm -f $tmpfile
                [ -s $DB ] || rm -f $DB
        fi
}

find_patch()
{
        set -- $*
        if [ $# -eq 1 -a -n "$1" -a -e "$SERIES" ]
        then
                local patch="${1#$SUBDIR_DOWN$QUILT_PATCHES/}"
                local bre=$(quote_bre "$patch")
                set -- $(sed -e 
"/^$bre\(\|\.patch\|\.diff\?\)\(\|\.gz\|\.bz2\)\([ "$'\t'"]\|$\)/!d" \
                               -e 's/[ '$'\t''].*//' $SERIES)
                if [ $# -eq 1 ]
                then
                        echo $1
                        return 0
                else
                        # We may have an exact match, which overrides
                        # extension expansion
                        while [ $# -gt 0 ]
                        do
                                if [ $1 = "$patch" ]
                                then
                                        echo $1
                                        return 0
                                fi
                                shift
                        done
                fi
        fi
        return 1
}

file_in_patch()
{
        local file=$1 patch=$2
        [ -f "$QUILT_PC/$patch/$file" ]
}

files_in_patch()
{
        local patch="$1"
        local path="$QUILT_PC/$patch"
        if [ -d "$path" ]
        then
                for file in $(find "$path" -type f \
                                   -a ! -path "$path/.timestamp")
                do
                        echo "${file:${#path}+1}"
                done
        fi
}

filenames_in_patch()
{
        local patch=$1
        local patch_file=$(patch_file_name $patch)
        if [ -e "$patch_file" ]
        then
                local strip=$(patch_strip_level $patch)
                /usr/local/bin/gawk '
                ($1 == "+++" || $1 == "---" || $1 == "***") && \
                $3 != "----" && $3 != "****" \
                        { sub(/\t.*/, "")
                          sub(/^... /, "")
                          for (n=0 ; n<'"$strip"'; n++)
                              sub(/^([^/]+\/)/, "")
                          print $0 }' $patch_file
        fi
}

files_in_patch_ordered()
{
        local patch=$1

        (   files_in_patch $patch
            echo "-"
            filenames_in_patch $patch
        ) | /usr/local/bin/gawk '
        $1 == "-" { out=1 ; next }
        !out    { files[$0]=1 }
        out     { if ($0 in files && !($0 in printed)) {
                    print $0
                    printed[$0]=1
                  }
                }
        END     {
                  for (file in files) {
                    if (!(file in printed))
                      print file
                  }
                }
        '
}

touched_by_patch()
{
        local strip=$1 patch=$2
        cat_file $(patch_file_name $patch) \
        |  /usr/local/bin/gawk '
        /^\+\+\+[ \t]/ {
                sub(/^\+\+\+[ \t]/, "")
                sub(/[ \t].*/, "")
                sub(/^\/dev\/null/, "")
                for (i=0; i<'$strip'; i++)
                        sub(/^[^\/]*\//, "")
                print
        }'
}

diff_file()
{
        local file=$1 old_file=$2 new_file=$3
        local index old_hdr old_date new_hdr new_date line

        : ${opt_strip_level:=1}
        if [ $opt_strip_level -eq 0 ]
        then
                old_hdr=$file.orig
                new_hdr=$file
        else
                local dir=$(basename $PWD)
                old_hdr=$dir.orig/$file
                new_hdr=$dir/$file
        fi
        index=$new_hdr
        
        if ! [ -s "$old_file" ]
        then
                old_file=/dev/null
                old_hdr=/dev/null
                [ -n "$QUILT_NO_DIFF_TIMESTAMPS" ] \
                || old_date=$'\t'"1970-01-01 00:00:00.000000000 +0000"
        else
                [ -n "$QUILT_NO_DIFF_TIMESTAMPS" ] \
                || old_date=$'\t'$(date +'%Y-%m-%d %H:%M:%S.%N %z' \
                                        -r "$old_file")
        fi
        if ! [ -s "$new_file" ]
        then
                new_file=/dev/null
                new_hdr=/dev/null
                [ -n "$QUILT_NO_DIFF_TIMESTAMPS" ] \
                || new_date=$'\t'"1970-01-01 00:00:00.000000000 +0000"
        else
                [ -n "$QUILT_NO_DIFF_TIMESTAMPS" ] \
                || new_date=$'\t'$(date +'%Y-%m-%d %H:%M:%S.%N %z' \
                                        -r "$new_file")
        fi

        /usr/bin/diff -N $QUILT_DIFF_OPTS $old_file $new_file \
               --label "$old_hdr$old_date" --label "$new_hdr$new_date" \
        | if read line
        then
                echo "Index: $index"
                echo 
"==================================================================="
                echo "$line"
                cat
        fi
}

cat_file()
{
        local filename
        
        for filename in "$@"
        do
                if [ -e "$filename" ]
                then
                        case "$filename" in
                        *.gz|*.tgz)
                                gzip -cd "$filename" ;;
                        *.bz2)
                                bzip2 -cd "$filename" ;;
                        *)
                                cat "$filename" ;;
                        esac
                fi
        done
}

cat_to_file()
{
        local filename="$1"

        if [ -z "$filename" ]
        then
                cat
        else
                case "$filename" in
                *.gz|*.tgz)
                        gzip -c > "$filename" ;;
                *.bz2)
                        bzip2 -c > "$filename" ;;
                *)
                        cat > "$filename" ;;
                esac
        fi
}

patch_description()
{
        local patch_file=$1

        if [ -e "$patch_file" -o -z "$patch_file" ]
        then
                /usr/local/bin/gawk '
                $1 == "***" || $1 == "---"      { exit }
                /^Index:[ \t]|^diff[ \t]|^==*$|^RCS file: |^retrieving revision 
[0-9]+(\.[0-9]+)*$/ \
                        { eat = eat $0 "\n"
                          next }
                        { print eat $0
                          eat = "" }
                ' $patch_file
        fi
}

in_array()
{
        local a=$1
        while [ $# -gt 1 ]
        do
                shift
                [ "$a" = "$1" ] && return 0
        done
        return 1
}

gen_tempfile()
{
        # This is a substitute for the mktemp executable.
        internal_mktemp()
        {
                local try n
                if [ x"$1" = x"-d" ]
                then
                        for ((n=0 ; $n<100 ; n++))
                        do
                                try=${2%XXXXXX}$RANDOM
                                mkdir -m 700 $try 2>/dev/null \
                                && break
                        done
                else
                        local user_mask=$(umask)
                        umask 077
                        set -o noclobber
                        for ((n=0 ; $n<100 ; n++))
                        do
                                try=${1%XXXXXX}$RANDOM
                                echo -n "" 2> /dev/null > $try \
                                && break
                        done
                        set +o noclobber
                        umask $user_mask
                fi
                if [ $n -lt 100 ]
                then
                        echo $try
                else
                        return 1
                fi
        }

        local name
        if [ "$1" = -d ]
        then
                /bin/mktemp -d ${2:-${TMPDIR:-/tmp}/quilt}.XXXXXX
        else
                /bin/mktemp ${1:-${TMPDIR:-/tmp}/quilt}.XXXXXX
        fi
#       if [ "$1" = -d ]
#       then
#               name=$(/bin/mktemp -d ${2:-${TMPDIR:-/tmp}/quilt}.XXXXXX)
#               add_exit_handler "rm -rf $name"
#       else
#               name=$(/bin/mktemp ${1:-${TMPDIR:-/tmp}/quilt}.XXXXXX)
#               add_exit_handler "rm -f $name"
#       fi
#       echo "$name"
}

#keep_tempfile()
#{
#       if [ "$1" = -d ]; then
#               remove_exit_handler "rm -rf $2"
#       else
#               remove_exit_handler "rm -f $1"
#       fi
#}

first_modified_by()
{
        local file=$1 patch
        local -a patches
        if [ $# -eq 0 ]
        then
                patches=( $(applied_patches) )
        else
                shift
                patches=( "$@" )
        fi
        for patch in address@hidden
        do
                if [ -f "$QUILT_PC/$patch/$file" ]
                then
                        echo $patch
                        return 0
                fi
        done
        return 1
}

create_db() {
        if ! [ -e $QUILT_PC ]
        then
                mkdir -p $QUILT_PC
                echo $DB_VERSION > $QUILT_PC/.version
        fi
}

version_check() {
        [ -e $QUILT_PC ] || return 0

        if [ -e $QUILT_PC/.version ]
        then
                version="$(< $QUILT_PC/.version)"
                if [ "$version" -gt $DB_VERSION ]
                then
                        printf $"The quilt meta-data in this tree has version 
%s, but this version of quilt can only handle meta-data formats up to and 
including version %s. Please pop all the patches using the version of quilt 
used to push them before downgrading.\n" "$version" "$DB_VERSION" >&2
                        exit 1
                elif [ "$version" = $DB_VERSION ]
                then
                        return 0
                fi
        fi
        return 1
}

print_patch() {
        echo -n "${QUILT_PATCHES_PREFIX:+$SUBDIR_DOWN$QUILT_PATCHES/}$1"
}

setup_colors()
{
        local 
C=${QUILT_COLORS:-diff_hdr=32:diff_add=36:diff_mod=35:diff_rem=35:diff_hunk=33:diff_ctx=35:diff_cctx=33:patch_offs=33:patch_fuzz=35:patch_fail=31}:clear=00

        C=${C//=/=\'$'\e'[}
        C=color_${C//:/m\'; color_}m\'
        eval $C
}

#
# If the working directory does not contain a $QUILT_PATCHES directory,
# quilt searches for its base directory up the directory tree. If no
# $QUILT_PATCHES directory exists, the quilt operations that create
# patches will create $QUILT_PATCHES in the current working directory.
#
# When quilt is invoked from a directory below the base directory, it
# changes into the base directory, and sets $SUBDIR to the relative
# path from the base directory to the directory in which it was
# invoked. (e.g., if quilt is invoked in /usr/src/linux/drivers/net
# and the base direcory is /usr/src/linux, $SUBDIR is set to
# drivers/net/.

unset SUBDIR SUBDIR_DOWN
+++ unset SUBDIR SUBDIR_DOWN
if ! [ -d "$QUILT_PATCHES" ]
then
    basedir=$PWD
    while [ -n "$basedir" ]
    do
        basedir=${basedir%/*}
        down=$down../
        if [ -d "$basedir/$QUILT_PATCHES" ]
        then
            SUBDIR="${PWD#$basedir/}/"
            SUBDIR_DOWN=$down
            if ! cd $basedir/
            then
                echo "Cannot change into parent directory $basedir/" >&2
                exit 1
            fi
            break
        fi
    done
    unset basedir down
fi
+++ '[' -d patches ']'

if [ -n "$QUILT_SERIES" ]
then
        SERIES=$QUILT_SERIES
elif [ -e $QUILT_PC/series ]
then
        SERIES=$QUILT_PC/series
elif [ -e series ]
then
        SERIES=series
else
        SERIES=$QUILT_PATCHES/series
fi
+++ '[' -n '' ']'
+++ '[' -e .pc/series ']'
+++ '[' -e series ']'
+++ SERIES=patches/series

DB="$QUILT_PC/applied-patches"
+++ DB=.pc/applied-patches

if [ -z "$skip_version_check" ] && ! version_check
then
        printf $"The working tree was created by an older version of quilt. 
Please run 'quilt upgrade'.\n" >&2
        exit 1
fi
+++ '[' -z '' ']'
+++ version_check
+++ '[' -e .pc ']'
+++ '[' -e .pc/.version ']'
< $QUILT_PC/.version
+++ version=2
+++ '[' 2 -gt 2 ']'
+++ '[' 2 = 2 ']'
+++ return 0
### Local Variables:
### mode: shell-script
### End:
# vim:filetype=sh

usage()
{
        printf $"Usage: quilt refresh [-p n] [-f] [--no-timestamps] 
[--diffstat] [--backup] [patch]\n"
        
        if [ x$1 = x-h ]
        then
                printf $"
Refreshes the specified patch, or the topmost patch by default.
Documentation that comes before the actual patch in the patch file is
retained.

It is possible to refresh patches that are not on top.  If any patches
on top of the patch to refresh modify the same files, the script aborts
by default.  Patches can still be refreshed with -f.  In that case this
script will print a warning for each shadowed file, changes by more
recent patches will be ignored, and only changes in files that have not
been modified by any more recent patches will end up in the specified
patch.

-p n    Create a -p n style patch (-p0 or -p1 supported).

-u, -U num, -c, -C num
        Create a unified diff (-u, -U) with num lines of context. Create
        a context diff (-c, -C) with num lines of context. The number of
        context lines defaults to 3.

--no-timestamps
        Do not include file timestamps in patch headers.
        
--diffstat
        Add a diffstat section to the patch header, or replace the
        existing diffstat section.

-f      Enforce refreshing of a patch that is not on top.

--backup
        Create a backup copy of the old version of a patch as patch~.
"
                exit 0
        else
                exit 1
        fi
}

die ()
{
        local status=$1
        [ -n "$tmp_patch" ] && rm -f $tmp_patch
        [ -n "$tmp_header" ] && rm -f $tmp_header
        [ -n "$tmp_result" ] && rm -f $tmp_result
        exit $status
}

options=`getopt -o p:uU:cC:fh --long no-timestamps,diffstat,backup -- "$@"`
getopt -o p:uU:cC:fh --long no-timestamps,diffstat,backup -- "$@"
+++ getopt -o p:uU:cC:fh --long no-timestamps,diffstat,backup --
++ options=' --'

if [ $? -ne 0 ]
then
        usage
fi
++ '[' 0 -ne 0 ']'

eval set -- "$options"
++ eval set -- ' --'
set --  --
+++ set -- --

opt_format=-u
++ opt_format=-u
while true
do
        case "$1" in
        -p)
                opt_strip_level=$2
                shift 2 ;;
        -f)
                opt_force=1
                shift ;;
        -u|-c)
                opt_format=$1
                shift ;;
        -U|-C)
                opt_format="$1 $2"
                shift 2 ;;
        -h)
                usage -h ;;
        --no-timestamps)
                QUILT_NO_DIFF_TIMESTAMPS=1
                shift ;;
        --diffstat)
                opt_diffstat=1
                shift ;;
        --backup)
                QUILT_BACKUP=1
                shift ;;
        --)
                shift
                break ;;
        esac
done
++ true
++ case "$1" in
++ shift
++ break

if [ $# -eq 1 ]
then
        opt_patch=$1
elif [ $# -gt 1 ]
then
        usage
fi
++ '[' 0 -eq 1 ']'
++ '[' 0 -gt 1 ']'

QUILT_DIFF_OPTS="$QUILT_DIFF_OPTS $opt_format"
++ QUILT_DIFF_OPTS=' -u'

if [ -n "$opt_patch" ]
then
        if ! patch=$(find_patch $opt_patch)
        then
                printf $"Patch %s is not in series\n" \
                       "$(print_patch $opt_patch)" >&2
                exit 1
        fi
        if ! is_applied "$patch"
        then
                printf $"Patch %s is not applied\n" \
                       "$(print_patch $patch)" >&2
                exit 1
        fi
else
        patch=$(top_patch)
        if [ -z "$patch" ]
        then
                printf $"No patches applied\n" >&2
                exit 1
        fi
fi
++ '[' -n '' ']'
top_patch
+++ top_patch
+++ '[' -e .pc/applied-patches ']'
+++ tail -n 1 .pc/applied-patches
++ patch=https-streaming.patch
++ '[' -z https-streaming.patch ']'

if [ -z "$opt_strip_level" ]
then
        opt_strip_level=$(patch_strip_level $patch)
fi
++ '[' -z '' ']'
patch_strip_level $patch
+++ patch_strip_level https-streaming.patch
+++ local patch=https-streaming.patch i
patch_args $patch
++++ patch_args https-streaming.patch
++++ local patch=https-streaming.patch
++++ '[' -e patches/series ']'
++++ /usr/local/bin/gawk '
                $1 == "https-streaming.patch" \
                        { if (NF >= 2)
                                for (i=2; i <= NF; i++)
                                        print $i
                          else
                                print "-p1" ;
                          exit
                        }
                ' patches/series
+++ for i in '$(patch_args $patch)'
+++ case $i in
+++ echo 1
+++ return
++ opt_strip_level=1
if [ $opt_strip_level -gt 1 ]
then
        printf $"Cannot refresh patches with -p%s, please specify -p0 or -p1 
instead\n" "$opt_strip_level\n" >&2
        exit 1
fi
++ '[' 1 -gt 1 ']'

trap "die 1" SIGTERM
++ trap 'die 1' SIGTERM

tmp_patch=$(gen_tempfile)
gen_tempfile
+++ gen_tempfile
+++ local name
+++ '[' '' = -d ']'
+++ /bin/mktemp /tmp/quilt.XXXXXX
++ tmp_patch=/tmp/quilt.ly7224

for file in $(files_in_patch_ordered $patch)
do
        old_file=$(backup_file_name $patch $file)
        next_patch=$(next_patch_for_file $patch $file)
        if [ -z "$next_patch" ]
        then
                new_file=$file
        else
                new_file=$(backup_file_name $next_patch $file)
                files_were_shadowed=1
        fi
        if ! diff_file $file $old_file $new_file >> $tmp_patch
        then
                printf $"Diff failed, aborting\n" >&2
                die 1
        fi

        if [ -n "$files_were_shadowed" -a -z "$opt_force" ]
        then
                printf $"More recent patches modify files in patch %s. Enforce 
refresh with -f.\n" "$(print_patch $patch)" >&2
                die 1
        fi
done
files_in_patch_ordered $patch
+++ files_in_patch_ordered https-streaming.patch
+++ local patch=https-streaming.patch
+++ files_in_patch https-streaming.patch
+++ local patch=https-streaming.patch
+++ local path=.pc/https-streaming.patch
+++ '[' -d .pc/https-streaming.patch ']'
+++ /usr/local/bin/gawk '
        $1 == "-" { out=1 ; next }
        !out    { files[$0]=1 }
        out     { if ($0 in files && !($0 in printed)) {
                    print $0
                    printed[$0]=1
                  }
                }
        END     {
                  for (file in files) {
                    if (!(file in printed))
                      print file
                  }
                }
        '
find "$path" -type f                               -a ! -path "$path/.timestamp"
++++ find .pc/https-streaming.patch -type f -a '!' -path 
.pc/https-streaming.patch/.timestamp
+++ for file in '$(find "$path" -type f                                    -a ! 
-path "$path/.timestamp")'
+++ echo Input/mpg123/common.c
+++ for file in '$(find "$path" -type f                                    -a ! 
-path "$path/.timestamp")'
+++ echo Input/mpg123/http.c
+++ for file in '$(find "$path" -type f                                    -a ! 
-path "$path/.timestamp")'
+++ echo Input/mpg123/mpg123.c
+++ for file in '$(find "$path" -type f                                    -a ! 
-path "$path/.timestamp")'
+++ echo configure.in
+++ echo -
+++ filenames_in_patch https-streaming.patch
+++ local patch=https-streaming.patch
patch_file_name $patch
++++ patch_file_name https-streaming.patch
++++ echo patches/https-streaming.patch
+++ local patch_file=patches/https-streaming.patch
+++ '[' -e patches/https-streaming.patch ']'
patch_strip_level $patch
++++ patch_strip_level https-streaming.patch
++++ local patch=https-streaming.patch i
patch_args $patch
+++++ patch_args https-streaming.patch
+++++ local patch=https-streaming.patch
+++++ '[' -e patches/series ']'
+++++ /usr/local/bin/gawk '
                $1 == "https-streaming.patch" \
                        { if (NF >= 2)
                                for (i=2; i <= NF; i++)
                                        print $i
                          else
                                print "-p1" ;
                          exit
                        }
                ' patches/series
++++ for i in '$(patch_args $patch)'
++++ case $i in
++++ echo 1
++++ return
+++ local strip=1
+++ /usr/local/bin/gawk '
                ($1 == "+++" || $1 == "---" || $1 == "***") && \
                $3 != "----" && $3 != "****" \
                        { sub(/\t.*/, "")
                          sub(/^... /, "")
                          for (n=0 ; n<1; n++)
                              sub(/^([^/]+\/)/, "")
                          print $0 }' patches/https-streaming.patch
++ for file in '$(files_in_patch_ordered $patch)'
backup_file_name $patch $file
+++ backup_file_name https-streaming.patch Input/mpg123/common.c
+++ local patch=https-streaming.patch
+++ '[' 2 -gt 1 ']'
+++ echo .pc/https-streaming.patch/Input/mpg123/common.c
+++ shift
+++ '[' 1 -gt 1 ']'
++ old_file=.pc/https-streaming.patch/Input/mpg123/common.c
next_patch_for_file $patch $file
+++ next_patch_for_file https-streaming.patch Input/mpg123/common.c
+++ local patch=https-streaming.patch file=Input/mpg123/common.c
patches_on_top_of $patch
++++ patches_on_top_of https-streaming.patch
++++ local patch=https-streaming.patch
++++ '[' -e .pc/applied-patches ']'
++++ /usr/local/bin/gawk '
        $0 == "https-streaming.patch"   { seen=1 ; next }
        seen                    { print }
        ' .pc/applied-patches
+++ local patches_on_top=
+++ '[' -n '' ']'
++ next_patch=
++ '[' -z '' ']'
++ new_file=Input/mpg123/common.c
++ diff_file Input/mpg123/common.c 
.pc/https-streaming.patch/Input/mpg123/common.c Input/mpg123/common.c
++ local file=Input/mpg123/common.c 
old_file=.pc/https-streaming.patch/Input/mpg123/common.c 
new_file=Input/mpg123/common.c
++ local index old_hdr old_date new_hdr new_date line
++ : 1
++ '[' 1 -eq 0 ']'
basename $PWD
+++ basename /usr/local/src/patcharea/xmms-1.2.10
+++ local path=/usr/local/src/patcharea/xmms-1.2.10
+++ path=/usr/local/src/patcharea/xmms-1.2.10
+++ echo xmms-1.2.10
++ local dir=xmms-1.2.10
++ old_hdr=xmms-1.2.10.orig/Input/mpg123/common.c
++ new_hdr=xmms-1.2.10/Input/mpg123/common.c
++ index=xmms-1.2.10/Input/mpg123/common.c
++ '[' -s .pc/https-streaming.patch/Input/mpg123/common.c ']'
++ '[' -n '' ']'
date +'%Y-%m-%d %H:%M:%S.%N %z'                                         -r 
"$old_file"
+++ date '+%Y-%m-%d %H:%M:%S.%N %z' -r 
.pc/https-streaming.patch/Input/mpg123/common.c
++ old_date='   2005-01-24 14:05:50.000000000 +0100'
++ '[' -s Input/mpg123/common.c ']'
++ '[' -n '' ']'
date +'%Y-%m-%d %H:%M:%S.%N %z'                                         -r 
"$new_file"
+++ date '+%Y-%m-%d %H:%M:%S.%N %z' -r Input/mpg123/common.c
++ new_date='   2005-01-24 14:06:07.000000000 +0100'
++ /usr/bin/diff -N -u .pc/https-streaming.patch/Input/mpg123/common.c 
Input/mpg123/common.c --label 'xmms-1.2.10.orig/Input/mpg123/common.c    
2005-01-24 14:05:50.000000000 +0100' --label 'xmms-1.2.10/Input/mpg123/common.c 
2005-01-24 14:06:07.000000000 +0100'
++ read line
++ echo 'Index: xmms-1.2.10/Input/mpg123/common.c'
++ echo ===================================================================
++ echo '--- xmms-1.2.10.orig/Input/mpg123/common.c     2005-01-24 
14:05:50.000000000 +0100'
++ cat
++ '[' -n '' -a -z '' ']'
++ for file in '$(files_in_patch_ordered $patch)'
backup_file_name $patch $file
+++ backup_file_name https-streaming.patch Input/mpg123/http.c
+++ local patch=https-streaming.patch
+++ '[' 2 -gt 1 ']'
+++ echo .pc/https-streaming.patch/Input/mpg123/http.c
+++ shift
+++ '[' 1 -gt 1 ']'
++ old_file=.pc/https-streaming.patch/Input/mpg123/http.c
next_patch_for_file $patch $file
+++ next_patch_for_file https-streaming.patch Input/mpg123/http.c
+++ local patch=https-streaming.patch file=Input/mpg123/http.c
patches_on_top_of $patch
++++ patches_on_top_of https-streaming.patch
++++ local patch=https-streaming.patch
++++ '[' -e .pc/applied-patches ']'
++++ /usr/local/bin/gawk '
        $0 == "https-streaming.patch"   { seen=1 ; next }
        seen                    { print }
        ' .pc/applied-patches
+++ local patches_on_top=
+++ '[' -n '' ']'
++ next_patch=
++ '[' -z '' ']'
++ new_file=Input/mpg123/http.c
++ diff_file Input/mpg123/http.c .pc/https-streaming.patch/Input/mpg123/http.c 
Input/mpg123/http.c
++ local file=Input/mpg123/http.c 
old_file=.pc/https-streaming.patch/Input/mpg123/http.c 
new_file=Input/mpg123/http.c
++ local index old_hdr old_date new_hdr new_date line
++ : 1
++ '[' 1 -eq 0 ']'
basename $PWD
+++ basename /usr/local/src/patcharea/xmms-1.2.10
+++ local path=/usr/local/src/patcharea/xmms-1.2.10
+++ path=/usr/local/src/patcharea/xmms-1.2.10
+++ echo xmms-1.2.10
++ local dir=xmms-1.2.10
++ old_hdr=xmms-1.2.10.orig/Input/mpg123/http.c
++ new_hdr=xmms-1.2.10/Input/mpg123/http.c
++ index=xmms-1.2.10/Input/mpg123/http.c
++ '[' -s .pc/https-streaming.patch/Input/mpg123/http.c ']'
++ '[' -n '' ']'
date +'%Y-%m-%d %H:%M:%S.%N %z'                                         -r 
"$old_file"
+++ date '+%Y-%m-%d %H:%M:%S.%N %z' -r 
.pc/https-streaming.patch/Input/mpg123/http.c
++ old_date='   2005-01-24 14:06:04.000000000 +0100'
++ '[' -s Input/mpg123/http.c ']'
++ '[' -n '' ']'
date +'%Y-%m-%d %H:%M:%S.%N %z'                                         -r 
"$new_file"
+++ date '+%Y-%m-%d %H:%M:%S.%N %z' -r Input/mpg123/http.c
++ new_date='   2005-01-24 14:06:07.000000000 +0100'
++ /usr/bin/diff -N -u .pc/https-streaming.patch/Input/mpg123/http.c 
Input/mpg123/http.c --label 'xmms-1.2.10.orig/Input/mpg123/http.c  2005-01-24 
14:06:04.000000000 +0100' --label 'xmms-1.2.10/Input/mpg123/http.c   2005-01-24 
14:06:07.000000000 +0100'
++ read line
++ echo 'Index: xmms-1.2.10/Input/mpg123/http.c'
++ echo ===================================================================
++ echo '--- xmms-1.2.10.orig/Input/mpg123/http.c       2005-01-24 
14:06:04.000000000 +0100'
++ cat
++ '[' -n '' -a -z '' ']'
++ for file in '$(files_in_patch_ordered $patch)'
backup_file_name $patch $file
+++ backup_file_name https-streaming.patch Input/mpg123/mpg123.c
+++ local patch=https-streaming.patch
+++ '[' 2 -gt 1 ']'
+++ echo .pc/https-streaming.patch/Input/mpg123/mpg123.c
+++ shift
+++ '[' 1 -gt 1 ']'
++ old_file=.pc/https-streaming.patch/Input/mpg123/mpg123.c
next_patch_for_file $patch $file
+++ next_patch_for_file https-streaming.patch Input/mpg123/mpg123.c
+++ local patch=https-streaming.patch file=Input/mpg123/mpg123.c
patches_on_top_of $patch
++++ patches_on_top_of https-streaming.patch
++++ local patch=https-streaming.patch
++++ '[' -e .pc/applied-patches ']'
++++ /usr/local/bin/gawk '
        $0 == "https-streaming.patch"   { seen=1 ; next }
        seen                    { print }
        ' .pc/applied-patches
+++ local patches_on_top=
+++ '[' -n '' ']'
++ next_patch=
++ '[' -z '' ']'
++ new_file=Input/mpg123/mpg123.c
++ diff_file Input/mpg123/mpg123.c 
.pc/https-streaming.patch/Input/mpg123/mpg123.c Input/mpg123/mpg123.c
++ local file=Input/mpg123/mpg123.c 
old_file=.pc/https-streaming.patch/Input/mpg123/mpg123.c 
new_file=Input/mpg123/mpg123.c
++ local index old_hdr old_date new_hdr new_date line
++ : 1
++ '[' 1 -eq 0 ']'
basename $PWD
+++ basename /usr/local/src/patcharea/xmms-1.2.10
+++ local path=/usr/local/src/patcharea/xmms-1.2.10
+++ path=/usr/local/src/patcharea/xmms-1.2.10
+++ echo xmms-1.2.10
++ local dir=xmms-1.2.10
++ old_hdr=xmms-1.2.10.orig/Input/mpg123/mpg123.c
++ new_hdr=xmms-1.2.10/Input/mpg123/mpg123.c
++ index=xmms-1.2.10/Input/mpg123/mpg123.c
++ '[' -s .pc/https-streaming.patch/Input/mpg123/mpg123.c ']'
++ '[' -n '' ']'
date +'%Y-%m-%d %H:%M:%S.%N %z'                                         -r 
"$old_file"
+++ date '+%Y-%m-%d %H:%M:%S.%N %z' -r 
.pc/https-streaming.patch/Input/mpg123/mpg123.c
++ old_date='   2005-01-24 14:05:59.000000000 +0100'
++ '[' -s Input/mpg123/mpg123.c ']'
++ '[' -n '' ']'
date +'%Y-%m-%d %H:%M:%S.%N %z'                                         -r 
"$new_file"
+++ date '+%Y-%m-%d %H:%M:%S.%N %z' -r Input/mpg123/mpg123.c
++ new_date='   2005-01-24 14:06:07.000000000 +0100'
++ /usr/bin/diff -N -u .pc/https-streaming.patch/Input/mpg123/mpg123.c 
Input/mpg123/mpg123.c --label 'xmms-1.2.10.orig/Input/mpg123/mpg123.c    
2005-01-24 14:05:59.000000000 +0100' --label 'xmms-1.2.10/Input/mpg123/mpg123.c 
2005-01-24 14:06:07.000000000 +0100'
++ read line
++ echo 'Index: xmms-1.2.10/Input/mpg123/mpg123.c'
++ echo ===================================================================
++ echo '--- xmms-1.2.10.orig/Input/mpg123/mpg123.c     2005-01-24 
14:05:59.000000000 +0100'
++ cat
++ '[' -n '' -a -z '' ']'
++ for file in '$(files_in_patch_ordered $patch)'
backup_file_name $patch $file
+++ backup_file_name https-streaming.patch configure.in
+++ local patch=https-streaming.patch
+++ '[' 2 -gt 1 ']'
+++ echo .pc/https-streaming.patch/configure.in
+++ shift
+++ '[' 1 -gt 1 ']'
++ old_file=.pc/https-streaming.patch/configure.in
next_patch_for_file $patch $file
+++ next_patch_for_file https-streaming.patch configure.in
+++ local patch=https-streaming.patch file=configure.in
patches_on_top_of $patch
++++ patches_on_top_of https-streaming.patch
++++ local patch=https-streaming.patch
++++ '[' -e .pc/applied-patches ']'
++++ /usr/local/bin/gawk '
        $0 == "https-streaming.patch"   { seen=1 ; next }
        seen                    { print }
        ' .pc/applied-patches
+++ local patches_on_top=
+++ '[' -n '' ']'
++ next_patch=
++ '[' -z '' ']'
++ new_file=configure.in
++ diff_file configure.in .pc/https-streaming.patch/configure.in configure.in
++ local file=configure.in old_file=.pc/https-streaming.patch/configure.in 
new_file=configure.in
++ local index old_hdr old_date new_hdr new_date line
++ : 1
++ '[' 1 -eq 0 ']'
basename $PWD
+++ basename /usr/local/src/patcharea/xmms-1.2.10
+++ local path=/usr/local/src/patcharea/xmms-1.2.10
+++ path=/usr/local/src/patcharea/xmms-1.2.10
+++ echo xmms-1.2.10
++ local dir=xmms-1.2.10
++ old_hdr=xmms-1.2.10.orig/configure.in
++ new_hdr=xmms-1.2.10/configure.in
++ index=xmms-1.2.10/configure.in
++ '[' -s .pc/https-streaming.patch/configure.in ']'
++ '[' -n '' ']'
date +'%Y-%m-%d %H:%M:%S.%N %z'                                         -r 
"$old_file"
+++ date '+%Y-%m-%d %H:%M:%S.%N %z' -r .pc/https-streaming.patch/configure.in
++ old_date='   2005-01-24 14:04:30.000000000 +0100'
++ '[' -s configure.in ']'
++ '[' -n '' ']'
date +'%Y-%m-%d %H:%M:%S.%N %z'                                         -r 
"$new_file"
+++ date '+%Y-%m-%d %H:%M:%S.%N %z' -r configure.in
++ new_date='   2005-01-24 14:06:07.000000000 +0100'
++ /usr/bin/diff -N -u .pc/https-streaming.patch/configure.in configure.in 
--label 'xmms-1.2.10.orig/configure.in       2005-01-24 14:04:30.000000000 
+0100' --label 'xmms-1.2.10/configure.in  2005-01-24 14:06:07.000000000 +0100'
++ read line
++ echo 'Index: xmms-1.2.10/configure.in'
++ echo ===================================================================
++ echo '--- xmms-1.2.10.orig/configure.in      2005-01-24 14:04:30.000000000 
+0100'
++ cat
++ '[' -n '' -a -z '' ']'

if ! [ -s $tmp_patch ]
then
        printf $"Nothing in patch %s\n" "$(print_patch $patch)" >&2
        die 1
fi
++ '[' -s /tmp/quilt.ly7224 ']'

patch_file=$(patch_file_name $patch)
patch_file_name $patch
+++ patch_file_name https-streaming.patch
+++ echo patches/https-streaming.patch
++ patch_file=patches/https-streaming.patch

trap "" SIGINT
++ trap '' SIGINT

if ! tmp_header=$(gen_tempfile)
then
        die 1
fi
gen_tempfile
+++ gen_tempfile
+++ local name
+++ '[' '' = -d ']'
+++ /bin/mktemp /tmp/quilt.XXXXXX
++ tmp_header=/tmp/quilt.VE7285

mkdir -p $(dirname $patch_file)
dirname $patch_file
+++ dirname patches/https-streaming.patch
+++ local path=patches/https-streaming.patch
+++ path=patches/https-streaming.patch
+++ local basename=https-streaming.patch
+++ path=patches/
+++ '[' xpatches/ '!=' x/ ']'
+++ path=patches
+++ echo patches
++ mkdir -p patches

if ! cat_file $patch_file | patch_description > $tmp_header
then
        die 1
fi
++ cat_file patches/https-streaming.patch
++ local filename
++ for filename in '"$@"'
++ '[' -e patches/https-streaming.patch ']'
++ case "$filename" in
++ cat patches/https-streaming.patch
++ patch_description
++ local patch_file=
++ '[' -e '' -o -z '' ']'
++ /usr/local/bin/gawk '
                $1 == "***" || $1 == "---"      { exit }
                /^Index:[ \t]|^diff[ \t]|^==*$|^RCS file: |^retrieving revision 
[0-9]+(\.[0-9]+)*$/ \
                        { eat = eat $0 "\n"
                          next }
                        { print eat $0
                          eat = "" }
                '
/usr/local/share/quilt/scripts/patchfns: line 591:  7290 Broken pipe            
 cat "$filename"

tmp_result=$(gen_tempfile) || die 1
gen_tempfile
+++ gen_tempfile
+++ local name
+++ '[' '' = -d ']'
+++ /bin/mktemp /tmp/quilt.XXXXXX
++ tmp_result=/tmp/quilt.qA7293

if [ -n "$opt_diffstat" ]
then
        diffstat="$(/usr/local/bin/diffstat $tmp_patch)" || die 1
        /usr/local/bin/gawk '
            function print_diffstat(arr, i) {
              split(diffstat, arr, "\n")
              for (i=1; i in arr; i++)
                print prefix arr[i]
            }
            BEGIN       { split(diffstat, ds_arr, /\n/) }
                        { prefix=""
                          if (index($0, "#") == 1)
                            prefix="#"
                        }
            /.*\|.*/    { eat = eat $0 "\n"
                          next }
            /.* files? changed(, .* insertions?\(\+\))?(, .* deletions?\(-\))?/ 
\
                        { print_diffstat()
                          diffstat = "" ; eat = ""
                          next }
                        { print eat $0
                          eat = "" }
            END         { printf "%s", eat
                          if (diffstat != "") {
                            print_diffstat()
                            print prefix
                          }
                        }
            ' diffstat="$diffstat" \
            $tmp_header > $tmp_result
else
        cat $tmp_header > $tmp_result
fi
++ '[' -n '' ']'
++ cat /tmp/quilt.VE7285

cat $tmp_patch >> $tmp_result
++ cat /tmp/quilt.ly7224

if [ -e $patch_file ] && \
    /usr/bin/diff -q $patch_file $tmp_result > /dev/null
then
        printf $"Patch %s is unchanged\n" "$(print_patch $patch)"
        exit 0
fi
++ '[' -e patches/https-streaming.patch ']'
++ /usr/bin/diff -q patches/https-streaming.patch /tmp/quilt.qA7293
print_patch $patch
+++ print_patch https-streaming.patch
+++ echo -n https-streaming.patch
++ printf 'Patch %s is unchanged\n' https-streaming.patch
Patch https-streaming.patch is unchanged
++ exit 0

reply via email to

[Prev in Thread] Current Thread [Next in Thread]