From 7e87972b906b69cff310e6a84503770803de54c9 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Evrard Date: Thu, 26 Jul 2018 12:20:06 +0200 Subject: [PATCH] Add opensuse-leap support Docker images coming from the dockerhub for opensuse leap 15 (opensuse/leap:15) have the following content in their lsb release: NAME="openSUSE Leap" VERSION="15.0" ID="opensuse-leap" Without this patch, opensuse-leap images are not recognised by bindep, as "opensuse-leap" != "opensuse" This is a problem, as it prevents subprojects using bindep (like loci) to use those images, unless some hackery of release file is done. This patch solves the problem by ensuring opensuse-leap systems are strictly listed like any other "opensuse.*" system. Change-Id: I937812b7219ec38f9335dbb85600f294fff40902 --- bindep/depends.py | 2 +- .../tests/fixtures/opensuseleap15/etc/os-release | 10 ++++++++++ bindep/tests/test_depends.py | 16 ++++++++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 bindep/tests/fixtures/opensuseleap15/etc/os-release diff --git a/bindep/depends.py b/bindep/depends.py index 2066d41..0ad3c86 100644 --- a/bindep/depends.py +++ b/bindep/depends.py @@ -323,7 +323,7 @@ class Depends(object): "redhatenterpriseserver", "redhatenterpriseworkstation", "fedora", - "opensuseproject", "opensuse", + "opensuseproject", "opensuse", "opensuse-leap", "opensuse-tumbleweed", "sles", "suselinux"]: # Distro aliases if distro_id in ["redhatenterpriseserver", diff --git a/bindep/tests/fixtures/opensuseleap15/etc/os-release b/bindep/tests/fixtures/opensuseleap15/etc/os-release new file mode 100644 index 0000000..a519419 --- /dev/null +++ b/bindep/tests/fixtures/opensuseleap15/etc/os-release @@ -0,0 +1,10 @@ +NAME="openSUSE Leap" +VERSION="15.0" +ID="opensuse-leap" +ID_LIKE="suse opensuse" +VERSION_ID="15.0" +PRETTY_NAME="openSUSE Leap 15.0" +ANSI_COLOR="0;32" +CPE_NAME="cpe:/o:opensuse:leap:15.0" +BUG_REPORT_URL="https://bugs.opensuse.org" +HOME_URL="https://www.opensuse.org/" diff --git a/bindep/tests/test_depends.py b/bindep/tests/test_depends.py index a737ac2..64fc7cd 100644 --- a/bindep/tests/test_depends.py +++ b/bindep/tests/test_depends.py @@ -183,6 +183,15 @@ class TestDepends(TestCase): self.assertThat(platform_profiles, Contains("platform:suse")) + def test_detects_opensuse_leap15(self): + with DistroFixture("openSUSEleap15"): + depends = Depends("") + platform_profiles = depends.platform_profiles() + self.assertThat(platform_profiles, + Contains("platform:opensuse")) + self.assertThat(platform_profiles, + Contains("platform:suse")) + def test_detects_suse_linux(self): with DistroFixture("SLES"): depends = Depends("") @@ -256,6 +265,13 @@ class TestDepends(TestCase): depends.platform_profiles(), Contains("platform:rpm")) self.assertIsInstance(depends.platform, Rpm) + def test_opensuse_leap15_implies_rpm(self): + with DistroFixture("openSUSEleap15"): + depends = Depends("") + self.assertThat( + depends.platform_profiles(), Contains("platform:rpm")) + self.assertIsInstance(depends.platform, Rpm) + def test_suse_linux_implies_rpm(self): with DistroFixture("SLES"): depends = Depends("")