[SATYR PATCH 3/4] operating_system: add workaround for rawhide

Martin Milata mmilata at redhat.com
Tue Aug 20 16:40:35 UTC 2013


Closes #94.

Signed-off-by: Martin Milata <mmilata at redhat.com>
---
 lib/operating_system.c    | 11 ++++++++++-
 tests/operating_system.at | 14 ++++++++++++++
 2 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/lib/operating_system.c b/lib/operating_system.c
index a93175c..9738deb 100644
--- a/lib/operating_system.c
+++ b/lib/operating_system.c
@@ -147,7 +147,16 @@ os_release_callback(char *key, char *value, void *data)
     }
     else if (0 == strcmp(key, "VERSION_ID"))
     {
-        operating_system->version = value;
+        if (operating_system->version == NULL)
+            operating_system->version = value;
+    }
+    /* fedora rawhide workaround */
+    else if (0 == strcmp(key, "VERSION") && strstr(value, "(Rawhide)"))
+    {
+        if (operating_system->version)
+            free(operating_system->version);
+        operating_system->version = sr_strdup("rawhide");
+        free(value);
     }
     else
     {
diff --git a/tests/operating_system.at b/tests/operating_system.at
index 0c175c3..40c5f8e 100644
--- a/tests/operating_system.at
+++ b/tests/operating_system.at
@@ -75,6 +75,19 @@ main(void)
 "ANSI_COLOR=\"0;34\"\n"
 "CPE_NAME=\"cpe:/o:fedoraproject:fedora:19\"\n";
 
+    char *raw =
+"NAME=Fedora\n"
+"VERSION=\"20 (Rawhide)\"\n"
+"ID=fedora\n"
+"VERSION_ID=20\n"
+"PRETTY_NAME=\"Fedora 20 (Rawhide)\"\n"
+"ANSI_COLOR=\"0;34\"\n"
+"CPE_NAME=\"cpe:/o:fedoraproject:fedora:20\"\n"
+"REDHAT_BUGZILLA_PRODUCT=\"Fedora\"\n"
+"REDHAT_BUGZILLA_PRODUCT_VERSION=Rawhide\n"
+"REDHAT_SUPPORT_PRODUCT=\"Fedora\"\n"
+"REDHAT_SUPPORT_PRODUCT_VERSION=Rawhide\n";
+
     char *el7 =
 "NAME=\"Red Hat Enterprise Linux Workstation\"\n"
 "VERSION=\"7.0 (Codename)\"\n"
@@ -90,6 +103,7 @@ main(void)
 "REDHAT_SUPPORT_PRODUCT_VERSION=7.0\n";
 
     check(f19, "fedora", "19");
+    check(raw, "fedora", "rawhide");
     check(el7, "rhel", "7.0");
 
     return 0;
-- 
1.8.3.1



More information about the Crash-catcher mailing list