Skip to content

Commit 96a4509

Browse files
committed
Merge pull request #245 from dberzano/debian-ubuntu
Detect Debian 7 and 8, and Ubuntu 16.04
2 parents 7c847c2 + 783e19b commit 96a4509

File tree

3 files changed

+56
-2
lines changed

3 files changed

+56
-2
lines changed

aliBuild

+2-1
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,8 @@ ARCHITECTURE_TABLE = [
253253
" RHEL7 / CC7 compatible: slc7_x86-64\n"
254254
" Ubuntu 14.04 compatible: ubuntu1404_x86-64\n"
255255
" Ubuntu 15.04 compatible: ubuntu1504_x86-64\n"
256-
" Ubuntu 15.10 compatible: ubuntu1510_x86-64\n\n"
256+
" Ubuntu 15.10 compatible: ubuntu1510_x86-64\n"
257+
" Ubuntu 16.04 compatible: ubuntu1604_x86-64\n\n"
257258
"On Linux, POWER8 / PPC64 (little endian):\n"
258259
" RHEL7 / CC7 compatible: slc7_ppc64\n\n"
259260
"On Mac, x86-64:\n"

alibuild_helpers/utilities.py

+15-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#!/usr/bin/env python
2+
import subprocess
3+
24
def format(s, **kwds):
35
return s % kwds
46

@@ -22,10 +24,22 @@ def doDetectArch(hasOsRelease, osReleaseLines, platformTuple, platformSystem, pl
2224
if distribution.lower() == "ubuntu":
2325
version = version.split(".")
2426
version = version[0] + version[1]
25-
if distribution in ["redhat", "centos"]:
27+
elif distribution.lower() == "debian":
28+
# http://askubuntu.com/questions/445487/which-ubuntu-version-is-equivalent-to-debian-squeeze
29+
debian_ubuntu = { "7": "1204",
30+
"8": "1404" }
31+
if version in debian_ubuntu:
32+
distribution = "ubuntu"
33+
version = debian_ubuntu[version]
34+
elif distribution in ["redhat", "centos"]:
2635
distribution = distribution.replace("centos","slc").replace("redhat","slc").lower()
2736

2837
processor = platformProcessor
38+
if not processor:
39+
# Sometimes platform.processor returns an empty string
40+
p = subprocess.Popen(["uname", "-m"], stdout=subprocess.PIPE)
41+
processor = p.stdout.read().strip()
42+
2943
return format("%(d)s%(v)s_%(c)s",
3044
d=distribution.lower(),
3145
v=version.split(".")[0],

tests/test_utilities.py

+39
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,56 @@
3838
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
3939
"""
4040

41+
UBUNTU_1604_OS_RELEASE = """
42+
NAME="Ubuntu"
43+
VERSION="16.04 LTS (Xenial Xerus)"
44+
ID=ubuntu
45+
ID_LIKE=debian
46+
PRETTY_NAME="Ubuntu 16.04 LTS"
47+
VERSION_ID="16.04"
48+
HOME_URL="http://www.ubuntu.com/"
49+
SUPPORT_URL="http://help.ubuntu.com/"
50+
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
51+
UBUNTU_CODENAME=xenial
52+
"""
53+
54+
DEBIAN_7_OS_RELEASE = """
55+
PRETTY_NAME="Debian GNU/Linux 7 (wheezy)"
56+
NAME="Debian GNU/Linux"
57+
VERSION_ID="7"
58+
VERSION="7 (wheezy)"
59+
ID=debian
60+
ANSI_COLOR="1;31"
61+
HOME_URL="http://www.debian.org/"
62+
SUPPORT_URL="http://www.debian.org/support/"
63+
BUG_REPORT_URL="http://bugs.debian.org/"
64+
"""
65+
66+
DEBIAN_8_OS_RELEASE = """
67+
PRETTY_NAME="Debian GNU/Linux 8 (jessie)"
68+
NAME="Debian GNU/Linux"
69+
VERSION_ID="8"
70+
VERSION="8 (jessie)"
71+
ID=debian
72+
HOME_URL="http://www.debian.org/"
73+
SUPPORT_URL="http://www.debian.org/support"
74+
BUG_REPORT_URL="https://bugs.debian.org/"
75+
"""
76+
4177
architecturePayloads = [
4278
['osx_x86-64', False, [], ('','',''), 'Darwin', 'x86-64'],
4379
['slc5_x86-64', False, [], ('redhat', '5.XX', 'Boron'), 'Linux', 'x86-64'],
4480
['slc6_x86-64', False, [], ('centos', '6.X', 'Carbon'), 'Linux', 'x86-64'],
4581
['slc7_x86-64', False, [], ('centos', '7.X', 'Ptor'), 'Linux', 'x86-64'],
82+
['ubuntu1604_x86-64', True, UBUNTU_1604_OS_RELEASE.split("\n"), ('Ubuntu', '16.04', 'xenial'), 'Linux', 'x86-64'],
4683
['ubuntu1510_x86-64', False, [], ('Ubuntu', '15.10', 'wily'), 'Linux', 'x86-64'],
4784
['ubuntu1510_x86-64', True, UBUNTU_1510_OS_RELEASE.split("\n"), ('Ubuntu', '15.10', 'wily'), 'Linux', 'x86-64'],
4885
['ubuntu1510_x86-64', True, UBUNTU_1510_OS_RELEASE.split("\n"), ('', '', ''), 'Linux', 'x86-64'], # ANACONDA case
4986
['ubuntu1404_x86-64', True, UBUNTU_1404_OS_RELEASE.split("\n"), ('Ubuntu', '14.04', 'trusty'), 'Linux', 'x86-64'],
5087
['ubuntu1404_x86-64', True, UBUNTU_1404_OS_RELEASE.split("\n"), ('', '', ''), 'Linux', 'x86-64'],
5188
['ubuntu1404_x86-64', True, LINUX_MINT_OS_RELEASE.split("\n"), ('LinuxMint', '17.3', 'rosa'), 'Linux', 'x86-64'], # LinuxMint
89+
['ubuntu1204_x86-64', True, DEBIAN_7_OS_RELEASE.split("\n"), ('Debian', '7', 'wheezy'), 'Linux', 'x86-64'],
90+
['ubuntu1404_x86-64', True, DEBIAN_8_OS_RELEASE.split("\n"), ('Debian', '8', 'jessie'), 'Linux', 'x86-64']
5291
]
5392

5493
class TestArchitectures(unittest.TestCase):

0 commit comments

Comments
 (0)