[jhbuild/desrt/master: 26/28] add support for "virtual sysdeps"
- From: Ryan Lortie <desrt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [jhbuild/desrt/master: 26/28] add support for "virtual sysdeps"
- Date: Sun, 4 Jan 2015 01:04:07 +0000 (UTC)
commit 120c72b74a956bc1b4fbe686b050351bbfbcdf46
Author: Ryan Lortie <desrt desrt ca>
Date: Sat Jan 3 14:04:02 2015 -0500
add support for "virtual sysdeps"
jhbuild will now automatically add dependencies on things like "make",
"git" and "pkg-config" for various modules, depending on their modtype,
version control, etc.
If these new depends are not available as packages in the module set,
virtual ones will be created.
https://bugzilla.gnome.org/show_bug.cgi?id=742264
jhbuild/modtypes/__init__.py | 2 ++
jhbuild/modtypes/autotools.py | 2 ++
jhbuild/modtypes/cmake.py | 3 +++
jhbuild/modtypes/systemmodule.py | 9 +++++++--
jhbuild/moduleset.py | 26 ++++++++++++++++++++++++++
jhbuild/versioncontrol/__init__.py | 3 +++
jhbuild/versioncontrol/bzr.py | 3 +++
jhbuild/versioncontrol/cvs.py | 3 +++
jhbuild/versioncontrol/git.py | 3 +++
jhbuild/versioncontrol/hg.py | 3 +++
jhbuild/versioncontrol/svn.py | 3 +++
11 files changed, 58 insertions(+), 2 deletions(-)
---
diff --git a/jhbuild/modtypes/__init__.py b/jhbuild/modtypes/__init__.py
index 4ea3f3b..b7a06cc 100644
--- a/jhbuild/modtypes/__init__.py
+++ b/jhbuild/modtypes/__init__.py
@@ -492,6 +492,8 @@ them into the prefix."""
pkg_config = find_first_child_node_content(node, 'pkg-config')
if pkg_config:
instance.pkg_config = pkg_config
+ instance.dependencies += ['pkg-config']
+ instance.dependencies += instance.branch.repository.get_sysdeps()
return instance
class MakeModule(Package):
diff --git a/jhbuild/modtypes/autotools.py b/jhbuild/modtypes/autotools.py
index 5f23320..2e7380a 100644
--- a/jhbuild/modtypes/autotools.py
+++ b/jhbuild/modtypes/autotools.py
@@ -400,6 +400,8 @@ def collect_args(instance, node, argtype):
def parse_autotools(node, config, uri, repositories, default_repo):
instance = AutogenModule.parse_from_xml(node, config, uri, repositories, default_repo)
+ instance.dependencies += ['automake', 'libtool', 'make']
+
instance.autogenargs = collect_args (instance, node, 'autogenargs')
instance.makeargs = collect_args (instance, node, 'makeargs')
instance.makeinstallargs = collect_args (instance, node, 'makeinstallargs')
diff --git a/jhbuild/modtypes/cmake.py b/jhbuild/modtypes/cmake.py
index 9db2f2b..1d4e752 100644
--- a/jhbuild/modtypes/cmake.py
+++ b/jhbuild/modtypes/cmake.py
@@ -139,6 +139,9 @@ class CMakeModule(MakeModule, DownloadableModule):
def parse_cmake(node, config, uri, repositories, default_repo):
instance = CMakeModule.parse_from_xml(node, config, uri, repositories, default_repo)
+
+ instance.dependencies += ['cmake', 'make']
+
if node.hasAttribute('supports-non-srcdir-builds'):
instance.supports_non_srcdir_builds = \
(node.getAttribute('supports-non-srcdir-builds') != 'no')
diff --git a/jhbuild/modtypes/systemmodule.py b/jhbuild/modtypes/systemmodule.py
index 6a1ab27..f2e430e 100644
--- a/jhbuild/modtypes/systemmodule.py
+++ b/jhbuild/modtypes/systemmodule.py
@@ -25,12 +25,17 @@ __all__ = [ 'SystemModule' ]
class SystemModule(Package):
- pass
-
+ @classmethod
+ def create_virtual(cls, name, branch, deptype, value):
+ return cls(name, branch=branch, systemdependencies=[(deptype, value)])
def parse_systemmodule(node, config, uri, repositories, default_repo):
instance = SystemModule.parse_from_xml(node, config, uri, repositories,
default_repo)
+
+ if any(deptype == 'xml' for deptype, value in instance.systemdependencies):
+ instance.dependencies += ['xmlcatalog']
+
return instance
register_module_type('systemmodule', parse_systemmodule)
diff --git a/jhbuild/moduleset.py b/jhbuild/moduleset.py
index c3d64e3..47cf130 100644
--- a/jhbuild/moduleset.py
+++ b/jhbuild/moduleset.py
@@ -46,6 +46,20 @@ from jhbuild.utils import fileutils
__all__ = ['load', 'load_tests', 'get_default_repo']
+virtual_sysdeps = [
+ 'automake',
+ 'bzr',
+ 'cmake',
+ 'cvs',
+ 'git',
+ 'hg',
+ 'libtool',
+ 'make',
+ 'pkg-config',
+ 'svn',
+ 'xmlcatalog'
+]
+
_default_repo = None
def get_default_repo():
return _default_repo
@@ -523,6 +537,18 @@ def _parse_module_set(config, uri):
module.moduleset_name = moduleset_name
moduleset.add(module)
+ # create virtual sysdeps
+ system_repo_class = get_repo_type('system')
+ virtual_repo = system_repo_class(config, 'virtual-sysdeps')
+ virtual_branch = virtual_repo.branch('virtual-sysdeps') # just reuse this
+ for name in virtual_sysdeps:
+ # don't override it if it's already there
+ if name in moduleset.modules:
+ continue
+
+ virtual = SystemModule.create_virtual(name, virtual_branch, 'path', name)
+ moduleset.add (virtual)
+
# keep default repository around, used when creating automatic modules
global _default_repo
if default_repo:
diff --git a/jhbuild/versioncontrol/__init__.py b/jhbuild/versioncontrol/__init__.py
index 96b9d28..b6e80fb 100644
--- a/jhbuild/versioncontrol/__init__.py
+++ b/jhbuild/versioncontrol/__init__.py
@@ -64,6 +64,9 @@ class Repository:
"""Return an sxml representation of this repository."""
raise NotImplementedError
+ def get_sysdeps(self):
+ return []
+
class Branch:
"""An abstract class representing a branch in a repository."""
diff --git a/jhbuild/versioncontrol/bzr.py b/jhbuild/versioncontrol/bzr.py
index 284e12a..a13916b 100644
--- a/jhbuild/versioncontrol/bzr.py
+++ b/jhbuild/versioncontrol/bzr.py
@@ -101,6 +101,9 @@ class BzrRepository(Repository):
return [sxml.repository(type='bzr', name=self.name, href=self.href,
trunk=self.trunk_template, branches=self.branches_template)]
+ def get_sysdeps(self):
+ return ['bzr']
+
class BzrBranch(Branch):
"""A class representing a Bazaar branch."""
diff --git a/jhbuild/versioncontrol/cvs.py b/jhbuild/versioncontrol/cvs.py
index 8510c85..fc83927 100644
--- a/jhbuild/versioncontrol/cvs.py
+++ b/jhbuild/versioncontrol/cvs.py
@@ -209,6 +209,9 @@ class CVSRepository(Repository):
def to_sxml(self):
return [sxml.repository(type='cvs', name=self.name, cvsroot=self.cvsroot)]
+ def get_sysdeps(self):
+ return ['cvs']
+
class CVSBranch(Branch):
"""A class representing a CVS branch inside a CVS repository"""
diff --git a/jhbuild/versioncontrol/git.py b/jhbuild/versioncontrol/git.py
index 3862b5c..840d94f 100644
--- a/jhbuild/versioncontrol/git.py
+++ b/jhbuild/versioncontrol/git.py
@@ -128,6 +128,9 @@ class GitRepository(Repository):
def to_sxml(self):
return [sxml.repository(type='git', name=self.name, href=self.href)]
+ def get_sysdeps(self):
+ return ['git']
+
class GitBranch(Branch):
"""A class representing a GIT branch."""
diff --git a/jhbuild/versioncontrol/hg.py b/jhbuild/versioncontrol/hg.py
index 2ac47ee..6cc661a 100644
--- a/jhbuild/versioncontrol/hg.py
+++ b/jhbuild/versioncontrol/hg.py
@@ -62,6 +62,9 @@ class HgRepository(Repository):
module = self.href + module
return HgBranch(self, module, checkoutdir)
+ def get_sysdeps(self):
+ return ['hg']
+
class HgBranch(Branch):
"""A class representing a Mercurial branch."""
diff --git a/jhbuild/versioncontrol/svn.py b/jhbuild/versioncontrol/svn.py
index 0f49fdc..0a67316 100644
--- a/jhbuild/versioncontrol/svn.py
+++ b/jhbuild/versioncontrol/svn.py
@@ -174,6 +174,9 @@ class SubversionRepository(Repository):
def to_sxml(self):
return [sxml.repository(type='svn', name=self.name, href=self.href)]
+ def get_sysdeps(self):
+ return ['svn']
+
class SubversionBranch(Branch):
"""A class representing a Subversion branch"""
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]