From 3caabbed9f95de37367c0dd3b2f1e87edef471b2 Mon Sep 17 00:00:00 2001 From: Daniel Narvaez Date: Mon, 10 Dec 2012 23:51:55 +0000 Subject: Improve multilib support --- (limited to 'devbot') diff --git a/devbot/config.py b/devbot/config.py index ed0f355..c53adf4 100644 --- a/devbot/config.py +++ b/devbot/config.py @@ -24,6 +24,7 @@ home_dir = None dep_files = None package_files = None prefs_path = None +system_lib_dirs = None _source_dir = None _build_dir = None @@ -115,7 +116,7 @@ def _get_prefix_dir(dir, relocatable): return prefix_dir def set_install_dir(dir, relocatable=False): - global system_lib_dir + global system_lib_dirs global install_dir global prefix_dir global share_dir @@ -137,12 +138,17 @@ def set_install_dir(dir, relocatable=False): etc_dir = os.path.join(prefix_dir, "etc") libexec_dir = os.path.join(prefix_dir, "libexec") - if distro.get_distro_info().use_lib64: - lib_dir = os.path.join(prefix_dir, "lib64") - system_lib_dir = "/usr/lib64" - else: - lib_dir = os.path.join(prefix_dir, "lib") - system_lib_dir = "/usr/lib" + distro_info = distro.get_distro_info() + + relative_lib_dir = distro_info.lib_dir + if relative_lib_dir is None: + relative_lib_dir = "/usr" + + lib_dir = os.path.join(prefix_dir, relative_lib_dir) + + system_lib_dirs = ["/usr/lib"] + if distro_info.lib_dir is not None: + system_lib_dirs.append(os.path.join("/usr", distro_info.lib_dir)) def set_source_dir(dir): global _source_dir diff --git a/devbot/distro.py b/devbot/distro.py index 2c991fa..951ea21 100644 --- a/devbot/distro.py +++ b/devbot/distro.py @@ -25,7 +25,7 @@ def print_distro_info(): print "Version: %s" % info.version print "GNOME version: %s" % info.gnome_version print "Gstreamer version: %s" % info.gstreamer_version - print "Use lib64: %s" % info.use_lib64 + print "Lib directory: %s" % info.lib_dir print "Supported: %s\n" % info.supported def get_distro_info(): diff --git a/devbot/environ.py b/devbot/environ.py index fb4ac34..b9c0238 100644 --- a/devbot/environ.py +++ b/devbot/environ.py @@ -34,12 +34,6 @@ def _setup_variables(): os.path.join(config.share_dir, "aclocal")) _add_path("XCURSOR_PATH", os.path.join(config.share_dir, "icons")) - _add_path("GIO_EXTRA_MODULES", - os.path.join(config.system_lib_dir, "gio", "modules")) - _add_path("GI_TYPELIB_PATH", - os.path.join(config.system_lib_dir, "girepository-1.0")) - _add_path("GI_TYPELIB_PATH", - os.path.join(config.lib_dir, "girepository-1.0")) _add_path("PKG_CONFIG_PATH", os.path.join(config.lib_dir, "pkgconfig")) _add_path("GST_PLUGIN_PATH", @@ -58,6 +52,18 @@ def _setup_variables(): _add_path("XDG_CONFIG_DIRS", "/etc") _add_path("XDG_CONFIG_DIRS", config.etc_dir) + for system_lib_dir in config.system_lib_dirs: + modules_path = os.path.join(system_lib_dir, "gio", "modules") + if os.path.exists(modules_path): + _add_path("GIO_EXTRA_MODULES", modules_path) + + typelib_path = os.path.join(system_lib_dir, "girepository-1.0") + if os.path.exists(typelib_path): + _add_path("GI_TYPELIB_PATH", typelib_path) + + _add_path("GI_TYPELIB_PATH", + os.path.join(config.lib_dir, "girepository-1.0")) + os.environ["GTK_DATA_PREFIX"] = config.prefix_dir os.environ["GTK_PATH"] = os.path.join(config.lib_dir, "gtk-2.0") os.environ["XDG_DATA_HOME"] = os.path.join(config.home_dir, "data") diff --git a/devbot/plugins/debian.py b/devbot/plugins/debian.py index 0b340e8..53e6bc4 100644 --- a/devbot/plugins/debian.py +++ b/devbot/plugins/debian.py @@ -94,7 +94,12 @@ class DistroInfo(interfaces.DistroInfo): self.gstreamer_version = "0.10" self.valid = True self.supported = (arch in ["i686", "x86_64"]) - self.use_lib64 = False + self.lib_dir = None + + if arch == "i686": + self.lib_dir = "lib/i386-linux-gnu" + elif arch == "x86_64": + self.lib_dir = "lib/x86_64-linux-gnu" try: with open(self._DEBIAN_VERSION_PATH) as f: diff --git a/devbot/plugins/fedora.py b/devbot/plugins/fedora.py index 862ca81..df0aef7 100644 --- a/devbot/plugins/fedora.py +++ b/devbot/plugins/fedora.py @@ -91,9 +91,12 @@ class DistroInfo(interfaces.DistroInfo): self.version = "unknown" self.gnome_version = "3.6" self.gstreamer_version = "1.0" - self.use_lib64 = (arch == "x86_64") self.valid = True self.supported = (arch in ["i386", "i686", "x86_64"]) + self.lib_dir = None + + if arch == "x86_64": + self.lib_dir = "lib64" try: release = open(self._FEDORA_RELEASE_PATH).read().strip() diff --git a/devbot/plugins/interfaces.py b/devbot/plugins/interfaces.py index d8659bf..8c97c65 100644 --- a/devbot/plugins/interfaces.py +++ b/devbot/plugins/interfaces.py @@ -54,8 +54,10 @@ class DistroInfo: attributes are all valid. """ - self.use_lib64 = False - """If set to True install libraries in the lib64 directory.""" + self.lib_dir = False + """Path to the architecture specific lib directory, relative + to the prefix. + """ self.supported = False """If set to Trye the distribution is supported.""" diff --git a/devbot/plugins/ubuntu.py b/devbot/plugins/ubuntu.py index 140d8ad..005871c 100644 --- a/devbot/plugins/ubuntu.py +++ b/devbot/plugins/ubuntu.py @@ -17,7 +17,12 @@ class DistroInfo(interfaces.DistroInfo): self.gstreamer_version = "1.0" self.valid = True self.supported = (arch in ["i386", "i686", "x86_64"]) - self.use_lib64 = False + self.lib_dir = None + + if arch in ["i386", "i686"]: + self.lib_dir = "lib/i386-linux-gnu" + elif arch == "x86_64": + self.lib_dir = "lib/x86_64-linux-gnu" try: release = open(self._OS_RELEASE_PATH).read().strip() diff --git a/devbot/plugins/unknown.py b/devbot/plugins/unknown.py index 8589ef6..576edef 100644 --- a/devbot/plugins/unknown.py +++ b/devbot/plugins/unknown.py @@ -28,7 +28,7 @@ distro.register_package_manager("unknown", PackageManager) class DistroInfo(interfaces.DistroInfo): def __init__(self): - self.use_lib64 = os.path.exists("/usr/lib64") + self.lib_dir = None self.name = "unknown" self.version = "unknown" self.gnome_version = "3.4" diff --git a/devbot/system.py b/devbot/system.py index 4652169..85e2349 100644 --- a/devbot/system.py +++ b/devbot/system.py @@ -10,11 +10,6 @@ from devbot import state from devbot import utils from devbot import xvfb -libdirs = ["lib", - "lib64", - "lib/x86_64-linux-gnu", - "lib/i386-linux-gnu"] - def check_binary(check): return subprocess.call(["which", check], stdout=utils.devnull, @@ -32,8 +27,8 @@ def check_gtkmodule(check): # Not sure we can do better than this, the gtkmodule stuff is private missing = True - for libdir in libdirs: - if os.path.exists("/usr/%s/gtk-2.0/modules/lib%s.so" % (libdir, check)): + for libdir in config.system_lib_dirs: + if os.path.exists("%s/gtk-2.0/modules/lib%s.so" % (libdir, check)): missing = False return missing @@ -50,8 +45,8 @@ def check_metacity_theme(check): def check_gstreamer(check, version): missing = True - for libdir in libdirs: - if os.path.exists("/usr/%s/gstreamer-%s/libgst%s.so" % \ + for libdir in config.system_lib_dirs: + if os.path.exists("%s/gstreamer-%s/libgst%s.so" % \ (libdir, version, check)): missing = False -- cgit v0.9.1