Blob Blame History Raw
From ebe08cf927d75a7546d649fcaa73e1af5996150b Mon Sep 17 00:00:00 2001
From: Miroslav Grepl <mgrepl@redhat.com>
Date: Fri, 13 Jun 2014 08:21:26 +0200
Subject: [PATCH] Make selinux-policy build working also on another
 architectures related to sepolicy-manpage generate

---
 policycoreutils/sepolicy/sepolicy/__init__.py | 21 ++++++++++++---------
 policycoreutils/sepolicy/sepolicy/manpage.py  |  6 +++---
 2 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/policycoreutils/sepolicy/sepolicy/__init__.py b/policycoreutils/sepolicy/sepolicy/__init__.py
index 7ef8adf..e3943c0 100644
--- a/policycoreutils/sepolicy/sepolicy/__init__.py
+++ b/policycoreutils/sepolicy/sepolicy/__init__.py
@@ -888,16 +888,19 @@ def get_os_version():
         output = subprocess.check_output("rpm -q '%s'" % pkg_name,
                                          stderr=subprocess.STDOUT,
                                          shell=True)
-        os_version = str(output).split(".")[-2]
-    except subprocess.CalledProcessError as e:
-        print(e.output)
+        try:
+            os_version = str(output).split(".")[-2]
+            if os_version[0:2] == "fc":
+                os_version = "Fedora"+os_version[2:]
+            elif os_version[0:2] == "el":
+                os_version = "RHEL"+os_version[2:]
+            else:
+                os_version = "Misc"
+        except IndexError:
+            os_version = "Misc"
 
-    if os_version[0:2] == "fc":
-        os_version = "Fedora"+os_version[2:]
-    elif os_version[0:2] == "el":
-        os_version = "RHEL"+os_version[2:]
-    else:
-        os_version = ""
+    except subprocess.CalledProcessError:
+        os_version = "Misc"
 
     return os_version
 
diff --git a/policycoreutils/sepolicy/sepolicy/manpage.py b/policycoreutils/sepolicy/sepolicy/manpage.py
index 1765b1c..ecb4461 100755
--- a/policycoreutils/sepolicy/sepolicy/manpage.py
+++ b/policycoreutils/sepolicy/sepolicy/manpage.py
@@ -175,7 +175,7 @@ class HTMLManPages:
                 self.old_path = path + "/"
                 self.new_path = self.old_path + self.os_version+"/"
 
-                if self.os_version in fedora_releases or rhel_releases:
+                if (self.os_version in fedora_releases) or (self.os_version in rhel_releases) or (self.os_version == "Misc"):
                         self.__gen_html_manpages()
                 else:
                         print(("SELinux HTML man pages can not be generated for this %s" % os_version))
@@ -255,10 +255,10 @@ Fedora or Red Hat Enterprise Linux Man Pages.</h2>
 <html>
 <head>
         <link rel=stylesheet type="text/css" href="../style.css" title="style">
-        <title>Linux man-pages online for Fedora18</title>
+        <title>Linux man-pages online for Fedora/RHEL</title>
 </head>
 <body>
-<h1>SELinux man pages for Fedora18</h1>
+<h1>SELinux man pages for Fedora/RHEL</h1>
 <hr>
 <table><tr>
 <td valign="middle">
-- 
2.0.4