jhbuild r2508 - in trunk: . jhbuild/commands jhbuild/versioncontrol
- From: johncarr svn gnome org
- To: svn-commits-list gnome org
- Subject: jhbuild r2508 - in trunk: . jhbuild/commands jhbuild/versioncontrol
- Date: Thu, 13 Nov 2008 15:05:27 +0000 (UTC)
Author: johncarr
Date: Thu Nov 13 15:05:26 2008
New Revision: 2508
URL: http://svn.gnome.org/viewvc/jhbuild?rev=2508&view=rev
Log:
Add an exists() function to check if a module/branch definition is correct.
Add jhbuild checkmodulesets command to find modules that can't be checked out.
Added:
trunk/jhbuild/commands/checkmodulesets.py
Modified:
trunk/ChangeLog
trunk/jhbuild/versioncontrol/__init__.py
trunk/jhbuild/versioncontrol/bzr.py
trunk/jhbuild/versioncontrol/git.py
trunk/jhbuild/versioncontrol/svn.py
Added: trunk/jhbuild/commands/checkmodulesets.py
==============================================================================
--- (empty file)
+++ trunk/jhbuild/commands/checkmodulesets.py Thu Nov 13 15:05:26 2008
@@ -0,0 +1,46 @@
+# jhbuild - a build script for GNOME 1.x and 2.x
+# Copyright (C) 2001-2004 James Henstridge
+#
+# checkmodulesets.py: check GNOME module sets for missing branches definition
+#
+# 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
+
+
+
+import urllib2
+from optparse import make_option
+
+import jhbuild.moduleset
+from jhbuild.commands import Command, register_command
+
+class cmd_checkmodulesets(Command):
+ doc = _('Check modules in jhbuild have the correct definition')
+ name = 'checkmodulesets'
+
+ def run(self, config, options, args):
+ module_set = jhbuild.moduleset.load(config)
+ module_list = module_set.get_full_module_list()
+ for mod in module_list:
+ if mod.type in ('meta', 'tarball'):
+ continue
+
+ try:
+ if not mod.branch.exists():
+ uprint(_('E: %(module)s is unreachable!') % {'module': mod.name,})
+ except NotImplementedError:
+ if False:
+ uprint(_('W: Cannot check %(module)s') % {'module': mod.name,})
+
+register_command(cmd_checkmodulesets)
Modified: trunk/jhbuild/versioncontrol/__init__.py
==============================================================================
--- trunk/jhbuild/versioncontrol/__init__.py (original)
+++ trunk/jhbuild/versioncontrol/__init__.py Thu Nov 13 15:05:26 2008
@@ -82,6 +82,12 @@
raise NotImplementedError
branchname = property(branchname)
+ def exists(self):
+ """Return True if branch exists or False if not.
+
+ May raise NotImplementedError if cannot check a given branch."""
+ raise NotImplementedError
+
def checkout(self, buildscript):
"""Checkout or update the given source directory.
Modified: trunk/jhbuild/versioncontrol/bzr.py
==============================================================================
--- trunk/jhbuild/versioncontrol/bzr.py (original)
+++ trunk/jhbuild/versioncontrol/bzr.py Thu Nov 13 15:05:26 2008
@@ -90,6 +90,13 @@
return None
branchname = property(branchname)
+ def exists(self):
+ try:
+ get_output(['bzr', 'ls', self.module])
+ return True
+ except:
+ return False
+
def _checkout(self, buildscript):
cmd = ['bzr', 'branch', self.module]
if self.checkoutdir:
Modified: trunk/jhbuild/versioncontrol/git.py
==============================================================================
--- trunk/jhbuild/versioncontrol/git.py (original)
+++ trunk/jhbuild/versioncontrol/git.py Thu Nov 13 15:05:26 2008
@@ -127,6 +127,16 @@
raise GitUnknownBranchNameError()
branchname = property(branchname)
+ def exists(self):
+ try:
+ refs = get_output(['git', 'ls-remote', self.module])
+ except:
+ return False
+
+ #FIXME: Parse output from ls-remote to work out if tag/branch is present
+
+ return True
+
def _get_commit_from_date(self):
cmd = ['git', 'log', '--max-count=1',
'--until=%s' % self.config.sticky_date]
Modified: trunk/jhbuild/versioncontrol/svn.py
==============================================================================
--- trunk/jhbuild/versioncontrol/svn.py (original)
+++ trunk/jhbuild/versioncontrol/svn.py Thu Nov 13 15:05:26 2008
@@ -192,6 +192,13 @@
return self.revision
branchname = property(branchname)
+ def exists(self):
+ try:
+ get_output(['svn', 'ls', self.module])
+ return True
+ except:
+ return False
+
def _export(self, buildscript):
cmd = ['svn', 'export', self.module]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]