summaryrefslogtreecommitdiffstats
path: root/cleanoldrpm
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2020-11-25 08:29:20 +0100
committerRemi Collet <remi@remirepo.net>2020-11-25 08:29:20 +0100
commitac9b2488788cba18bc9de7c0202262210fad04a1 (patch)
treeb58bdb36ceeba72a9c003f8cd71c68db90d76feb /cleanoldrpm
parent7ac16136fa7df1b87dd31332966409a28f860ad3 (diff)
cleanoldrpm: fix version to compare
Diffstat (limited to 'cleanoldrpm')
-rwxr-xr-xcleanoldrpm8
1 files changed, 6 insertions, 2 deletions
diff --git a/cleanoldrpm b/cleanoldrpm
index 17d659c..e8451b9 100755
--- a/cleanoldrpm
+++ b/cleanoldrpm
@@ -34,10 +34,14 @@ foreach (glob("*.rpm") as $name) {
if (isset($multi[$i])) {
$i .= "/" . substr($info['Version'], 0, $multi[$i]);
}
- $rpms[$i][$info['Version']] = $name;
+ $ver = $info['Version'] . '-' . $info['Release'];
+ if (isset($info['Epoch'])) {
+ $ver = $info['Epoch'] . ':' . $ver;
+ }
+ $rpms[$i][$ver] = $name;
}
-foreach($rpms as $rpm) {
+foreach($rpms as $n => $rpm) {
if (count($rpm) > $keep) {
uksort($rpm, "rpmvercmp");
$i = count($rpm) - $keep;