Support local changes present in .rpmnew.
authorlace <>
Fri, 18 Sep 2009 07:03:52 +0000 (07:03 +0000)
committerlace <>
Fri, 18 Sep 2009 07:03:52 +0000 (07:03 +0000)
Do not stop on the first conflict.

bin/rpmmerge

index 9cf201a..38eb885 100755 (executable)
@@ -3,6 +3,7 @@
 
 
 set -ex
+ok=true
 l="$*"
 [ -z "$l" ] && l="$(rpm -qla|perl -lne 'chomp;s/$/.rpmnew/;print if -f;')"
 for base in $l;do
@@ -25,7 +26,15 @@ for base in $l;do
                continue
        fi
 
-       if diff -u $orig $base.rpmnew | patch -f $base
+       # Local changes present in new rpm?
+       if cmp -s $base $base.rpmnew
+       then
+               mv -f $base.rpmnew $base
+               cp -p $base $orig
+               continue
+       fi
+
+       if diff -u $orig $base.rpmnew | patch -N $base
        then
                test ! -f $base.rej
                rm -f $base.orig
@@ -36,9 +45,18 @@ for base in $l;do
        test -f $base.rej
        mv -f $base.orig $base
        rm -f $base.rej
-       exit 1
+
+       #exit 1
+       ok=false
+       continue
 done
 
-rpm -qac|perl -ne 'chomp;next if $_ eq "(contains no files)";next if m{^/var/lib/rpm/};next if $_ eq "/usr/lib/locale/locale-archive";next if ! -f $_;$o=$_;$o=~tr{/}{-};$o="/root/rpmmerge/$o";next if -e $o;system "cp -i -p '\''$_'\'' '\''$o'\''" and die "$_: $!";'
+if $ok
+then
+       rpm -qac|perl -ne 'chomp;next if $_ eq "(contains no files)";next if m{^/var/lib/rpm/};next if $_ eq "/usr/lib/locale/locale-archive";next if ! -f $_;$o=$_;$o=~tr{/}{-};$o="/root/rpmmerge/$o";next if -e $o;system "cp -i -p '\''$_'\'' '\''$o'\''" and die "$_: $!";'
 
-echo OK
+       echo OK
+else
+       echo ERRORS
+       exit 1
+fi