X-Git-Url: https://git.jankratochvil.net/?p=nethome.git;a=blobdiff_plain;f=bin%2Frpmmerge;h=39fb27d5f2c14324be0276a36a7f50a2c504b835;hp=b7242898bcd2b1da4fab2a11815f75c99a6b450d;hb=f1fd1da97405a124a824d3808d6bc59df1b16b9b;hpb=49bd9f2b6bb8742c6537468c33a2dbd70ef00dd0 diff --git a/bin/rpmmerge b/bin/rpmmerge index b724289..39fb27d 100755 --- a/bin/rpmmerge +++ b/bin/rpmmerge @@ -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 @@ -13,7 +14,7 @@ for base in $l;do test ! -f $base.rej test ! -f $base-orig - # The old format should be converted by: + # The old `-orig' format should be converted by: # rpm -qla|perl -lne 'chomp;s/$/-orig/;next if ! -e;$o=$_;$o=~s/-orig$//;$o=~tr{/}{-};$o="/root/rpmmerge/$o";die $o if -e $o;$_="mv -f '\''$_'\'' '\''$o'\''";system $_ and die "$_: $!";' orig="/root/rpmmerge/$(echo $base|tr / -)" @@ -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,19 @@ 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 ! -f $_;$o=$_;$o=~tr{/}{-};$o="/root/rpmmerge/$o";next if -e $o;system "cp -i -p '\''$_'\'' '\''$o'\''" and die "$_: $!";' +if $ok +then + mkdir -p /root/rpmmerge + 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