[jhbuild/external-deps: 5/19] Actually install dependencies (via python-apt)
- From: John Carr <johncarr src gnome org>
- To: svn-commits-list gnome org
- Subject: [jhbuild/external-deps: 5/19] Actually install dependencies (via python-apt)
- Date: Tue, 2 Jun 2009 05:31:35 -0400 (EDT)
commit 8c3cd18a80f82ca323bb4215b904ada8c500434c
Author: John Carr <john carr unrouted co uk>
Date: Thu May 28 15:30:51 2009 +0100
Actually install dependencies (via python-apt)
---
jhbuild/commands/builddeps.py | 61 +++++++++++++++++++++++++++++++++++++++
jhbuild/utils/systempackages.py | 12 ++++++-
2 files changed, 71 insertions(+), 2 deletions(-)
diff --git a/jhbuild/commands/builddeps.py b/jhbuild/commands/builddeps.py
new file mode 100644
index 0000000..69b4f0d
--- /dev/null
+++ b/jhbuild/commands/builddeps.py
@@ -0,0 +1,61 @@
+# jhbuild - a build script for GNOME 1.x and 2.x
+# Copyright (C) 2009 Codethink Ltd.
+#
+# builddeps.py: satisfy build dependencies from system packages
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Authors:
+# John Carr <john carr unrouted co uk>
+
+from optparse import make_option
+
+import jhbuild.moduleset
+import jhbuild.frontends
+from jhbuild.errors import UsageError, FatalError, CommandError
+from jhbuild.commands import Command, register_command
+
+from jhbuild.utils import systempackages
+
+class cmd_builddeps(Command):
+ doc = N_('Get build dependencies for modules')
+
+ name = 'builddeps'
+ usage_args = N_('[ options ... ] [ modules ... ]')
+
+ def __init__(self):
+ Command.__init__(self, [
+ make_option('--dryrun',
+ action='store_true', dest='dryrun', default=False,
+ help=_('Just show which packages would be installed')),
+ ])
+
+ def run(self, config, options, args):
+ pkgs = systempackages.get_system_packages()
+ module_set = jhbuild.moduleset.load(config)
+
+ to_install = []
+
+ for module in module_set.get_module_list(args or config.modules):
+ if pkgs.satisfiable(module.name, module) and not pkgs.satisfied(module.name, module):
+ to_install.append(module.name)
+
+ if options.dryrun:
+ print "Will install: %s" % " ".join(to_install)
+ else:
+ pkgs.install(to_install)
+
+register_command(cmd_builddeps)
+
diff --git a/jhbuild/utils/systempackages.py b/jhbuild/utils/systempackages.py
index d1fbb1b..b92a665 100644
--- a/jhbuild/utils/systempackages.py
+++ b/jhbuild/utils/systempackages.py
@@ -82,10 +82,18 @@ class DebianPackages(SystemPackages):
return False
def install(self, names):
- buildscript.execute(['apt-get', 'install', ' '.join(name)])
+ import apt
+ fetchprogress = apt.progress.TextFetchProgress()
+ installprogress = apt.progress.InstallProgress()
+ cache = apt.Cache()
+ for name in names:
+ cache[name].markInstall()
+ cache.commit(fetchprogress, installprogress)
+ cache.open(apt.progress.OpProgress())
def remove(self, names):
- buildscript.execute(['apt-get', 'remove', ' '.join(name)])
+ #buildscript.execute(['apt-get', 'remove', ' '.join(name)])
+ pass
def supported(cls):
try:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]