Exemple #1
0
        # get all modules but those that are a dependency of modname
        dependencies_list = [x.name for x in module_set.get_module_list([modname])]
        dependencies_list.remove(modname)
        modules = module_set.get_full_module_list(skip = dependencies_list,
                ignore_cycles = True)
        modules = modules[[x.name for x in modules].index(modname)+1:]

        # iterate over remaining modules, and print those with modname as dep;
        # this is totally inefficient as a complete dependency list is computed
        # for each module.
        seen_modules = []
        for module in modules:
            if options.direct:
                if modname in module.dependencies:
                    uprint(module.name)
            else:
                module_list = module_set.get_module_list([module.name],
                                                         ignore_cycles=True,
                                                         ignore_missing=True)
                if modname in [x.name for x in module_list]:
                    seen_modules.append(module.name)
                    deps = ''
                    if options.dependencies:
                        dependencies = [x for x in module.dependencies if x in seen_modules]
                        if dependencies:
                            deps = '[' + ','.join(dependencies) + ']'
                    uprint(module.name, deps)

register_command(cmd_rdepends)
Exemple #2
0
        if not config.tinderbox_outputdir:
            raise UsageError(_('output directory for tinderbox build not specified'))

        module_set = jhbuild.moduleset.load(config)
        full_module_list = module_set.get_full_module_list \
                               (args or config.modules, config.skip)
        module_list = module_set.remove_system_modules(full_module_list)

        # 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)

        if config.check_sysdeps:
            module_state = module_set.get_system_modules(full_module_list)
            if not self.required_system_dependencies_installed(module_state):
                self.print_system_dependencies(module_state)
                raise FatalError(_('Required system dependencies not installed.'
                                   ' Install using the command %(cmd)s or to '
                                   'ignore system dependencies use command-line'
                                   ' option %(opt)s' \
                                   % {'cmd' : "'jhbuild sysdeps --install'",
                                      'opt' : '--nodeps'}))

        build = jhbuild.frontends.get_buildscript(config, module_list, module_set=module_set)
        return build.build()

register_command(cmd_tinderbox)
Exemple #3
0
#
# 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 jhbuild.commands import register_command
from jhbuild.commands.base import cmd_build
from jhbuild.utils import N_


class cmd_bootstrap(cmd_build):
    doc = N_('Build support tools')

    name = 'bootstrap'

    def run(self, config, options, args, help=None):
        config.moduleset = 'bootstrap'
        # load the bootstrap module set
        if not args:
            args = ['meta-bootstrap']

        for item in options.skip:
            config.skip += item.split(',')
        options.skip = []

        rc = cmd_build.run(self, config, options, args)
        return rc


register_command(cmd_bootstrap)
Exemple #4
0
        'Print out a moduleset for the exact versions that are checked out')
    name = 'snapshot'

    def __init__(self):
        Command.__init__(self)

    def run(self, config, options, args, help=None):
        module_set = jhbuild.moduleset.load(config)
        module_list = module_set.get_module_list(args or config.modules,
                                                 config.skip)
        meta = [m for m in module_list if m.type == 'meta']
        checked_out_mods = [
            m for m in module_list
            if getattr(m, 'branch', None) and m.branch.tree_id()
        ]
        checked_out_repos = []

        for mod in checked_out_mods:
            if mod.branch.repository not in checked_out_repos:
                checked_out_repos.append(mod.branch.repository)

        x = ([sxml.moduleset] + [r.to_sxml() for r in checked_out_repos] +
             [m.to_sxml()
              for m in checked_out_mods] + [m.to_sxml() for m in meta])

        bprint(b'<?xml version="1.0"?>\n')
        bprint(sxml_to_string(x).encode("utf-8") + b'\n')


register_command(cmd_snapshot)
Exemple #5
0
            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, help=None):
        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 = module_set.packagedb
        for module in module_list[:]:
            if not packagedb.check(module.name):
                module_list.remove(module)

        config.nopoison = True

        build = jhbuild.frontends.get_buildscript(config, module_list, module_set=module_set)
        return build.build(phases=['clean'])

register_command(cmd_clean)
Exemple #6
0
                include_suggests=not config.ignore_suggests)
        # 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)

        # don't actually perform build ...
        config.build_targets = ['checkout']
        config.nonetwork = False

        build = jhbuild.frontends.get_buildscript(config, module_list, module_set=module_set)
        return build.build()

register_command(cmd_update)


class cmd_updateone(Command):
    doc = N_('Update one or more modules from version control')

    name = 'updateone'
    usage_args = N_('[ options ... ] [ modules ... ]')

    def __init__(self):
        Command.__init__(self, [
            make_option('-D', metavar='DATE-SPEC',
                        action='store', dest='sticky_date', default=None,
                        help=_('set a sticky date when checking out modules')),
            ])
Exemple #7
0
import jhbuild.moduleset
from jhbuild.commands import Command, register_command


class cmd_checkmodulesets(Command):
    doc = N_('Check if modules in jhbuild have the correct definition')
    name = 'checkmodulesets'

    def run(self, config, options, args, help=None):
        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():
                    logging.error(
                        _('%(module)s is unreachable (%(href)s)') % {
                            'module': mod.name,
                            'href': mod.branch.module
                        })
            except NotImplementedError:
                logging.warning((_('Cannot check %(module)s (%(href)s)') % {
                    'module': mod.name,
                    'href': mod.branch.module
                }))


register_command(cmd_checkmodulesets)
Exemple #8
0
        if not (inpath('curl', os.environ['PATH'].split(os.pathsep))
                or inpath('wget', os.environ['PATH'].split(os.pathsep))):
            uprint(_('curl or wget not found'))

        # check for git:
        if not inpath('git', os.environ['PATH'].split(os.pathsep)):
            uprint(_('%s not found') % 'git')
        else:
            try:
                git_help = os.popen('git --help', 'r').read()
                if not 'clone' in git_help:
                    uprint(_('Installed git program is not the right git'))
                else:
                    if not check_version(['git', '--version'],
                                         r'git version ([\d.]+)', '1.5.6'):
                        uprint(_('%s not found') % 'git >= 1.5.6')
            except:
                uprint(_('Could not check git program'))

        # check for flex/bison:
        if not inpath('flex', os.environ['PATH'].split(os.pathsep)):
            uprint(_('%s not found') % 'flex')
        if not inpath('bison', os.environ['PATH'].split(os.pathsep)):
            uprint(_('%s not found') % 'bison')
        if not inpath('xzcat', os.environ['PATH'].split(os.pathsep)):
            uprint(_('%s not found') % 'xzcat')


register_command(cmd_sanitycheck)
Exemple #9
0
                check = self.checks[0].__name__
            else:
                continue

            self.false_positives[(module_name, check)] = extra


    def display_status_line(self, progress, module_num, message):
        if not curses:
            return
        columns = curses.tigetnum('cols')
        width = columns / 2
        num_hashes = int(round(progress * width))
        progress_bar = '[' + (num_hashes * '=') + ((width - num_hashes) * '-') + ']'

        module_no_digits = len(str(len(self.module_list)))
        format_str = '%%%dd' % module_no_digits
        module_pos = '[' + format_str % (module_num+1) + '/' + format_str % len(self.module_list) + ']'

        output = '%s %s %s%s%s' % (progress_bar, module_pos, t_bold, message, t_reset)
        if len(output) > columns:
            output = output[:columns]
        else:
            output += ' ' * (columns-len(output))

        sys.stdout.write(output + '\r')
        sys.stdout.flush()


register_command(cmd_goalreport)
Exemple #10
0
            if len(rdeps) > 5:
                rdeps = rdeps[:4] + [_('and %d others.')  % (len(rdeps)-4)]
            print >> output, '<td class="rdeps">%s</td>' % ', '.join(rdeps)
            print >> output, '</tr>'

        print >> output, '</tbody>'
        print >> output, '</table>'

        print >> output, '<div id="footer">'
        print >> output, 'Generated:', time.strftime('%Y-%m-%d %H:%M:%S %z')
        print >> output, 'on ', socket.getfqdn()
        print >> output, '</div>'

        print >> output, '</body>'
        print >> output, '</html>'

        if output != sys.stdout:
            file(options.output, 'w').write(output.getvalue())


    def compute_rdeps(self, module):
        rdeps = []
        for mod in self.module_set.modules.values():
            if mod.type == 'meta': continue
            if module.name in mod.dependencies:
                rdeps.append(mod.name)
        rdeps.sort(lambda x,y: cmp(x.lower(), y.lower()))
        return rdeps

register_command(cmd_extdeps)
Exemple #11
0
    def run(self, config, options, args, help=None):
        for item in options.skip:
            config.skip += item.split(',')

        config.ignore_conditions = options.ignore_conditions
        module_set = jhbuild.moduleset.load(config)
        config.ignore_conditions = False
        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)

        config.compress = options.compress
        config.nonet = options.nonet

        build = jhbuild.frontends.get_buildscript(config,
                                                  module_list,
                                                  module_set=module_set)
        build.config.build_policy = "all"
        if options.dist_only:
            return build.build(phases=['dist'])
        else:
            return build.build(targets=['dist'])


register_command(cmd_dist)
Exemple #12
0

import urllib2
from optparse import make_option
import logging

import jhbuild.moduleset
from jhbuild.commands import Command, register_command

class cmd_checkmodulesets(Command):
    doc = N_('Check if modules in JHBuild have the correct definition')
    name = 'checkmodulesets'

    def run(self, config, options, args, help=None):
        module_set = jhbuild.moduleset.load(config)
        module_list = module_set.get_full_module_list \
                          (warn_about_circular_dependencies = True)
        for mod in module_list:
            if mod.type in ('meta', 'tarball'):
                continue

            try:
                if not mod.branch.exists():
                    logging.error(_('%(module)s is unreachable (%(href)s)') % {
                            'module': mod.name, 'href': mod.branch.module})
            except NotImplementedError:
                logging.warning((_('Cannot check %(module)s (%(href)s)') % {
                            'module': mod.name, 'href': mod.branch.module}))

register_command(cmd_checkmodulesets)
Exemple #13
0
                rdeps = rdeps[:4] + [_('and %d others.') % (len(rdeps) - 4)]
            print('<td class="rdeps">%s</td>' % ', '.join(rdeps), file=output)
            print('</tr>', file=output)

        print('</tbody>', file=output)
        print('</table>', file=output)

        print('<div id="footer">', file=output)
        print('Generated:', time.strftime('%Y-%m-%d %H:%M:%S %z'), file=output)
        print('on ', socket.getfqdn(), file=output)
        print('</div>', file=output)

        print('</body>', file=output)
        print('</html>', file=output)

        if output != sys.stdout:
            open_text(options.output, 'w').write(output.getvalue())

    def compute_rdeps(self, module):
        rdeps = []
        for mod in self.module_set.modules.values():
            if mod.type == 'meta':
                continue
            if module.name in mod.dependencies:
                rdeps.append(mod.name)
        rdeps.sort(key=lambda x: x.lower())
        return rdeps


register_command(cmd_extdeps)
Exemple #14
0
                uprint(_('Could not check git program'))

        # check for flex/bison:
        if not inpath('flex', os.environ['PATH'].split(os.pathsep)):
            uprint(_('%s not found') % 'flex')
        if not inpath('bison', os.environ['PATH'].split(os.pathsep)):
            uprint(_('%s not found') % 'bison')
        if not inpath('xzcat', os.environ['PATH'].split(os.pathsep)):
            uprint(_('%s not found') % 'xzcat')

    def check_m4(self):
        try:
            not_in_path = []
            path = get_aclocal_path()

            macros = ['libtool.m4', 'gettext.m4', 'pkg.m4']
            for macro in macros:
                if not inpath (macro, path):
                    uprint(_("aclocal can't see %s macros") % (macro.split('.m4')[0]))
                    if not_in_path.count(macro) == 0:
                        not_in_path.append(macro)

            if len(not_in_path) > 0:
                uprint(_("Please copy the lacking macros (%(macros)s) in one of the following paths: %(path)s") % \
                       {'macros': ', '.join(not_in_path), 'path': ', '.join(path)})

        except CommandError as exc:
            uprint(str(exc))

register_command(cmd_sanitycheck)
Exemple #15
0
class cmd_snapshot(Command):
    doc = N_("Print out a moduleset for the exact versions that are checked out")
    name = "snapshot"

    def __init__(self):
        Command.__init__(self)

    def run(self, config, options, args, help=None):
        module_set = jhbuild.moduleset.load(config)
        module_list = module_set.get_module_list(args or config.modules, config.skip)
        meta = [m for m in module_list if m.type == "meta"]
        checked_out_mods = [m for m in module_list if getattr(m, "branch", None) and m.branch.tree_id()]
        checked_out_repos = []

        for mod in checked_out_mods:
            if mod.branch.repository not in checked_out_repos:
                checked_out_repos.append(mod.branch.repository)

        x = (
            [sxml.moduleset]
            + [r.to_sxml() for r in checked_out_repos]
            + [m.to_sxml() for m in checked_out_mods]
            + [m.to_sxml() for m in meta]
        )

        print '<?xml version="1.0"?>\n'
        print sxml_to_string(x)


register_command(cmd_snapshot)
Exemple #16
0
        module_set = jhbuild.moduleset.load(config)
        full_module_list = module_set.get_full_module_list(
            args or config.modules, config.skip)
        module_list = module_set.remove_system_modules(full_module_list)

        # 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)

        if config.check_sysdeps:
            module_state = module_set.get_module_state(full_module_list)
            if not self.required_system_dependencies_installed(module_state):
                self.print_system_dependencies(module_state)
                raise FatalError(_('Required system dependencies not installed.'
                                   ' Install using the command %(cmd)s or to '
                                   'ignore system dependencies use command-line'
                                   ' option %(opt)s' \
                                   % {'cmd' : "'jhbuild sysdeps --install'",
                                      'opt' : '--nodeps'}))

        build = jhbuild.frontends.get_buildscript(config,
                                                  module_list,
                                                  module_set=module_set)
        return build.build()


register_command(cmd_tinderbox)
Exemple #17
0
                        '--start-at',
                        metavar='MODULE',
                        action='store',
                        dest='startat',
                        default=None,
                        help=_('start building at the given module')),
        ])

    def run(self, config, options, args, help=None):
        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)

        build = jhbuild.frontends.get_buildscript(config,
                                                  module_list,
                                                  module_set=module_set)
        build.config.build_targets.insert(0, 'check')
        return build.build(phases=['check'])


register_command(cmd_check)
Exemple #18
0
        config.makeargs = makeargs

        module_set = jhbuild.moduleset.load(config)

        if not cwd.startswith(config.checkoutroot):
            logging.error(_('The current directory is not in the checkout root %r') % (config.checkoutroot, ))
            return False

        cwd = cwd[len(config.checkoutroot):]
        cwd = cwd.lstrip(os.sep)
        modname, _slash, _rest = cwd.partition(os.sep)

        try:
            module = module_set.get_module(modname, ignore_case=True)
        except KeyError as e:
            default_repo = jhbuild.moduleset.get_default_repo()
            if not default_repo:
                logging.error(_('No module matching current directory %r in the moduleset') % (modname, ))
                return False
            from jhbuild.modtypes.autotools import AutogenModule
            module = AutogenModule(modname, default_repo.branch(modname))
            module.config = config
            logging.info(_('module "%(modname)s" does not exist, created automatically using repository "%(reponame)s"') % \
                         {'modname': modname, 'reponame': default_repo.name})

        build = jhbuild.frontends.get_buildscript(config, [module], module_set=module_set)
        return build.build()

register_command(cmd_make)

Exemple #19
0
                continue

            self.false_positives[(module_name, check)] = extra

    def display_status_line(self, progress, module_num, message):
        if not curses:
            return
        columns = curses.tigetnum('cols')
        width = columns / 2
        num_hashes = int(round(progress * width))
        progress_bar = '[' + (num_hashes * '=') + (
            (width - num_hashes) * '-') + ']'

        module_no_digits = len(str(len(self.module_list)))
        format_str = '%%%dd' % module_no_digits
        module_pos = '[' + format_str % (
            module_num + 1) + '/' + format_str % len(self.module_list) + ']'

        output = '%s %s %s%s%s' % (progress_bar, module_pos, t_bold, message,
                                   t_reset)
        if len(output) > columns:
            output = output[:columns]
        else:
            output += ' ' * (columns - len(output))

        sys.stdout.write(output + '\r')
        sys.stdout.flush()


register_command(cmd_goalreport)
Exemple #20
0
        dependencies_list = [
            x.name for x in module_set.get_module_list([modname])
        ]
        dependencies_list.remove(modname)
        modules = module_set.get_full_module_list(skip=dependencies_list)
        modules = modules[[x.name for x in modules].index(modname) + 1:]

        # iterate over remaining modules, and print those with modname as dep;
        # this is totally inefficient as a complete dependency list is computed
        # for each module.
        seen_modules = []
        for module in modules:
            if options.direct:
                if modname in module.dependencies:
                    uprint(module.name)
            else:
                module_list = module_set.get_module_list([module.name])
                if modname in [x.name for x in module_list]:
                    seen_modules.append(module.name)
                    deps = ''
                    if options.dependencies:
                        dependencies = [
                            x for x in module.dependencies if x in seen_modules
                        ]
                        if dependencies:
                            deps = '[' + ','.join(dependencies) + ']'
                    uprint(module.name, deps)


register_command(cmd_rdepends)
Exemple #21
0
        default_repo = jhbuild.moduleset.get_default_repo()
        for modname in args:
            try:
                module = module_set.get_module(modname,
                                               ignore_case = True)
            except KeyError:
                if not default_repo:
                    raise FatalError(_('unknown module %s and no default repository to try an automatic module') % modname)

                logging.info(_('module "%(modname)s" does not exist, created automatically using repository "%(reponame)s"') % \
                         {'modname': modname, 'reponame': default_repo.name})
                module = AutogenModule(modname, default_repo.branch(modname))
                module.config = config

            module_list.append(module)

        if not module_list:
            self.parser.error(_('This command requires a module parameter.'))

        # remove modules that are not marked as installed
        packagedb = module_set.packagedb
        for module in module_list[:]:
            if not packagedb.check(module.name):
                logging.warn(_('Module %(mod)r is not installed') % {'mod': module.name })
                module_list.remove(module)
            else:
                packagedb.uninstall(module.name)


register_command(cmd_uninstall)
Exemple #22
0
# 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 pygtk
pygtk.require('2.0')
import gtk

from jhbuild.commands import Command, register_command
import jhbuild.frontends


class cmd_gui(Command):
    doc = N_('Build targets from a GUI app')

    name = 'gui'
    usage_args = ''

    def run(self, config, options, args, help=None):
        # request GTK build script.
        config.buildscript = 'gtkui'

        build = jhbuild.frontends.get_buildscript(config)
        build.show()
        gtk.main()


register_command(cmd_gui)
Exemple #23
0
                branch = config.moduleset[0].replace('.', '-')
            else:
                branch = config.moduleset.replace('.', '-')
            for prefix in ('gnome-suites-core-deps', 'gnome-suites-core',
                           'gnome-suites-', 'gnome-apps-'):
                branch = branch.replace(prefix, 'gnome-')

        module_set = jhbuild.moduleset.load(config)
        module_list = module_set.get_module_list(args or config.modules)
        for mod in module_list:
            if mod.type in ('meta', 'tarball'):
                continue
            if not mod.branch or not mod.branch.repository.__class__.__name__ == 'GitRepository':
                continue
            if not 'git.gnome.org' in mod.branch.repository.href:
                continue
            if mod.branch.branch:
                # there is already a branch defined
                continue

            try:
                if get_output(['git', 'ls-remote',
                        'git://git.gnome.org/%s' % mod.name,
                        'refs/heads/%s' % branch]):
                    uprint(_('%(module)s is missing branch definition for %(branch)s') % {'module': mod.name, 'branch': branch})
            except CommandError:
                pass


register_command(cmd_checkbranches)
Exemple #24
0
                             module.pkg_config[:-3]))  # remove .pc

            if len(uninstalled) == 0:
                print(_('    (none)'))

        if options.install:
            installer = SystemInstall.find_best()
            if installer is None:
                # FIXME: This should be implemented per Colin's design:
                # https://bugzilla.gnome.org/show_bug.cgi?id=682104#c3
                if cmds.has_command('apt-get'):
                    raise FatalError(
                        _("%(cmd)s is required to install "
                          "packages on this system. Please "
                          "install %(cmd)s.") % {'cmd': 'apt-file'})

                raise FatalError(
                    _("Don't know how to install packages on this system"))

            if len(uninstalled) == 0:
                logging.info(
                    _("No uninstalled system dependencies to install for modules: %r"
                      ) % (modules, ))
            else:
                logging.info(_("Installing dependencies on system: %s") % \
                             ' '.join(pkg[0] for pkg in uninstalled))
                installer.install(uninstalled, assume_yes=options.assume_yes)


register_command(cmd_sysdeps)
Exemple #25
0
                        '--output',
                        metavar='FILE',
                        action='store',
                        dest='output',
                        default=None),
            make_option('--devhelp-dirname',
                        metavar='DIR',
                        action='store',
                        dest='devhelp_dirname',
                        default=None),
            make_option('--no-cache',
                        action='store_true',
                        dest='nocache',
                        default=False),
            make_option('--all-modules',
                        action='store_true',
                        dest='list_all_modules',
                        default=False),
        ])

    def run(self, config, options, args, help=None):
        options.cache = 'twoninetynine.pck'
        if options.nocache:
            options.cache = None
        options.bugfile = 'http://live.gnome.org/FredericPeters/Bugs299?action=raw'
        options.falsepositivesfile = 'http://live.gnome.org/FredericPeters/FalsePositives299?action=raw'
        return cmd_goalreport.run(self, config, options, args)


register_command(cmd_twoninetynine)
Exemple #26
0
        module_set = jhbuild.moduleset.load(config)
        module_list = module_set.get_module_list(args or config.modules)
        for mod in module_list:
            if mod.type in ('meta', 'tarball'):
                continue
            if not mod.branch or not mod.branch.repository.__class__.__name__ == 'GitRepository':
                continue
            if 'git.gnome.org' not in mod.branch.repository.href:
                continue
            if mod.branch.branch:
                # there is already a branch defined
                continue

            try:
                if get_output([
                        'git', 'ls-remote',
                        'https://git.gnome.org/browse/%s' % mod.name,
                        'refs/heads/%s' % branch
                ]):
                    uprint(
                        _('%(module)s is missing branch definition for %(branch)s'
                          ) % {
                              'module': mod.name,
                              'branch': branch
                          })
            except CommandError:
                pass


register_command(cmd_checkbranches)
Exemple #27
0
                                                      installed_version)))
                    if module.pkg_config is not None:
                        uninstalled.append((module.name, 'pkgconfig', module.pkg_config[:-3])) # remove .pc

            if len(uninstalled) == 0:
                print _('    (none)')

        if options.install:
            installer = SystemInstall.find_best()
            if installer is None:
                # FIXME: This should be implemented per Colin's design:
                # https://bugzilla.gnome.org/show_bug.cgi?id=682104#c3
                if cmds.has_command('apt-get'):
                    raise FatalError(_("%(cmd)s is required to install "
                                       "packages on this system. Please "
                                       "install %(cmd)s.")
                                     % {'cmd' : 'apt-file'})

                raise FatalError(_("Don't know how to install packages on this system"))

            if len(uninstalled) == 0:
                logging.info(_("No uninstalled system dependencies to install for modules: %r") % (modules, ))
                return

            logging.info(_("Installing dependencies on system: %s") % \
                           ' '.join(pkg[0] for pkg in uninstalled))
            installer.install(uninstalled)

register_command(cmd_sysdeps)

Exemple #28
0
                basedir = os.path.join(SRCDIR, 'buildbot')
        os.chdir(basedir)
        if not os.path.exists(os.path.join(basedir, 'builddir')):
            os.makedirs(os.path.join(basedir, 'builddir'))
        master_cfg_path = mastercfgfile

        JhBuildMaster(basedir, master_cfg_path).setServiceParent(application)

        JhBuildbotApplicationRunner.application = application
        JhBuildbotApplicationRunner(options).run()

    def stop(self, config, pidfile):
        try:
            pid = int(file(pidfile).read())
        except:
            raise FatalError(_('failed to get buildbot PID'))

        os.kill(pid, signal.SIGTERM)

    def reload_server_config(self, config, pidfile):
        try:
            pid = int(file(pidfile).read())
        except:
            raise FatalError(_('failed to get buildbot PID'))

        os.kill(pid, signal.SIGHUP)


register_command(cmd_bot)

Exemple #29
0
            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)

        # don't actually perform build ...
        config.build_targets = ['checkout']
        config.nonetwork = False

        build = jhbuild.frontends.get_buildscript(config,
                                                  module_list,
                                                  module_set=module_set)
        return build.build()


register_command(cmd_update)


class cmd_updateone(Command):
    doc = N_('Update one or more modules from version control')

    name = 'updateone'
    usage_args = N_('[ options ... ] [ modules ... ]')

    def __init__(self):
        Command.__init__(self, [
            make_option('-D',
                        metavar='DATE-SPEC',
                        action='store',
                        dest='sticky_date',
                        default=None,
                module = module_set.get_module(modname, ignore_case=True)
            except KeyError:
                if not default_repo:
                    raise FatalError(
                        _('unknown module %s and no default repository to try an automatic module'
                          ) % modname)

                logging.info(_('module "%(modname)s" does not exist, created automatically using repository "%(reponame)s"') % \
                         {'modname': modname, 'reponame': default_repo.name})
                module = AutogenModule(modname, default_repo.branch(modname))
                module.config = config

            module_list.append(module)

        if not module_list:
            self.parser.error(_('This command requires a module parameter.'))

        # remove modules that are not marked as installed
        packagedb = module_set.packagedb
        for module in module_list[:]:
            if not packagedb.check(module.name):
                logging.warn(
                    _('Module %(mod)r is not installed') %
                    {'mod': module.name})
                module_list.remove(module)
            else:
                packagedb.uninstall(module.name)


register_command(cmd_uninstall)
Exemple #31
0
                        dest='startat',
                        default=None,
                        help=_('start building at the given module')),
        ])

    def run(self, config, options, args, help=None):
        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)

        build = jhbuild.frontends.get_buildscript(config,
                                                  module_list,
                                                  module_set=module_set)
        build.config.build_targets = [
            'setup',
        ]
        build.config.build_policy = "all"
        return build.build()


register_command(cmd_setup)
Exemple #32
0
            logging.error(
                _('The current directory is not in the checkout root %r') %
                (config.checkoutroot, ))
            return False

        cwd = cwd[len(config.checkoutroot):]
        cwd = cwd.lstrip(os.sep)
        modname, _slash, _rest = cwd.partition(os.sep)

        try:
            module = module_set.get_module(modname, ignore_case=True)
        except KeyError, e:
            default_repo = jhbuild.moduleset.get_default_repo()
            if not default_repo:
                logging.error(
                    _('No module matching current directory %r in the moduleset'
                      ) % (modname, ))
                return False
            from jhbuild.modtypes.autotools import AutogenModule
            module = AutogenModule(modname, default_repo.branch(modname))
            module.config = config
            logging.info(_('module "%(modname)s" does not exist, created automatically using repository "%(reponame)s"') % \
                         {'modname': modname, 'reponame': default_repo.name})

        build = jhbuild.frontends.get_buildscript(config, [module],
                                                  module_set=module_set)
        return build.build()


register_command(cmd_make)
Exemple #33
0
        try:
            tree_id = module.branch.tree_id()
            uprint(_('Tree-ID:'), tree_id)
        except (NotImplementedError, AttributeError):
            pass
        try:
            source_dir = module.branch.srcdir
            uprint(_('Sourcedir:'), source_dir)
        except (NotImplementedError, AttributeError):
            pass

        # dependencies
        if module.dependencies:
            uprint(_('Requires:'), ', '.join(module.dependencies))
        requiredby = [ mod.name for mod in module_set.modules.values()
                       if module.name in mod.dependencies ]
        if requiredby:
            uprint(_('Required by:'), ', '.join(requiredby))
        if module.suggests:
            uprint(_('Suggests:'), ', '.join(module.suggests))
        if module.after:
            uprint(_('After:'), ', '.join(module.after))
        before = [ mod.name for mod in module_set.modules.values()
                   if module.name in mod.after ]
        if before:
            uprint(_('Before:'), ', '.join(before))

        print

register_command(cmd_info)
Exemple #34
0
    def run(self, config, options, args, help=None):
        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 = module_set.packagedb
        for module in module_list[:]:
            if not packagedb.check(module.name):
                module_list.remove(module)

        config.nopoison = True

        build = jhbuild.frontends.get_buildscript(config,
                                                  module_list,
                                                  module_set=module_set)
        return build.build(phases=['clean'])


register_command(cmd_clean)
Exemple #35
0
# 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 jhbuild.commands import Command, register_command
import jhbuild.frontends


class cmd_gui(Command):
    doc = N_('Build targets from a GUI app')

    name = 'gui'
    usage_args = ''

    def run(self, config, options, args, help=None):
        # request GTK build script.
        config.buildscript = 'gtkui'

        build = jhbuild.frontends.get_buildscript(config)
        return build.build()

register_command(cmd_gui)
Exemple #36
0
                basedir = os.path.join(SRCDIR, 'buildbot')
        os.chdir(basedir)
        if not os.path.exists(os.path.join(basedir, 'builddir')):
            os.makedirs(os.path.join(basedir, 'builddir'))
        master_cfg_path = mastercfgfile

        JhBuildMaster(basedir, master_cfg_path).setServiceParent(application)

        JhBuildbotApplicationRunner.application = application
        JhBuildbotApplicationRunner(options).run()

    def stop(self, config, pidfile):
        try:
            pid = int(file(pidfile).read())
        except:
            raise FatalError(_('failed to get buildbot PID'))

        os.kill(pid, signal.SIGTERM)

    def reload_server_config(self, config, pidfile):
        try:
            pid = int(file(pidfile).read())
        except:
            raise FatalError(_('failed to get buildbot PID'))

        os.kill(pid, signal.SIGHUP)


register_command(cmd_bot)

Exemple #37
0
        try:
            source_dir = module.branch.srcdir
            uprint(_('Sourcedir:'), source_dir)
        except (NotImplementedError, AttributeError):
            pass

        # dependencies
        if module.dependencies:
            uprint(_('Requires:'), ', '.join(module.dependencies))
        requiredby = [
            mod.name for mod in module_set.modules.values()
            if module.name in mod.dependencies
        ]
        if requiredby:
            uprint(_('Required by:'), ', '.join(requiredby))
        if module.suggests:
            uprint(_('Suggests:'), ', '.join(module.suggests))
        if module.after:
            uprint(_('After:'), ', '.join(module.after))
        before = [
            mod.name for mod in module_set.modules.values()
            if module.name in mod.after
        ]
        if before:
            uprint(_('Before:'), ', '.join(before))

        print


register_command(cmd_info)
Exemple #38
0
            modules = args or config.modules
            module_list = module_set.get_module_list(modules)

            for module in module_list:
                if module.type == 'meta':
                    continue
                for version_regex in (r'.*?[ \(]([\d.]+)', r'^([\d.]+)'):
                    if check_version([module.name, '--version'],
                            version_regex, module.branch.version):
                        ignored_modules.append(module.name)
                        break

            os.environ['PATH'] = path
            config.skip.extend(ignored_modules)

        # cancel the bootstrap updateness check as it has no sense (it *is*
        # running bootstrap right now)
        jhbuild.commands.base.check_bootstrap_updateness = lambda x: x
        rc = cmd_build.run(self, config, options, args)

        if ignored_modules:
            logging.info(
                    _('some modules (%s) were automatically ignored as a '
                      'sufficient enough version was found installed on '
                      'your system. Use --ignore-system if you want to build '
                      'them nevertheless.' % ', '.join(ignored_modules)))

        return rc

register_command(cmd_bootstrap)
Exemple #39
0
<p style="font-size: small;">
Disclaimer: Complexities are (mis)calculated arbitrary on the following basis:
1) for libraries low/average/complex are relative to the number of includes
of a library header (&lt;5/&lt;20/&gt;=20); 2) for deprecated symbols thet are
relative to the number of deprecated symbols in use (&lt;5/&lt;20/&gt;=20).
</p>
'''

    
    def __init__(self):
        Command.__init__(self, [
            make_option('-o', '--output', metavar='FILE',
                    action='store', dest='output', default=None),
            make_option('--devhelp-dirname', metavar='DIR',
                    action='store', dest='devhelp_dirname', default=None),
            make_option('--no-cache',
                    action='store_true', dest='nocache', default=False),
            make_option('--all-modules',
                        action='store_true', dest='list_all_modules', default=False),
            ])

    def run(self, config, options, args, help=None):
        options.cache = 'twoninetynine.pck'
        if options.nocache:
            options.cache = None
        options.bugfile = 'http://live.gnome.org/FredericPeters/Bugs299?action=raw'
        options.falsepositivesfile = 'http://live.gnome.org/FredericPeters/FalsePositives299?action=raw'
        return cmd_goalreport.run(self, config, options, args)

register_command(cmd_twoninetynine)