>>>>> "AC" == Alan Cox <[EMAIL PROTECTED]> writes:

AC> grep ".rpmsave" /tmp/upgrade.log
AC> grep ".rpmnew" /tmp/upgrade.log

This assumes that /tmp is kept around; at least on my machines it isn't
nearly as permanent as the RPM databases.  (/tmp doesn't get backed up and
it's purged of older files automatically.)  Fortunately you can do a great
job using the RPM database and the actual contents of the filesystem.

So it looks as if there is enough information there to craft a reasonable
approximation to 'versions changed'.  (I hadn't heard of '.rpmnew' before.)
A quick, somewhat nasty hack is appended.  Exits with 1 if there were
changes, 0 otherwise.  Call with -q to produce no output or -d to produce
diffs.  Probably doesn't deal well with changed files having names
containing spaces.

 - J<

#!/usr/bin/perl
use Getopt::Std;
getopts('dq');

$| = 1;
@DIFF = qw(/usr/bin/diff -u);
@LS   = qw(/bin/ls -l);

@configfiles = `rpm -qac`;

for $i (@configfiles) {
  chomp $i;
  $old = -f "$i.rpmsave";
  $new = -f "$i.rpmnew";
  if ($old || $new) {

    # If running quietly, we can just exit the first time we see a difference
    if ($opt_q) {
      exit 1;
    }

    $package = `rpm -qf $i`;
    chomp $package;

    push @{$updates{$package}}, {file => $i,
                                 old  => $old,
                                 new  => $new,
                                };
  }
}

exit 0 unless %updates;

for $package (sort keys %updates) {
  print "Updated files in package $package:\n";

  for $i (@{$updates{$package}}) {
    if ($i->{old}) {
      show ($i->{file}, "$i->{file}.rpmsave");
    }
    if ($i->{new}) {
      show ($i->{file}, "$i->{file}.rpmnew");
    }
  }
  print "\n";
}

exit 1;

sub show {
  my($old, $new) = @_;

  print "    " if $opt_d;
  system(@LS, $old);
  print "    " if $opt_d;
  system(@LS, $new);

  if ($opt_d) {
    print "Differences:\n", "="x40, "\n";
    system(@DIFF, $old, $new);
    print "="x40, "\n";
  }
}

-- 
To unsubscribe:
mail -s unsubscribe [EMAIL PROTECTED] < /dev/null

Reply via email to