From 971ab6db7474c2600d12ad68eecda49bd83811fc Mon Sep 17 00:00:00 2001 From: Lubosz Sarnecki Date: Wed, 11 Jun 2014 20:33:32 +0200 Subject: [PATCH 2/6] arch: Add Arch Linux support --- cerbero/bootstrap/linux.py | 27 +++++++++++++++++++++++++++ cerbero/enums.py | 2 ++ cerbero/utils/__init__.py | 4 ++++ 3 files changed, 33 insertions(+) diff --git a/cerbero/bootstrap/linux.py b/cerbero/bootstrap/linux.py index c096807..7e3d0fc 100644 --- a/cerbero/bootstrap/linux.py +++ b/cerbero/bootstrap/linux.py @@ -21,6 +21,7 @@ from cerbero.bootstrap.bootstrapper import register_bootstrapper from cerbero.config import Platform, Architecture, Distro, DistroVersion from cerbero.utils import shell +import subprocess class UnixBootstrapper (BootstrapperBase): @@ -110,8 +111,34 @@ class OpenSuseBootstrapper (UnixBootstrapper): 'perl-XML-Simple', 'gperf', 'gdk-pixbuf-devel', 'wget', 'docbook-utils', 'glib-networking'] +class ArchBootstrapper (UnixBootstrapper): + + tool = 'sudo pacman -S %s --needed' + packages = ['intltool', 'cmake', 'doxygen', 'gtk-doc', + 'libtool', 'bison', 'flex', 'automake', 'autoconf', 'make', + 'curl', 'gettext', 'alsa-lib', 'yasm', 'gperf', + 'docbook-xsl', 'transfig', 'libxrender', + 'libxv', 'mesa', 'python2', 'wget', 'glib-networking'] + + def __init__(self, config): + UnixBootstrapper.__init__(self, config) + + is_64bit = "x86_64" in subprocess.check_output(["uname", "-m"]) + has_multilib = True + + try: + subprocess.check_output(["pacman", "-Sp", "gcc-multilib"]) + except subprocess.CalledProcessError: + has_multilib = False + + if is_64bit and has_multilib: + self.packages.append('gcc-multilib') + else: + self.packages.append('gcc') + def register_all(): register_bootstrapper(Distro.DEBIAN, DebianBootstrapper) register_bootstrapper(Distro.REDHAT, RedHatBootstrapper) register_bootstrapper(Distro.SUSE, OpenSuseBootstrapper) + register_bootstrapper(Distro.ARCH, ArchBootstrapper) diff --git a/cerbero/enums.py b/cerbero/enums.py index 5c26ef2..2af06d5 100644 --- a/cerbero/enums.py +++ b/cerbero/enums.py @@ -48,6 +48,7 @@ class Distro: REDHAT = 'redhat' SUSE = 'suse' WINDOWS = 'windows' + ARCH = 'arch' OS_X = 'osx' IOS = 'ios' ANDROID = 'android' @@ -74,6 +75,7 @@ class DistroVersion: FEDORA_19 = 'fedora_19' FEDORA_20 = 'fedora_20' REDHAT_6 = 'redhat_6' + ARCH_ROLLING = 'rolling' OPENSUSE_12_1 = 'opensuse_12_1' OPENSUSE_12_2 = 'opensuse_12_2' OPENSUSE_12_3 = 'opensuse_12_3' diff --git a/cerbero/utils/__init__.py b/cerbero/utils/__init__.py index f16c7a6..81d2672 100644 --- a/cerbero/utils/__init__.py +++ b/cerbero/utils/__init__.py @@ -19,6 +19,7 @@ import os import shutil import sys +import subprocess try: import sysconfig except: @@ -185,6 +186,9 @@ def system_info(): # FIXME Fill this raise FatalError("Distribution OpenSuse '%s' " "not supported" % str(d)) + elif "Arch" in subprocess.check_output(["lsb_release", "-i"]): + distro = Distro.ARCH + distro_version = DistroVersion.ARCH_ROLLING else: raise FatalError("Distribution '%s' not supported" % str(d)) elif platform == Platform.WINDOWS: -- 2.0.0