Exemple #1
0
    def run(self, config, options, args, help=None):
        config.set_from_cmdline_options(options)

        module_set = jhbuild.moduleset.load(config)
        module_list = []
        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)
Exemple #2
0
    def run(self, config, options, args, help=None):
        config.set_from_cmdline_options(options)

        module_set = jhbuild.moduleset.load(config)
        module_list = []
        for modname in args:
            modname = modname.rstrip(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:
                    continue
                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})
            module_list.append(module)

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

        build = jhbuild.frontends.get_buildscript(config, module_list, module_set=module_set)
        return build.build()
Exemple #3
0
    def run(self, config, options, args, help=None):
        # Grab the cwd before anything changes it
        cwd = self.get_cwd()

        # Explicitly don't touch the network for this
        options.nonetwork = True
        options.force_policy = True
        config.set_from_cmdline_options(options)

        makeargs = config.makeargs
        for arg in args:
            # if uninstalling, skip install.
            if arg == 'uninstall' or arg.startswith('uninstall-'):
                config.noinstall = True
            # pipes.quote (and really, trying to safely quote shell arguments) is
            # broken, but executing commands as strings is pervasive throughout
            # jhbuild...this is a hack that will probably live until someone just
            # replaces jhbuild entirely.
            makeargs = '%s %s' % (makeargs, pipes.quote(arg))
        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()
Exemple #4
0
    def run(self, config, options, args, help=None):
        config.set_from_cmdline_options(options)

        module_set = jhbuild.moduleset.load(config)
        module_list = []
        for modname in args:
            try:
                module = module_set.get_module(modname, ignore_case=True)
            except KeyError, e:
                default_repo = jhbuild.moduleset.get_default_repo()
                if not default_repo:
                    continue
                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})
            module_list.append(module)
Exemple #5
0
    def run(self, config, options, args, help=None):
        config.set_from_cmdline_options(options)

        module_set = jhbuild.moduleset.load(config)
        module_list = []
        for modname in args:
            try:
                module = module_set.get_module(modname, ignore_case=True)
            except KeyError, e:
                default_repo = jhbuild.moduleset.get_default_repo()
                if not default_repo:
                    continue
                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})
            module_list.append(module)
Exemple #6
0
    def run(self, config, options, args, help=None):
        config.set_from_cmdline_options(options)

        module_set = jhbuild.moduleset.load(config)
        module_list = []
        for modname in args:
            modname = modname.rstrip(os.sep)
            try:
                module = module_set.get_module(modname, ignore_case=True)
            except KeyError:
                default_repo = jhbuild.moduleset.get_default_repo()
                if not default_repo:
                    continue

                # If the module has not been checkout yet, this will
                # fail and default to meson
                if os.path.exists(
                        os.path.join(config.checkoutroot, modname,
                                     'autogen.sh')):
                    from jhbuild.modtypes.autotools import AutogenModule
                    module = AutogenModule(modname,
                                           default_repo.branch(modname))
                else:
                    from jhbuild.modtypes.meson import MesonModule
                    module = MesonModule(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})
            module_list.append(module)

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

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