69 lines
2.3 KiB
Diff
69 lines
2.3 KiB
Diff
|
From 702f5385b83919881b6c33f4cc531baf820a4181 Mon Sep 17 00:00:00 2001
|
||
|
From: Matej Habrnal <mhabrnal@redhat.com>
|
||
|
Date: Mon, 19 Mar 2018 16:19:56 +0100
|
||
|
Subject: [PATCH 11/11] Append Python interpreter as related package
|
||
|
|
||
|
We've decided to attach python interpreter rpm information
|
||
|
to uReport as related package. Python developers need this
|
||
|
information in same cases.
|
||
|
|
||
|
Fixes abrt/abrt#1294
|
||
|
|
||
|
Signed-off-by: Matej Habrnal <mhabrnal@redhat.com>
|
||
|
---
|
||
|
lib/abrt.c | 31 +++++++++++++++++++++++++++++++
|
||
|
1 file changed, 31 insertions(+)
|
||
|
|
||
|
diff --git a/lib/abrt.c b/lib/abrt.c
|
||
|
index d206c0d..e3d4695 100644
|
||
|
--- a/lib/abrt.c
|
||
|
+++ b/lib/abrt.c
|
||
|
@@ -372,6 +372,33 @@ rpm_dso_list_from_dir(struct sr_rpm_package *packages,
|
||
|
return packages;
|
||
|
}
|
||
|
|
||
|
+static struct sr_rpm_package *
|
||
|
+rpm_interpreter_from_dir(struct sr_rpm_package *packages,
|
||
|
+ const char *directory,
|
||
|
+ char **error_message)
|
||
|
+{
|
||
|
+ char *interpreter_str = file_contents(directory, "interpreter",
|
||
|
+ error_message);
|
||
|
+ if (interpreter_str)
|
||
|
+ {
|
||
|
+ struct sr_rpm_package *interpreter_package = sr_rpm_package_new();
|
||
|
+ bool success = sr_rpm_package_parse_nevra(interpreter_str,
|
||
|
+ &interpreter_package->name,
|
||
|
+ &interpreter_package->epoch,
|
||
|
+ &interpreter_package->version,
|
||
|
+ &interpreter_package->release,
|
||
|
+ &interpreter_package->architecture);
|
||
|
+
|
||
|
+ free(interpreter_str);
|
||
|
+ if (success)
|
||
|
+ packages = sr_rpm_package_append(packages, interpreter_package);
|
||
|
+ else
|
||
|
+ sr_rpm_package_free(interpreter_package, true);
|
||
|
+ }
|
||
|
+
|
||
|
+ return packages;
|
||
|
+}
|
||
|
+
|
||
|
static bool
|
||
|
file_exist(const char *directory, const char *filename)
|
||
|
{
|
||
|
@@ -412,6 +439,10 @@ sr_abrt_rpm_packages_from_dir(const char *directory, struct sr_rpm_package **pac
|
||
|
return -2;
|
||
|
}
|
||
|
|
||
|
+ /* attach interpreter as related package if exists */
|
||
|
+ if (file_exist(directory, "interpreter"))
|
||
|
+ *packages = rpm_interpreter_from_dir(*packages, directory, error_message);
|
||
|
+
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
--
|
||
|
2.14.3
|
||
|
|