Exemplo n.º 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)
Exemplo n.º 2
0
    def __init__(self, config, name, version, source_url='', source_size='', source_md5=None,uri=[],
                 patches=[], configure_commands=[], build_commands=[], install_commands=[], 
                 dependencies=[], after=[], suggests=[]):
        self.name = name
        self.version = version

        # create a fake TarballRepository, and give it the moduleset uri
        repo = TarballRepository(config, None, None)
        repo.moduleset_uri = uri
        branch = TarballBranch(repo, source_url, version, None, source_size, source_md5, 
                               None, source_subdir=None, expect_standard_tarball=False)
        branch.patches = patches

        # Set a second-level checkout root, because binary archives often unzip to cwd. We also set
        # expect_standard_tarball to False to allow these packages through.
        branch.checkoutroot = os.path.join(config.checkoutroot, "%s-%s-binary" % (name, version))

        AutogenModule.__init__(self, name, branch, None, None, '', dependencies,
                              after, suggests, supports_non_srcdir_builds=False,
                              skip_autogen=False)

        self.static = True
        self.configure_commands = configure_commands
        self.build_commands = build_commands
        self.install_commands = install_commands
Exemplo n.º 3
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
                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()
Exemplo n.º 4
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)
Exemplo n.º 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:
            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()
Exemplo n.º 6
0
 def setUp(self):
     BuildTestCase.setUp(self)
     self.foo_branch = mock.Branch()
     self.modules = [
         AutogenModule('foo', self.foo_branch),
         AutogenModule('bar', self.branch)
     ]
     self.modules[0].config = self.config
     self.modules[1].config = self.config
Exemplo n.º 7
0
    def __init__(self,
                 config,
                 name,
                 version,
                 source_url='',
                 source_size='',
                 source_md5=None,
                 uri=[],
                 patches=[],
                 configure_commands=[],
                 build_commands=[],
                 install_commands=[],
                 dependencies=[],
                 after=[],
                 suggests=[]):
        self.name = name
        self.version = version

        # create a fake TarballRepository, and give it the moduleset uri
        repo = TarballRepository(config, None, None)
        repo.moduleset_uri = uri
        branch = TarballBranch(repo,
                               source_url,
                               version,
                               None,
                               source_size,
                               source_md5,
                               None,
                               source_subdir=None,
                               expect_standard_tarball=False)
        branch.patches = patches

        # Set a second-level checkout root, because binary archives often unzip to cwd. We also set
        # expect_standard_tarball to False to allow these packages through.
        branch.checkoutroot = os.path.join(config.checkoutroot,
                                           "%s-%s-binary" % (name, version))

        AutogenModule.__init__(self,
                               name,
                               branch,
                               None,
                               None,
                               '',
                               dependencies,
                               after,
                               suggests,
                               supports_non_srcdir_builds=False,
                               skip_autogen=False)

        self.static = True
        self.configure_commands = configure_commands
        self.build_commands = build_commands
        self.install_commands = install_commands
Exemplo n.º 8
0
 def test_autotools_with_libtool(self):
     config = self.make_config()
     module_list = [
         AutogenModule('libhello', branch=self.make_branch(config, 'libhello')),
         AutogenModule('hello', branch=self.make_branch(config, 'hello'))]
     module_list[0].config = self.config
     module_list[1].config = self.config
     build = self.make_terminal_buildscript(config, module_list)
     with_stdout_hidden(build.build)
     proc = subprocess.Popen(['hello'], stdout=subprocess.PIPE)
     stdout, stderr = proc.communicate()
     self.assertEquals(stdout.strip(), 'Hello world (library test)')
     self.assertEquals(proc.wait(), 0)
Exemplo n.º 9
0
    def run(self, config, options, args, help=None):
        # Grab the cwd before anything changes it
        cwd = os.getcwd()

        # 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()
Exemplo n.º 10
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()
Exemplo n.º 11
0
 def __init__(
     self, name, projects, revision, autogenargs="", makeargs="", dependencies=[], after=[], repository=None
 ):
     AutogenModule.__init__(
         self,
         name,
         branch=None,
         autogenargs=autogenargs,
         makeargs=makeargs,
         dependencies=dependencies,
         after=after,
         supports_non_srcdir_builds=False,
     )
     self.repository = repository
     self.revision = revision
     self.projects = projects
     os.environ["MOZ_CO_PROJECT"] = projects
Exemplo n.º 12
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)
Exemplo n.º 13
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)
Exemplo n.º 14
0
 def test_autotools(self):
     config = self.make_config()
     module_list = [
         AutogenModule('hello', self.make_branch(config, 'autotools'))
     ]
     module_list[0].config = self.config
     build = jhbuild.frontends.terminal.TerminalBuildScript(
         config, module_list)
     with_stdout_hidden(build.build)
     proc = subprocess.Popen(['hello'], stdout=subprocess.PIPE)
     stdout, stderr = proc.communicate()
     self.assertEquals(stdout.strip(), 'Hello world (autotools)')
     self.assertEquals(proc.wait(), 0)
Exemplo n.º 15
0
 def setUp(self):
     BuildTestCase.setUp(self)
     self.modules = [AutogenModule('foo', self.branch)]
     self.modules[0].config = self.config
Exemplo n.º 16
0
 def setUp(self):
     BuildTestCase.setUp(self)
     self.modules = [AutogenModule('foo', self.branch)]
     self.modules[0].config = self.config
     # replace clean method as it checks for Makefile existence
     self.modules[0].skip_clean = lambda x, y: False