From 2d50c1e8631db9047829f2b6009a0d2cebcb833ffc49cf0b26ee94d0272860d1 Mon Sep 17 00:00:00 2001 From: Ludwig Nussel Date: Wed, 20 Aug 2014 15:51:44 +0000 Subject: [PATCH] Accepting request 245201 from devel:languages:python 1 OBS-URL: https://build.opensuse.org/request/show/245201 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/salt?expand=0&rev=36 --- fix-service-py-version-parsing-sles.patch | 31 +++++++++++++++++++++++ salt.changes | 11 ++++++++ salt.spec | 8 ++++++ 3 files changed, 50 insertions(+) create mode 100644 fix-service-py-version-parsing-sles.patch diff --git a/fix-service-py-version-parsing-sles.patch b/fix-service-py-version-parsing-sles.patch new file mode 100644 index 0000000..074a9ea --- /dev/null +++ b/fix-service-py-version-parsing-sles.patch @@ -0,0 +1,31 @@ +From 1539d14a40d976b94724b14a17aff77f9a273a9a Mon Sep 17 00:00:00 2001 +From: Tim Serong +Date: Mon, 18 Aug 2014 23:00:39 +1000 +Subject: [PATCH] Fix service.py version parsing for SLE 11 + +"osrelease" on SLES 11 is in the form "11 SP3", i.e. major version, then a space, then service pack number. This means we can't just split on '.' to get the major number for comparisons. Rather we need to split on non-digit characters to handle both space-delimited and dot-delimited release formats (yuck). +--- + salt/modules/service.py | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/salt/modules/service.py b/salt/modules/service.py +index d581916..dab0817 100644 +--- a/salt/modules/service.py ++++ b/salt/modules/service.py +@@ -49,7 +49,12 @@ def __virtual__(): + # Suse >=12.0 uses systemd + if __grains__.get('os_family', '') == 'Suse': + try: +- if int(__grains__.get('osrelease', '').split('.')[0]) >= 12: ++ # osrelease might be in decimal format (e.g. "12.1"), or for ++ # SLES might include service pack (e.g. "11 SP3"), so split on ++ # non-digit characters, and the zeroth element is the major ++ # number (it'd be so much simpler if it was always "X.Y"...) ++ import re ++ if int(re.split('\D+', __grains__.get('osrelease', ''))[0]) >= 12: + return False + except ValueError: + return False +-- +2.0.3 + diff --git a/salt.changes b/salt.changes index 6c34ffe..c16d56b 100644 --- a/salt.changes +++ b/salt.changes @@ -1,3 +1,14 @@ +------------------------------------------------------------------- +Mon Aug 18 13:06:07 UTC 2014 - tserong@suse.com + +- Fix service.py version parsing for SLE 11 + + Added fix-service-py-version-parsing-sles.patch + +------------------------------------------------------------------- +Tue Aug 12 09:44:43 UTC 2014 - tserong@suse.com + +- Remove salt-master's hard requirement for git and python-GitPython on SLE 12 + ------------------------------------------------------------------- Wed Aug 6 06:36:02 UTC 2014 - tserong@suse.com diff --git a/salt.spec b/salt.spec index 77fda78..c66c66d 100644 --- a/salt.spec +++ b/salt.spec @@ -34,6 +34,8 @@ Patch3: pass-all-systemd-list-units.patch Patch4: use-forking-daemon.patch # PATCH-FIX-UPSTREAM disable-service-py-for-suse-family.patch tserong@suse.com -- ensure salt uses systemd for services on SLES Patch5: disable-service-py-for-suse-family.patch +# PATCH-FIX-UPSTREAM fix-service-py-version-parsing-sles.patch tserong@suse.com -- fix SLES 11 version parsing +Patch6: fix-service-py-version-parsing-sles.patch #for building BuildRequires: fdupes @@ -146,8 +148,13 @@ Documentation of salt, offline version of http://docs.saltstack.com. Summary: Management component for salt, a parallel remote execution system Group: System/Monitoring Requires: %{name} = %{version} +%if 0%{?suse_version} == 1315 +Recommends: git +Recommends: python-GitPython +%else Requires: git Requires: python-GitPython +%endif Requires: python-M2Crypto Requires: python-msgpack-python Requires: python-pycrypto @@ -237,6 +244,7 @@ Bash command line completion support for %{name}. %patch3 -p1 %patch4 -p1 %patch5 -p1 +%patch6 -p1 %build python setup.py build