diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/patchfns.in | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/scripts/patchfns.in b/scripts/patchfns.in index f16ad4e..1aab136 100644 --- a/scripts/patchfns.in +++ b/scripts/patchfns.in @@ -217,6 +217,28 @@ remove_from_series() fi } +rename_in_series() +{ + local from=$1 to=$2 + + tmpfile=$(gen_tempfile) || return 1 + /usr/bin/gawk ' + /^'"$(quote_re $from)"'(|\.patch|\.diff?)(|\.gz|\.bz2)([ \t]|$)/ \ + { sub(/'"$(quote_re $from)(|\.patch|\.diff?)(|\.gz|\.bz2)"'/, + "'"${to//\"/\\\"}"'") + print + good=1 } + END { exit(! good) } + ' $SERIES > $tmpfile + if [ $? -eq 0 ] + then + mv -f $tmpfile $SERIES + else + rm -f $tmpfile + return 1 + fi +} + pc_file_name() { while [ $# -gt 0 ] @@ -465,6 +487,27 @@ remove_from_db() fi } +rename_in_db() +{ + local from=$1 to=$2 + local tmpfile + tmpfile=$(gen_tempfile) || return 1 + /usr/bin/gawk ' + /^'"$(quote_re $from)"'$/ \ + { sub(/'"$(quote_re $from)"'/, "'"${to//\"/\\\"}"'") + print + good=1 } + END { exit(! good) } + ' $DB > $tmpfile + if [ $? -eq 0 ] + then + mv -f $tmpfile $DB + else + rm -f $tmpfile + return 1 + fi +} + stripit() { if [ -n "$1" ] |