Example #1
0
    def __init__(self, config=None, keep_version=False, offline=False, user_config=None):
        ConfigObject.__init__(self, config=config)
        self.user_config = user_config

        self.full_project_dir = os.getcwd()
        self.spec_file_name = find_spec_like_file()
        self.project_name = get_project_name(tag=None)

        self.relative_project_dir = get_relative_project_dir_cwd(
            self.git_root)  # i.e. java/

        self.spec_file = os.path.join(self.full_project_dir,
                self.spec_file_name)
        self.keep_version = keep_version

        self.today = self._changelog_date()
        (self.git_user, self.git_email) = get_git_user_info()
        git_email = self.git_email
        if git_email is None:
            git_email = ''
        self.changelog_regex = re.compile('\\*\s%s\s%s(\s<%s>)?' % (self.today,
            self.git_user, git_email.replace("+", "\+").replace(".", "\.")))

        self._no_auto_changelog = False
        self._accept_auto_changelog = False
        self._new_changelog_msg = "new package built with tito"
        self._changelog = None
        self.offline = offline
Example #2
0
    def __init__(self, global_config=None, keep_version=False, offline=False, user_config=None):
        self.git_root = find_git_root()
        self.rel_eng_dir = os.path.join(self.git_root, "rel-eng")
        self.config = global_config
        self.user_config = user_config

        self.full_project_dir = os.getcwd()
        self.spec_file_name = find_spec_file()
        self.project_name = get_project_name(tag=None)

        self.relative_project_dir = self._get_relative_project_dir(
                self.git_root)  # i.e. java/

        self.spec_file = os.path.join(self.full_project_dir,
                self.spec_file_name)
        self.keep_version = keep_version

        self.today = strftime("%a %b %d %Y")
        (self.git_user, self.git_email) = self._get_git_user_info()
        git_email = self.git_email
        if git_email is None:
            git_email = ''
        self.changelog_regex = re.compile('\\*\s%s\s%s(\s<%s>)?' % (self.today,
            self.git_user, git_email.replace("+", "\+").replace(".", "\.")))

        self._no_auto_changelog = False
        self._accept_auto_changelog = False
        self._new_changelog_msg = "new package built with tito"
        self.offline = offline
Example #3
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=None)

        self.load_config(package_name, build_dir, None)
        if self.config.has_option(BUILDCONFIG_SECTION,
                "block_tagging"):
            debug("block_tagging defined in tito.props")
            error_out("Tagging has been disabled in this git branch.")

        tagger_class = get_class_by_name(self.config.get(
            BUILDCONFIG_SECTION, DEFAULT_TAGGER))
        debug("Using tagger class: %s" % tagger_class)

        tagger = tagger_class(config=self.config,
                user_config=self.user_config,
                keep_version=self.options.keep_version,
                offline=self.options.offline)

        try:
            return tagger.run(self.options)
        except TitoException:
            e = sys.exc_info()[1]
            error_out(e.message)
Example #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)
Example #5
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=None)

        self.load_config(package_name, build_dir, None)
        if self.config.has_option(BUILDCONFIG_SECTION, "block_tagging"):
            debug("block_tagging defined in tito.props")
            error_out("Tagging has been disabled in this git branch.")

        tagger_class = get_class_by_name(
            self.config.get(BUILDCONFIG_SECTION, DEFAULT_TAGGER))
        debug("Using tagger class: %s" % tagger_class)

        tagger = tagger_class(config=self.config,
                              user_config=self.user_config,
                              keep_version=self.options.keep_version,
                              offline=self.options.offline)

        try:
            return tagger.run(self.options)
        except TitoException:
            e = sys.exc_info()[1]
            error_out(e.message)
Example #6
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)
Example #7
0
    def __init__(self, global_config=None, keep_version=False, offline=False, user_config=None, pkg_config=None):
        """ 
        pkg_config - Package specific configuration.

        global_config - Global configuration from rel-eng/tito.props.
        """
        ConfigObject.__init__(self, pkg_config=pkg_config, global_config=global_config)
        self.user_config = user_config

        self.full_project_dir = os.getcwd()
        self.spec_file_name = find_spec_file()
        self.project_name = get_project_name(tag=None)

        self.relative_project_dir = self._get_relative_project_dir(
                self.git_root)  # i.e. java/

        self.spec_file = os.path.join(self.full_project_dir,
                self.spec_file_name)
        self.keep_version = keep_version

        self.today = strftime("%a %b %d %Y")
        (self.git_user, self.git_email) = self._get_git_user_info()
        git_email = self.git_email
        if git_email is None:
            git_email = ''
        self.changelog_regex = re.compile('\\*\s%s\s%s(\s<%s>)?' % (self.today,
            self.git_user, git_email.replace("+", "\+").replace(".", "\.")))

        self._no_auto_changelog = False
        self._accept_auto_changelog = False
        self._new_changelog_msg = "new package built with tito"
        self.offline = offline
Example #8
0
File: cli.py Project: jsabo/tito
    def main(self):
        BaseCliModule.main(self)

        if self.global_config.has_option(GLOBALCONFIG_SECTION,
                "block_tagging"):
            debug("block_tagging defined in tito.props")
            error_out("Tagging has been disabled in this git branch.")

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

        self.pkg_config = self._read_project_config(package_name, build_dir,
                None, None)

        tagger_class = None
        if self.pkg_config.has_option("buildconfig", "tagger"):
            tagger_class = get_class_by_name(self.pkg_config.get("buildconfig",
                "tagger"))
        else:
            tagger_class = get_class_by_name(self.global_config.get(
                GLOBALCONFIG_SECTION, DEFAULT_TAGGER))
        debug("Using tagger class: %s" % tagger_class)

        tagger = tagger_class(global_config=self.global_config,
                keep_version=self.options.keep_version)
        tagger.run(self.options)
Example #9
0
File: cli.py Project: jsabo/tito
    def main(self):
        BaseCliModule.main(self)

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

        build_tag = None
        build_version = None
        # Determine which package version we should build:
        if self.options.tag:
            build_tag = self.options.tag
            build_version = build_tag[len(package_name + "-"):]
        else:
            build_version = get_latest_tagged_version(package_name)
            if build_version == None:
                error_out(["Unable to lookup latest package info.",
                        "Perhaps you need to tag first?"])
            build_tag = "%s-%s" % (package_name, build_version)

        if not self.options.test:
            check_tag_exists(build_tag, offline=self.options.offline)

        self.pkg_config = self._read_project_config(package_name, build_dir,
                self.options.tag, self.options.no_cleanup)

        builder = self._create_builder(package_name, build_tag,
                build_version, self.options, self.pkg_config,
                build_dir)
        builder.run(self.options)
Example #10
0
    def test_get_project_name(self):
        TAGS = [('package-1.0-1', 'package'), ('package-1.0', 'package'),
                ('long-package-name-that-should-not-be-an-issue-0.1-1',
                 'long-package-name-that-should-not-be-an-issue'),
                ('package-with-weird-version-0.1-0.1.beta1',
                 'package-with-weird-version'),
                ('grub2-efi-ia32-1.0-1', 'grub2-efi-ia32'),
                ('iwl5150-firmware-1.0-1', 'iwl5150-firmware'),
                ('389-ds-base-1.0-1', '389-ds-base'),
                ('avr-gcc-c++-1.0-1', 'avr-gcc-c++'),
                ('java-1.8.0-openjdk-1.8.0.232.b09-0', 'java-1.8.0-openjdk'),
                ('jsr-305-0-0.25.20130910svn', 'jsr-305')]

        for (tag, package) in TAGS:
            self.assertEquals(package, get_project_name(tag, None))
Example #11
0
    def main(self, argv):
        BaseCliModule.main(self, argv)

        releaser_config = self._read_releaser_config()

        if self.options.list_releasers:
            self._print_releasers(releaser_config)
            sys.exit(1)

        # First arg is sub-command 'release', the rest should be our release
        # targets:
        if len(self.args) < 2 and (self.options.all_starting_with is None) and \
                (self.options.all is None):
            error_out("You must supply at least one release target.")

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

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

        targets = self._calc_release_targets(releaser_config)
        print("Will release to the following targets: %s" % ", ".join(targets))

        orig_cwd = os.getcwd()

        # Create an instance of the releaser we intend to use:
        for target in targets:
            print("Releasing to target: %s" % target)
            if not releaser_config.has_section(target):
                error_out("No such releaser configured: %s" % target)
            releaser_class = get_class_by_name(releaser_config.get(target, "releaser"))
            debug("Using releaser class: %s" % releaser_class)

            builder_args = {}
            if self.options.builder_args and len(self.options.builder_args) > 0:
                for arg in self.options.builder_args:
                    if '=' in arg:
                        key, value = arg.split("=", 1)
                    else:
                        # Allow no value args such as 'myscript --auto'
                        key = arg
                        value = ''

                    debug("Passing builder arg: %s = %s" % (key, value))
                    builder_args.setdefault(key, []).append(value)
            kwargs = {
                'builder_args': builder_args,
                'offline': self.options.offline
            }

            releaser = releaser_class(
                name=package_name,
                tag=self.options.tag,
                build_dir=build_dir,
                config=self.config,
                user_config=self.user_config,
                target=target,
                releaser_config=releaser_config,
                no_cleanup=self.options.no_cleanup,
                test=self.options.test,
                auto_accept=self.options.auto_accept,
                **kwargs)

            try:
                try:
                    releaser.release(dry_run=self.options.dry_run,
                            no_build=self.options.no_build,
                            scratch=self.options.scratch)
                except KeyboardInterrupt:
                    print("Interrupted, cleaning up...")
            finally:
                releaser.cleanup()

            # Make sure we go back to where we started, otherwise multiple
            # builders gets very confused:
            os.chdir(orig_cwd)
            print
Example #12
0
File: main.py Project: awood/tito
 def __is_blacklisted(self, koji_tag, scl):
     """ Return true if package is blacklisted in tito.props"""
     return self.builder.config.has_option(koji_tag, "blacklist") and \
         get_project_name(self.builder.build_tag, scl) in self.builder.config.get(koji_tag,
                     "blacklist").strip().split()
Example #13
0
 def __is_blacklisted(self, koji_tag, scl):
     """ Return true if package is blacklisted in tito.props"""
     return self.builder.config.has_option(koji_tag, "blacklist") and \
         get_project_name(self.builder.build_tag, scl) in self.builder.config.get(koji_tag,
                     "blacklist").strip().split()
Example #14
0
    def main(self, argv):
        BaseCliModule.main(self, argv)

        releaser_config = self._read_releaser_config()

        if self.options.list_releasers:
            self._print_releasers(releaser_config)
            sys.exit(1)

        # First arg is sub-command 'release', the rest should be our release
        # targets:
        if len(self.args) < 2 and (self.options.all_starting_with is None) and \
                (self.options.all is None):
            error_out("You must supply at least one release target.")

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

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

        targets = self._calc_release_targets(releaser_config)
        print("Will release to the following targets: %s" % ", ".join(targets))

        orig_cwd = os.getcwd()

        # Create an instance of the releaser we intend to use:
        for target in targets:
            print("Releasing to target: %s" % target)
            if not releaser_config.has_section(target):
                error_out("No such releaser configured: %s" % target)
            releaser_class = get_class_by_name(
                releaser_config.get(target, "releaser"))
            debug("Using releaser class: %s" % releaser_class)

            builder_args = {}
            if self.options.builder_args and len(
                    self.options.builder_args) > 0:
                for arg in self.options.builder_args:
                    if '=' in arg:
                        key, value = arg.split("=", 1)
                    else:
                        # Allow no value args such as 'myscript --auto'
                        key = arg
                        value = ''

                    debug("Passing builder arg: %s = %s" % (key, value))
                    builder_args.setdefault(key, []).append(value)
            kwargs = {
                'builder_args': builder_args,
                'offline': self.options.offline
            }

            releaser = releaser_class(name=package_name,
                                      tag=self.options.tag,
                                      build_dir=build_dir,
                                      config=self.config,
                                      user_config=self.user_config,
                                      target=target,
                                      releaser_config=releaser_config,
                                      no_cleanup=self.options.no_cleanup,
                                      test=self.options.test,
                                      auto_accept=self.options.auto_accept,
                                      **kwargs)

            try:
                try:
                    releaser.release(dry_run=self.options.dry_run,
                                     no_build=self.options.no_build,
                                     scratch=self.options.scratch)
                except KeyboardInterrupt:
                    print("Interrupted, cleaning up...")
            finally:
                releaser.cleanup()

            # Make sure we go back to where we started, otherwise multiple
            # builders gets very confused:
            os.chdir(orig_cwd)
            print