Beispiel #1
0
    def __init__(self, name=None, tag=None, build_dir=None,
            config=None, user_config=None,
            args=None, **kwargs):

        # Mock builders need to use the packages normally configured builder
        # to get at a proper SRPM:
        self.normal_builder = create_builder(name, tag, config,
                build_dir, user_config, args, **kwargs)

        Builder.__init__(self, name=name, tag=tag,
                build_dir=build_dir, config=config,
                user_config=user_config,
                args=args, **kwargs)

        self.mock_tag = args['mock'][0]
        self.mock_cmd_args = ""
        if 'mock_config_dir' in args:
            mock_config_dir = args['mock_config_dir'][0]
            if not mock_config_dir.startswith("/"):
                # If not an absolute path, assume below git root:
                mock_config_dir = os.path.join(self.git_root, mock_config_dir)
            if not os.path.exists(mock_config_dir):
                raise TitoException("No such mock config dir: %s" % mock_config_dir)
            self.mock_cmd_args = "%s --configdir=%s" % (self.mock_cmd_args, mock_config_dir)

        # Optional argument which will skip mock --init and add --no-clean
        # and --no-cleanup-after:
        self.speedup = False
        if 'speedup' in args:
            self.speedup = True
            self.mock_cmd_args = "%s --no-clean --no-cleanup-after" % \
                    (self.mock_cmd_args)

        if 'mock_args' in args:
            self.mock_cmd_args = "%s %s" % (self.mock_cmd_args, args['mock_args'][0])
Beispiel #2
0
    def main(self, argv):
        BaseCliModule.main(self, argv)

        build_dir = os.path.normpath(os.path.abspath(self.options.output_dir))
        package_name = get_project_name(tag=self.options.tag)

        build_tag = self.options.tag

        self.load_config(package_name, build_dir, self.options.tag)

        args = self._parse_builder_args()
        kwargs = {
            'dist': self.options.dist,
            'test': self.options.test,
            'offline': self.options.offline,
            'auto_install': self.options.auto_install,
            'rpmbuild_options': self.options.rpmbuild_options,
            'scl': self.options.scl,
            'quiet': self.options.quiet,
            'verbose': self.options.verbose,
        }

        builder = create_builder(package_name, build_tag,
                self.config,
                build_dir, self.user_config, args,
                builder_class=self.options.builder, **kwargs)
        return builder.run(self.options)
Beispiel #3
0
    def __init__(self, name=None, tag=None, build_dir=None,
            config=None, user_config=None,
            args=None, **kwargs):

        # Mock builders need to use the packages normally configured builder
        # to get at a proper SRPM:
        self.normal_builder = create_builder(name, tag, config,
                build_dir, user_config, args, **kwargs)

        Builder.__init__(self, name=name, tag=tag,
                build_dir=build_dir, config=config,
                user_config=user_config,
                args=args, **kwargs)

        self.mock_tag = args['mock'][0]
        self.mock_cmd_args = ""
        if 'mock_config_dir' in args:
            mock_config_dir = args['mock_config_dir'][0]
            if not mock_config_dir.startswith("/"):
                # If not an absolute path, assume below git root:
                mock_config_dir = os.path.join(self.git_root, mock_config_dir)
            if not os.path.exists(mock_config_dir):
                raise TitoException("No such mock config dir: %s" % mock_config_dir)
            self.mock_cmd_args = "%s --configdir=%s" % (self.mock_cmd_args, mock_config_dir)

        # Optional argument which will skip mock --init and add --no-clean
        # and --no-cleanup-after:
        self.speedup = False
        if 'speedup' in args:
            self.speedup = True
            self.mock_cmd_args = "%s --no-clean --no-cleanup-after" % \
                    (self.mock_cmd_args)

        if 'mock_args' in args:
            self.mock_cmd_args = "%s %s" % (self.mock_cmd_args, args['mock_args'][0])
Beispiel #4
0
    def main(self, argv):
        BaseCliModule.main(self, argv)

        build_dir = os.path.normpath(os.path.abspath(self.options.output_dir))
        package_name = get_project_name(tag=self.options.tag)

        build_tag = self.options.tag

        self.load_config(package_name, build_dir, self.options.tag)

        args = self._parse_builder_args()
        kwargs = {
            'dist': self.options.dist,
            'test': self.options.test,
            'offline': self.options.offline,
            'auto_install': self.options.auto_install,
            'rpmbuild_options': self.options.rpmbuild_options,
            'scl': self.options.scl,
            'quiet': self.options.quiet,
            'verbose': self.options.verbose,
        }

        builder = create_builder(package_name,
                                 build_tag,
                                 self.config,
                                 build_dir,
                                 self.user_config,
                                 args,
                                 builder_class=self.options.builder,
                                 **kwargs)
        return builder.run(self.options)
Beispiel #5
0
    def __init__(self, name=None, tag=None, build_dir=None,
            config=None, user_config=None,
            target=None, releaser_config=None, no_cleanup=False,
            test=False, auto_accept=False, **kwargs):

        ConfigObject.__init__(self, config=config)
        config_builder_args = self._parse_builder_args(releaser_config, target)
        if test:
            config_builder_args['test'] = [True]  # builder must know to build from HEAD

        # Override with builder args from command line if any were given:
        if 'builder_args' in kwargs:
            # (in case of dupes, last one wins)
            self.builder_args = dictionary_override(
                config_builder_args,
                kwargs['builder_args']
            )
        else:
            self.builder_args = config_builder_args

        # While we create a builder here, we don't actually call run on it
        # unless the releaser needs to:
        self.offline = False
        if 'offline' in kwargs:
            self.offline = kwargs['offline']

        # Config for all releasers:
        self.releaser_config = releaser_config

        # The actual release target we're building:
        self.target = target

        # Use the builder from the release target, rather than the default
        # one defined for this git repo or sub-package:
        builder_class = None
        if self.releaser_config.has_option(self.target, 'builder'):
            builder_class = self.releaser_config.get(self.target, 'builder')
        self.builder = create_builder(name, tag,
                config,
                build_dir, user_config, self.builder_args,
                builder_class=builder_class, offline=self.offline)

        self.project_name = self.builder.project_name

        self.working_dir = mkdtemp(dir=self.builder.rpmbuild_basedir,
                prefix="release-%s" % self.builder.project_name)
        print("Working in: %s" % self.working_dir)

        self.dry_run = False
        self.test = test  # releaser must know to use builder designation rather than tag
        self.auto_accept = auto_accept  # don't ask for input, just go ahead
        self.no_cleanup = no_cleanup

        self._check_releaser_config()
Beispiel #6
0
    def __init__(self,
                 name=None,
                 tag=None,
                 build_dir=None,
                 config=None,
                 user_config=None,
                 args=None,
                 **kwargs):

        # Mock builders need to use the packages normally configured builder
        # to get at a proper SRPM:
        self.normal_builder = create_builder(name, tag, config, build_dir,
                                             user_config, args, **kwargs)

        Builder.__init__(self,
                         name=name,
                         tag=tag,
                         build_dir=build_dir,
                         config=config,
                         user_config=user_config,
                         args=args,
                         **kwargs)
Beispiel #7
0
    def __init__(self,
                 name=None,
                 tag=None,
                 build_dir=None,
                 config=None,
                 user_config=None,
                 target=None,
                 releaser_config=None,
                 no_cleanup=False,
                 test=False,
                 auto_accept=False,
                 **kwargs):

        ConfigObject.__init__(self, config=config)
        config_builder_args = self._parse_builder_args(releaser_config, target)
        if test:
            config_builder_args[
                'test'] = True  # builder must know to build from HEAD

        # Override with builder args from command line if any were given:
        if 'builder_args' in kwargs:
            # (in case of dupes, last one wins)
            self.builder_args = dictionary_override(config_builder_args,
                                                    kwargs['builder_args'])
        else:
            self.builder_args = config_builder_args

        # While we create a builder here, we don't actually call run on it
        # unless the releaser needs to:
        self.offline = False
        if 'offline' in kwargs:
            self.offline = kwargs['offline']

        # Config for all releasers:
        self.releaser_config = releaser_config

        # The actual release target we're building:
        self.target = target

        # Use the builder from the release target, rather than the default
        # one defined for this git repo or sub-package:
        builder_class = None
        if self.releaser_config.has_option(self.target, 'builder'):
            builder_class = self.releaser_config.get(self.target, 'builder')
        self.builder = create_builder(name,
                                      tag,
                                      config,
                                      build_dir,
                                      user_config,
                                      self.builder_args,
                                      builder_class=builder_class,
                                      offline=self.offline)

        self.project_name = self.builder.project_name

        self.working_dir = mkdtemp(dir=self.builder.rpmbuild_basedir,
                                   prefix="release-%s" %
                                   self.builder.project_name)
        print("Working in: %s" % self.working_dir)

        self.dry_run = False
        self.test = test  # releaser must know to use builder designation rather than tag
        self.auto_accept = auto_accept  # don't ask for input, just go ahead
        self.no_cleanup = no_cleanup

        self._check_releaser_config()