Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #19000: Epoch is not included in rpm package version in inventory #2576

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
From 2afa1045a3c484dfbb04fdebe90b2986149e8d81 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Vincent=20Membr=C3=A9?= <vincent.membre@normation.com>
Date: Thu, 11 Mar 2021 21:36:12 +0100
Subject: Add epoch to RPM packages

---
.../Agent/Task/Inventory/Generic/Softwares/RPM.pm | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/FusionInventory/Agent/Task/Inventory/Generic/Softwares/RPM.pm b/lib/FusionInventory/Agent/Task/Inventory/Generic/Softwares/RPM.pm
index bcc98cc9f..d66e0b9b3 100644
--- a/lib/FusionInventory/Agent/Task/Inventory/Generic/Softwares/RPM.pm
+++ b/lib/FusionInventory/Agent/Task/Inventory/Generic/Softwares/RPM.pm
@@ -26,7 +26,8 @@ sub doInventory {
'%{SIZE}\t' .
'%{VENDOR}\t' .
'%{SUMMARY}\t' .
- '%{GROUP}\n' .
+ '%{GROUP}\t' .
+ '%{EPOCH}\n' .
'\'';

my $packages = _getPackagesList(
@@ -50,10 +51,13 @@ sub _getPackagesList {
while (my $line = <$handle>) {
chomp $line;
my @infos = split("\t", $line);
+ my $version = $infos[2];
+ my $epoch = $infos[8];
+ $version = $epoch . ":" . $version if (($epoch ne "(none)") && ($epoch ne "0"));
my $package = {
NAME => $infos[0],
ARCH => $infos[1],
- VERSION => $infos[2],
+ VERSION => $version,
FILESIZE => $infos[4],
COMMENTS => $infos[6],
FROM => 'rpm',
--
2.26.2