[jhbuild/desrt/master: 8/28] sysid: add support for freebsd-version



commit 2c11f28f37eabbbd8bc92950e26611af2a9b8b1d
Author: Ting-Wei Lan <lantw src gnome org>
Date:   Sat Jan 3 01:53:18 2015 -0500

    sysid: add support for freebsd-version
    
    https://bugzilla.gnome.org/show_bug.cgi?id=742267

 jhbuild/utils/sysid.py |   23 ++++++++++++++++++++++-
 1 files changed, 22 insertions(+), 1 deletions(-)
---
diff --git a/jhbuild/utils/sysid.py b/jhbuild/utils/sysid.py
index 04bc224..40f547b 100644
--- a/jhbuild/utils/sysid.py
+++ b/jhbuild/utils/sysid.py
@@ -93,6 +93,26 @@ def get_macos_info():
     except:
         return False
 
+def get_freebsd_info():
+    global sys_name
+    global sys_id
+
+    try:
+        ver = subprocess.check_output('freebsd-version').strip()
+
+        sys_name = 'FreeBSD ' + ver
+        return True
+    except:
+        pass
+
+    try:
+        ver = subprocess.check_output(['uname', '-r']).strip()
+
+        sys_name = 'FreeBSD' + ver
+        return True
+    except:
+        return False
+
 def ensure_loaded():
     global default_conditions
     global sys_name
@@ -133,7 +153,8 @@ def ensure_loaded():
         sys_name = "Unknown Linux Distribution (no 'os-release' file)"
 
     elif sys_id.startswith('freebsd'):
-        sys_name = 'FreeBSD (%s)' % (sys_id)
+        if not get_freebsd_info():
+            sys_name = 'FreeBSD (%s)' % (sys_id)
 
     elif sys_id.startswith('macos'):
         if not get_macos_info():


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]