Changeset 24dce9d in freewrt


Ignore:
Timestamp:
Jul 25, 2006, 2:52:04 PM (19 years ago)
Author:
Thorsten Glaser <tg@…>
Branches:
freewrt_1_0, freewrt_2_0
Children:
aee909e
Parents:
ecb5fbe
Message:
  • remove unused variable
  • fix variable name
  • fix files with same starting name (e.g. Makefile vs Makefile.in)
  • fix generation of patches for new files
  • allow creation of patches for new empty files

git-svn-id: svn://www.freewrt.org/trunk/freewrt@406 afb5a338-a214-0410-bd46-81f09a774fd1

File:
1 edited

Legend:

Unmodified
Added
Removed
  • scripts/update-patches

    recb5fbe r24dce9d  
    3131shopt -s extglob
    3232
     33do_diff()
     34{
     35        local f1=$2/$1
     36        local f2=$3/$1
     37
     38        if [[ ! -e $f1 ]]; then
     39                if [[ ! -s $f2 ]]; then
     40                        cat <<EOF
     41--- $f1 (non-existant)
     42+++ $f2 (empty)
     43@@ -0,0 +0,0 @@
     44EOF
     45                        return 0
     46                fi
     47                touch -t 197001010000.00 "$f1"
     48        fi
     49        diff -adup "$f1" "$f2"
     50        return $?
     51}
     52
    3353TRANSFORM='sed s/[.+]/\\\\&/g'
    3454
     
    4969ORGDIST=${D_BASE}/${D_SUB}.orig
    5070
    51 DIFF_FLAGS="-adu -I \"^--- $(echo $D_SUB.orig | $TRANSFORM)@@\""
    52 DIFF_FLAGS="$DIFF_FLAGS -I \"^\+\+\+ $(echo $D_SUB | $TRANSFORM)@@\""
     71DIFF_FLAGS="-adu -I \"^--- $(echo $D_SUB.orig/ | $TRANSFORM)@@  .*\""
     72DIFF_FLAGS="$DIFF_FLAGS -I \"^\+\+\+ $(echo $D_SUB/ | $TRANSFORM)@@     .*\""
    5373
    5474for file in $(cd ${WRKDIST}; find . -type f | sed 's#^\./##'); do
     
    6282
    6383                # Patch found. Is this the one?
    64                 if grep "^[+-][+-][+-] $D_CMP[^/]*/$file" "$i" >/dev/null; then
     84                if grep "^[+-][+-][+-] $D_CMP[^/]*/$file        " "$i" >/dev/null; then
    6585                        # Multiple files in the diff?
    6686                        if [ $(grep -c "^--- $D_CMP" "$i") -gt 1 -o \
     
    7696                        # Multiple diffs with this file?
    7797                        let n=0
    78                         esc=
     98                        pflst=
    7999                        for j in $PATCH_LIST; do
    80100                                [[ ! -f $j || $j = *@(.orig|.rej|~) ]] && \
    81101                                    continue
    82                                 grep "^[+-][+-][+-] $D_CMP[^/]*/$file" \
     102                                grep "^[+-][+-][+-] $D_CMP[^/]*/$file   " \
    83103                                    "$j" >/dev/null || continue
    84104                                let n++
    85                                 esc="$esc '$j'"
     105                                pflst="$pflst '$j'"
    86106                        done
    87107                        if (( n != 1 )); then
    88108                                echo "Cannot process, file $file" >&2
    89109                                echo "is contained in multiple patches:" >&2
    90                                 echo "$esc" >&2
     110                                echo "$pflst" >&2
    91111                                echo FAIL
    92112                                [[ -n $SUBDIST ]] && mv \
     
    99119                        accounted="$accounted $i"
    100120                        # found it, copy preamble before comparision
    101                         esc="$(echo "$file" | sed -e 's#/#\\/#g')"
    102121                        ( sed -e "/^--- /,\$d" <$i; \
    103                           cd $D_BASE && diff -adup \
    104                             "$D_SUB.orig/$file" "$D_SUB/$file" \
     122                          cd $D_BASE && do_diff "$file" "$D_SUB.orig" "$D_SUB" \
    105123                        ) >"$i.new"
    106124                        # did it change ? mark it as changed
     
    124142        echo "No patch-* found for $file, creating $patchname" >&2
    125143        ( echo '$Free''WRT$'; \
    126           cd $D_BASE && diff -adup "$D_SUB.orig/$file" "$D_SUB/$file" \
     144          cd $D_BASE && do_diff "$file" "$D_SUB.orig" "$D_SUB" \
    127145        ) >$patchname
    128146        edit="$edit $patchname"
Note: See TracChangeset for help on using the changeset viewer.