Changeset daec02d in freewrt
- Timestamp:
- Jul 25, 2006, 12:17:04 PM (19 years ago)
- Branches:
- freewrt_1_0, freewrt_2_0
- Children:
- f3b127c
- Parents:
- 9829980
- File:
-
- 1 edited
-
scripts/update-patches (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
scripts/update-patches
r9829980 rdaec02d 1 #!/ bin/mksh1 #!/usr/bin/env bash 2 2 # $FreeWRT$ 3 3 # $MirOS: ports/infrastructure/scripts/update-patches,v 1.5 2006/06/15 19:18:43 tg Exp $ … … 26 26 # the possibility of such damage or existence of a nontrivial bug. 27 27 28 shopt -s extglob 28 29 29 # if OS diff not capable enough, require GNU diff 30 if [[ $NEED_GDIFF = yes ]]; then 31 if [[ ! -x $(which gdiff) ]]; then 32 exec >&2 33 print "Fatal:\tGNU diff (gdiff) required for 'update-patches'" 34 print "\tIt may be installed from the textproc/gdiff port." 35 exit 1 36 fi 37 DIFFPROG=$(which gdiff) 38 TRANSFORM=cat 39 DIFF_FLAGS="-adu --ignore-matching-lines=" 40 DIFF_FLAGS="${DIFF_FLAGS}\"^--- @@$PATCHORIG .*\"" 41 DIFF_FLAGS="${DIFF_FLAGS} --ignore-matching-lines=" 42 DIFF_FLAGS="${DIFF_FLAGS}\"^+++ @@ .*\"" 43 else 44 DIFFPROG=$(which diff) 45 TRANSFORM='sed s/[.+]/\\\\&/g' 46 tfile=$(print -r -- $PATCHORIG | $TRANSFORM) 47 DIFF_FLAGS="-adu -I \"^--- @@$(print -- $tfile) \"" 48 DIFF_FLAGS="${DIFF_FLAGS} -I \"^\+\+\+ @@ \"" 49 fi 30 TRANSFORM='sed s/[.+]/\\\\&/g' 31 tfile=$(echo "$PATCHORIG" | $TRANSFORM) 32 DIFF_FLAGS="-adu -I \"^--- @@$(echo "$tfile") \"" 33 DIFF_FLAGS="${DIFF_FLAGS} -I \"^\+\+\+ @@ \"" 50 34 51 35 mkdir -p $PATCHDIR … … 59 43 while read -p file; do 60 44 if cmp -s "$WRKDIST/$file" "$WRKDIST/$file$PATCHORIG"; then 61 print -r --"$file and $file$PATCHORIG are identical" >&245 echo "$file and $file$PATCHORIG are identical" >&2 62 46 continue 63 47 fi 64 48 if [[ ! -f $WRKDIST/$file ]]; then 65 print -r --"$file does not exist" >&249 echo "$file does not exist" >&2 66 50 continue 67 51 fi 68 print -r --"Processing ${file}..." >&252 echo "Processing ${file}..." >&2 69 53 # look in patchdir for an existing patchfile matching this 70 54 cd $PATCHDIR … … 78 62 accounted="$accounted $i" 79 63 # found it, copy preamble before comparision 80 esc="$( print -r --"$file" | sed -e 's#/#\\/#g')"64 esc="$(echo "$file" | sed -e 's#/#\\/#g')" 81 65 ( sed -e "/^--- $esc$PATCHORIG/,\$d" <$i; \ 82 cd $WRKDIST && ${DIFFPROG}-adup \66 cd $WRKDIST && diff -adup \ 83 67 ${DIFF_ARGS} "$file$PATCHORIG" "$file" \ 84 68 ) >"$i.new" 85 69 # did it change ? mark it as changed 86 tfile="$( print -r --"$file" | $TRANSFORM)"87 if eval ${DIFFPROG} "$(print -r --"${DIFF_FLAGS}" \70 tfile="$(echo "$file" | $TRANSFORM)" 71 if eval diff "$(echo "${DIFF_FLAGS}" \ 88 72 ${DIFF_ARGS} | sed "s#@@#${tfile}#g")" \ 89 73 "$i" "$i.new" 1>&2; then 90 74 rm "$i.new" 91 75 else 92 print -r --"Patch $i for $file updated" >&276 echo "Patch $i for $file updated" >&2 93 77 mv "$i" "$i$PATCHORIG" 94 78 mv "$i.new" "$i" … … 100 84 101 85 # Build a sensible name for the new patch file 102 patchname=patch-$(print -r -- "$file" | sed -e 's#[/. ]#_#g') 103 print -r -- "No patch-* found for $file, creating $patchname" >&2 104 ( print -r -- '$Mir''OS$'; \ 105 cd $WRKDIST && ${DIFFPROG} -adup ${DIFF_ARGS} \ 106 "$file$PATCHORIG" "$file" \ 86 patchname=patch-$(echo "$file" | sed -e 's#[/. ]#_#g') 87 echo "No patch-* found for $file, creating $patchname" >&2 88 ( echo '$Free''WRT$'; \ 89 cd $WRKDIST && diff -adup ${DIFF_ARGS} "$file$PATCHORIG" "$file" \ 107 90 ) >$patchname 108 91 edit="$edit $patchname" … … 116 99 && continue 117 100 grep '^\\ No newline at end of file' $i >/dev/null \ 118 && print -r --"*** Patch $i needs manual intervention" >&2101 && echo "*** Patch $i needs manual intervention" >&2 119 102 [[ $accounted != *@($i)* ]] \ 120 && print -r --"*** Patch $i not accounted for" >&2103 && echo "*** Patch $i not accounted for" >&2 121 104 done 122 105 123 print -r --$edit106 echo $edit 124 107 exit 0
Note:
See TracChangeset
for help on using the changeset viewer.
