1
# jhbuild - a build script for GNOME 1.x and 2.x
2
# Copyright (C) 2001-2004 James Henstridge
4
# checkbranches.py: check GNOME module sets for missing branches definition
6
# This program is free software; you can redistribute it and/or modify
7
# it under the terms of the GNU General Public License as published by
8
# the Free Software Foundation; either version 2 of the License, or
9
# (at your option) any later version.
11
# This program is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
# GNU General Public License for more details.
16
# You should have received a copy of the GNU General Public License
17
# along with this program; if not, write to the Free Software
18
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
from optparse import make_option
22
import jhbuild.moduleset
23
from jhbuild.commands import Command, register_command
24
from jhbuild.utils.cmds import get_output
25
from jhbuild.errors import CommandError
27
class cmd_checkbranches(Command):
28
doc = N_('Check modules in GNOME Git repository have the correct branch definition')
29
name = 'checkbranches'
32
Command.__init__(self, [
33
make_option('-b', '--branch', metavar = 'BRANCH',
34
action = 'store', dest = 'branch', default = None)])
36
def run(self, config, options, args):
38
branch = options.branch
40
if type(config.moduleset) is list:
41
branch = config.moduleset[0].replace('.', '-')
43
branch = config.moduleset.replace('.', '-')
44
branch = branch.replace('gnome-suites-', 'gnome-')
46
module_set = jhbuild.moduleset.load(config)
47
module_list = module_set.get_module_list(args or config.modules)
48
for mod in module_list:
49
if mod.type in ('meta', 'tarball'):
51
if not mod.branch or not mod.branch.repository.__class__.__name__ == 'GitRepository':
53
if not 'git.gnome.org' in mod.branch.repository.href:
56
# there is already a branch defined
60
if get_output(['git', 'ls-remote',
61
'git://git.gnome.org/%s' % mod.name,
62
'refs/heads/%s' % branch]):
63
uprint(_('%(module)s is missing branch definition for %(branch)s') % {'module': mod.name, 'branch': branch})
68
register_command(cmd_checkbranches)