source: soft/build_system/build_system/upload/robot/trunk/doble @ 1

Last change on this file since 1 was 1, checked in by fasma, 12 years ago

Initial Import from Mandriva's soft revision 224062 and package revision 45733

File size: 918 bytes
Line 
1#!/usr/bin/perl
2## Remove the doble rpm according to the date
3use URPM;
4
5my @list = sort @ARGV;
6
7foreach (@list) {
8    next unless /\.rpm$/;
9    my ($name, $version, $release) = m|([^/]+)-([^-]+)-([^-]+)\.[^.]+\.rpm$|;
10    if ($name =~ /kernel-source/) { ($major) = $version =~ /(\d+\.\d+)/; $name = "kernel-source-$major" }
11    elsif ( $name =~ /(kernel\d*)-(\d+\.\d+)\.\d+(\.\d+\w+)?/) { $name = "$1-$1" }
12    elsif ( $name =~ /(kernel\d*)-([^-]+(?:-[^-]+)*)-(\d+\.\d+)\.\d+(\.\d+\w+)?/) { $name = ":$1-$2-$3" }
13    if ($name eq $last) {
14        if ((stat($_))[9] < (stat($lastfile))[9]) { print "$_ "; next; }
15        elsif ((stat($_))[9] > (stat($lastfile))[9]) { print "$lastfile "; }
16        else { URPM::ranges_overlap("== $version-$release","> $last_version-$last_release") ? print "$_ " : print "$lastfile " }
17    } 
18    $last = $name;
19    $last_version = $version;
20    $last_release = $release;
21    $lastfile = $_;
22}
23print "\n";
Note: See TracBrowser for help on using the repository browser.