- Timestamp:
- Jul 25, 2006, 2:52:04 PM (19 years ago)
- Branches:
- freewrt_1_0, freewrt_2_0
- Children:
- aee909e
- Parents:
- ecb5fbe
- File:
-
- 1 edited
-
scripts/update-patches (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
scripts/update-patches
recb5fbe r24dce9d 31 31 shopt -s extglob 32 32 33 do_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 @@ 44 EOF 45 return 0 46 fi 47 touch -t 197001010000.00 "$f1" 48 fi 49 diff -adup "$f1" "$f2" 50 return $? 51 } 52 33 53 TRANSFORM='sed s/[.+]/\\\\&/g' 34 54 … … 49 69 ORGDIST=${D_BASE}/${D_SUB}.orig 50 70 51 DIFF_FLAGS="-adu -I \"^--- $(echo $D_SUB.orig | $TRANSFORM)@@\""52 DIFF_FLAGS="$DIFF_FLAGS -I \"^\+\+\+ $(echo $D_SUB | $TRANSFORM)@@\""71 DIFF_FLAGS="-adu -I \"^--- $(echo $D_SUB.orig/ | $TRANSFORM)@@ .*\"" 72 DIFF_FLAGS="$DIFF_FLAGS -I \"^\+\+\+ $(echo $D_SUB/ | $TRANSFORM)@@ .*\"" 53 73 54 74 for file in $(cd ${WRKDIST}; find . -type f | sed 's#^\./##'); do … … 62 82 63 83 # Patch found. Is this the one? 64 if grep "^[+-][+-][+-] $D_CMP[^/]*/$file " "$i" >/dev/null; then84 if grep "^[+-][+-][+-] $D_CMP[^/]*/$file " "$i" >/dev/null; then 65 85 # Multiple files in the diff? 66 86 if [ $(grep -c "^--- $D_CMP" "$i") -gt 1 -o \ … … 76 96 # Multiple diffs with this file? 77 97 let n=0 78 esc=98 pflst= 79 99 for j in $PATCH_LIST; do 80 100 [[ ! -f $j || $j = *@(.orig|.rej|~) ]] && \ 81 101 continue 82 grep "^[+-][+-][+-] $D_CMP[^/]*/$file " \102 grep "^[+-][+-][+-] $D_CMP[^/]*/$file " \ 83 103 "$j" >/dev/null || continue 84 104 let n++ 85 esc="$esc'$j'"105 pflst="$pflst '$j'" 86 106 done 87 107 if (( n != 1 )); then 88 108 echo "Cannot process, file $file" >&2 89 109 echo "is contained in multiple patches:" >&2 90 echo "$ esc" >&2110 echo "$pflst" >&2 91 111 echo FAIL 92 112 [[ -n $SUBDIST ]] && mv \ … … 99 119 accounted="$accounted $i" 100 120 # found it, copy preamble before comparision 101 esc="$(echo "$file" | sed -e 's#/#\\/#g')"102 121 ( 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" \ 105 123 ) >"$i.new" 106 124 # did it change ? mark it as changed … … 124 142 echo "No patch-* found for $file, creating $patchname" >&2 125 143 ( echo '$Free''WRT$'; \ 126 cd $D_BASE && d iff -adup "$D_SUB.orig/$file" "$D_SUB/$file" \144 cd $D_BASE && do_diff "$file" "$D_SUB.orig" "$D_SUB" \ 127 145 ) >$patchname 128 146 edit="$edit $patchname"
Note:
See TracChangeset
for help on using the changeset viewer.
