[jhbuild: 9/27] new clean command (GNOME #143221)
- From: Frederic Peters <fpeters src gnome org>
- To: svn-commits-list gnome org
- Subject: [jhbuild: 9/27] new clean command (GNOME #143221)
- Date: Sat, 16 May 2009 09:37:32 -0400 (EDT)
commit 4e660671d9f278e97e722b6ef6eda2d8a293ac78
Author: Frederic Peters <fpeters 0d be>
Date: Tue May 5 17:39:17 2009 +0200
new clean command (GNOME #143221)
---
jhbuild/commands/clean.py | 70 +++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 70 insertions(+), 0 deletions(-)
diff --git a/jhbuild/commands/clean.py b/jhbuild/commands/clean.py
new file mode 100644
index 0000000..864755b
--- /dev/null
+++ b/jhbuild/commands/clean.py
@@ -0,0 +1,70 @@
+# jhbuild - a build script for GNOME 1.x and 2.x
+# Copyright (C) 2001-2006 James Henstridge
+#
+# base.py: the most common jhbuild commands
+#
+# 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
+
+from optparse import make_option
+
+import jhbuild.moduleset
+import jhbuild.frontends
+from jhbuild.errors import UsageError, FatalError
+from jhbuild.commands import Command, register_command
+
+
+class cmd_clean(Command):
+ doc = _('Clean all modules')
+
+ name = 'clean'
+ usage_args = '[ options ... ] [ modules ... ]'
+
+ def __init__(self):
+ Command.__init__(self, [
+ make_option('-s', '--skip', metavar='MODULES',
+ action='append', dest='skip', default=[],
+ help=_('treat the given modules as up to date')),
+ make_option('-t', '--start-at', metavar='MODULE',
+ action='store', dest='startat', default=None,
+ help=_('start building at the given module')),
+ ])
+
+ def run(self, config, options, args):
+ for item in options.skip:
+ config.skip += item.split(',')
+
+ module_set = jhbuild.moduleset.load(config)
+ module_list = module_set.get_module_list(args or config.modules, config.skip)
+ # remove modules up to startat
+ if options.startat:
+ while module_list and module_list[0].name != options.startat:
+ del module_list[0]
+ if not module_list:
+ raise FatalError(_('%s not in module list') % options.startat)
+
+ # remove modules that are not marked as installed
+ packagedb = jhbuild.frontends.get_buildscript(config, []).packagedb
+ for module in module_list[:]:
+ if not packagedb.check(module.name):
+ module_list.remove(module)
+
+ config.nonetwork = True
+ config.nopoison = True
+ config.build_targets = ['clean']
+
+ build = jhbuild.frontends.get_buildscript(config, module_list)
+ return build.build()
+
+register_command(cmd_clean)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]