version 1.2, 2002/02/27 01:47:31
|
version 1.3, 2002/04/13 19:13:06
|
Line 1
|
Line 1
|
#!/usr/bin/perl |
#!/usr/bin/perl |
# |
# |
# check-rpms, version 2.1.0 |
# check-rpms, version 2.1.1 |
# Martin Siegert, SFU, siegert@sfu.ca, Feb 02 |
# Martin Siegert, SFU, siegert@sfu.ca, Feb 02 |
# |
# |
=pod |
=pod |
Line 371 if (defined $opt_ftp || $FTP) {
|
Line 371 if (defined $opt_ftp || $FTP) {
|
|
|
if ($download || $recheck) { |
if ($download || $recheck) { |
if ( ! -d $RPMDIR) { |
if ( ! -d $RPMDIR) { |
$retval = system("mkdir -p $RPMDIR; chmod 700 $RPMDIR"); |
if ($verbose) { print "Creating $RPMDIR ...\n"; } |
|
if ($< == 0) { |
|
$retval = system("su $RPMUSER -c \'mkdir -p $RPMDIR\'; chmod 700 $RPMDIR"); |
|
} else { |
|
$retval = system("mkdir -p $RPMDIR; chmod 700 $RPMDIR"); |
|
} |
if ($retval) { die "error: could not create $RPMDIR\n"; } |
if ($retval) { die "error: could not create $RPMDIR\n"; } |
} |
} |
} |
} |
Line 458 if ($ftp) {
|
Line 463 if ($ftp) {
|
$giveup = 0; |
$giveup = 0; |
for (@templist) { |
for (@templist) { |
($rpm, $pkg, $pver, $arch) = m/(([^ ]*)-([^- ]+-[^-]+\.(\w+)\.rpm))/; |
($rpm, $pkg, $pver, $arch) = m/(([^ ]*)-([^- ]+-[^-]+\.(\w+)\.rpm))/; |
|
if (! defined $local_rpm{$pkg}) { next; } |
if ($remote_rpm{$pkg}) { |
if ($remote_rpm{$pkg}) { |
# problem: there are several versions of the same package. |
# problem: there are several versions of the same package. |
# this means that the package exists for different architectures |
# this means that the package exists for different architectures |
Line 540 for (@local_rpm_list) {
|
Line 546 for (@local_rpm_list) {
|
push(@q_updates, $rpm); |
push(@q_updates, $rpm); |
} elsif ( $vcmp < 0 ) { |
} elsif ( $vcmp < 0 ) { |
# local version is lower |
# local version is lower |
if ( $qflag ) { |
push(@updates, $rpm); |
push(@q_updates, $rpm); |
|
} else { |
|
push(@updates, $rpm); |
|
} |
|
} |
} |
} elsif ($list_missing) { |
} elsif ($list_missing) { |
print "Package '$pkg' missing from remote repository\n"; |
print "Package '$pkg' missing from remote repository\n"; |
Line 698 sub pkg_compare($$$) {
|
Line 700 sub pkg_compare($$$) {
|
} |
} |
my $serial1 = `rpm -qp --queryformat '%{SERIAL}' $RPMDIR/$pkg1`; |
my $serial1 = `rpm -qp --queryformat '%{SERIAL}' $RPMDIR/$pkg1`; |
my $serial2 = `rpm -qp --queryformat '%{SERIAL}' $RPMDIR/$pkg2`; |
my $serial2 = `rpm -qp --queryformat '%{SERIAL}' $RPMDIR/$pkg2`; |
($serial2 > $serial1) ? return 1 : return 0; |
if ($serial2 > $serial1) { |
|
remove_pkg("$RPMDIR/$pkg1"); |
|
return 1; |
|
} else { |
|
remove_pkg("$RPMDIR/$pkg2"); |
|
return 0; |
|
} |
|
} |
|
|
|
sub remove_pkg($) { |
|
my ($pkg) = @_; |
|
if ($verbose) { |
|
print "Removing $pkg ...\n"; |
|
} |
|
my $status = system("rm -f $pkg"); |
|
if ($status) { |
|
printf STDERR "error: could not remove $pkg. You must remove this file before updating.\n"; |
|
if ($update) { $giveup = 1; } |
|
} |
} |
} |
|
|
sub mulpkg_msg($$$) { |
sub mulpkg_msg($$$) { |