From 6f2d45ccd67b864f2564b4104e6767fd447e9fe4 Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Mon, 11 Jul 2005 16:58:38 +0000 Subject: [PATCH] Clifford Wolf: Added misc/archive/genprifixdiff.sh .. a small script for creating fixdiff files for changed build priorities. [2005062918564309119] (https://www.rocklinux.net/submaster) git-svn-id: http://www.rocklinux.org/svn/rock-linux/trunk@6210 c5f82cb5-29bc-0310-9cd0-bff59a50e3bc --- misc/archive/genprifixdiff.sh | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 misc/archive/genprifixdiff.sh diff --git a/misc/archive/genprifixdiff.sh b/misc/archive/genprifixdiff.sh new file mode 100644 index 000000000..d1609ddb7 --- /dev/null +++ b/misc/archive/genprifixdiff.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +# Usage example: +# for x in [0-9]*.patch; do bash genprifixdiff.sh ${x%.patch}; done + +if [ -f fixdiff_$1.patch ]; then + echo "Found existing fixdiff for $1!" + exit 1 +fi + +cp $1.patch $1.patch_new + +for descfile in $( lsdiff $1.patch | grep '\.desc$'; ) +do + currpri=$( grep '^\[P\]' $descfile | sed 's, *$,,; s,.* ,,'; ) + if [ -n "$currpri" ]; then + perl -i -pe " + if (not \$done) { + \$gotit = 1 if m,$descfile,; + \$done = 1 if \$gotit and s/(\[P\].*)([0-9]{3}\.[0-9]{3})/\${1}$currpri/; + } + " $1.patch_new + fi +done + +{ + echo "Generated using genprifixdiff.sh" + diff -u $1.patch $1.patch_new +} > fixdiff_$1.patch + +rm -f $1.patch_new + +exit 0 +