예제 #1
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 = None
        if self.options.use_version:
            tagger_class = get_class_by_name("tito.tagger.ForceVersionTagger")
        elif self.config.has_option("buildconfig", "tagger"):
            tagger_class = get_class_by_name(
                self.config.get("buildconfig", "tagger"))
        else:
            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)
예제 #2
0
파일: cli.py 프로젝트: dLobatog/tito
    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 = None
        if self.options.use_version:
            tagger_class = get_class_by_name("tito.tagger.ForceVersionTagger")
        elif self.config.has_option("buildconfig", "tagger"):
            tagger_class = get_class_by_name(self.config.get("buildconfig",
                "tagger"))
        else:
            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)
예제 #3
0
파일: cli.py 프로젝트: 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)
예제 #4
0
파일: cli.py 프로젝트: jsabo/tito
    def _create_builder(self, package_name, build_tag, build_version, options,
            pkg_config, build_dir):
        """
        Create (but don't run) the builder class. Builder object may be
        used by other objects without actually having run() called.
        """

        builder_class = None
        if pkg_config.has_option("buildconfig", "builder"):
            builder_class = get_class_by_name(pkg_config.get("buildconfig",
                "builder"))
        else:
            builder_class = get_class_by_name(self.global_config.get(
                GLOBALCONFIG_SECTION, DEFAULT_BUILDER))
        debug("Using builder class: %s" % builder_class)

        # Instantiate the builder:
        builder = builder_class(
                name=package_name,
                version=build_version,
                tag=build_tag,
                build_dir=build_dir,
                pkg_config=pkg_config,
                global_config=self.global_config,
                user_config=self.user_config,
                dist=options.dist,
                test=options.test,
                offline=options.offline,
                auto_install=options.auto_install)
        return builder
예제 #5
0
파일: fetch.py 프로젝트: hughdbrown/tito
    def tgz(self):
        self.ran_tgz = True
        self._create_build_dirs()

        print("Fetching sources...")
        source_strat_class = get_class_by_name(self.config.get("builder", "fetch_strategy"))
        source_strat = source_strat_class(self)
        source_strat.fetch()
        self.sources = source_strat.sources
        self.spec_file = source_strat.spec_file
예제 #6
0
    def tgz(self):
        self.ran_tgz = True
        self._create_build_dirs()

        print("Fetching sources...")
        source_strat_class = get_class_by_name(self.config.get(
            'builder', 'fetch_strategy'))
        source_strat = source_strat_class(self)
        source_strat.fetch()
        self.sources = source_strat.sources
        self.spec_file = source_strat.spec_file
예제 #7
0
파일: cli.py 프로젝트: Conan-Kudo/tito
    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
예제 #8
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