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
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 = 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._changelog = None self.offline = offline
def __init__(self, name=None, tag=None, build_dir=None, config=None, user_config=None, args=None, **kwargs): """ name - Package name that is being built. version - Version and release being built. tag - The git tag being built. build_dir - Temporary build directory where we can safely work. config - Merged configuration. (global plus package specific) user_config - User configuration from ~/.titorc. args - Optional arguments specific to each builder. Can be passed in explicitly by user on the CLI, or via a release target config entry. Only for things which vary on invocations of the builder, avoid using these if possible. *Given in the format of a dictionary of lists.* """ ConfigObject.__init__(self, config=config) BuilderBase.__init__(self, name=name, build_dir=build_dir, config=config, user_config=user_config, args=args, **kwargs) self.build_tag = tag self.build_version = self._get_build_version() self.git_commit_id = get_build_commit(tag=self.build_tag, test=True) if kwargs and 'options' in kwargs: warn_out( "'options' no longer a supported builder constructor argument." ) if self.config.has_option("requirements", "tito"): if loose_version(self.config.get("requirements", "tito")) > \ loose_version(require('tito')[0].version): error_out([ "tito version %s or later is needed to build this project." % self.config.get("requirements", "tito"), "Your version: %s" % require('tito')[0].version ]) self.display_version = self._get_display_version() self.relative_project_dir = get_relative_project_dir_cwd(self.git_root) tgz_base = self._get_tgz_name_and_ver() self.tgz_filename = tgz_base + ".tar.gz" self.tgz_dir = tgz_base self.artifacts = [] self.rpmbuild_gitcopy = os.path.join(self.rpmbuild_sourcedir, self.tgz_dir) # Used to make sure we only modify the spec file for a test build # once. The srpm method may be called multiple times during koji # releases to create the proper disttags, but we only want to modify # the spec file once. self.ran_setup_test_specfile = False # NOTE: These are defined later when/if we actually dump a copy of the # project source at the tag we're building. Only then can we search for # a spec file. self.spec_file_name = None self.spec_file = None # Set to path to srpm once we build one. self.srpm_location = None
def __init__(self, name=None, tag=None, build_dir=None, config=None, user_config=None, args=None, **kwargs): """ name - Package name that is being built. version - Version and release being built. tag - The git tag being built. build_dir - Temporary build directory where we can safely work. config - Merged configuration. (global plus package specific) user_config - User configuration from ~/.titorc. args - Optional arguments specific to each builder. Can be passed in explicitly by user on the CLI, or via a release target config entry. Only for things which vary on invocations of the builder, avoid using these if possible. *Given in the format of a dictionary of lists.* """ ConfigObject.__init__(self, config=config) BuilderBase.__init__(self, name=name, build_dir=build_dir, config=config, user_config=user_config, args=args, **kwargs) self.build_tag = tag self.build_version = self._get_build_version() if kwargs and 'options' in kwargs: warn_out("'options' no longer a supported builder constructor argument.") if self.config.has_section("requirements"): if self.config.has_option("requirements", "tito"): if loose_version(self.config.get("requirements", "tito")) > \ loose_version(require('tito')[0].version): error_out([ "tito version %s or later is needed to build this project." % self.config.get("requirements", "tito"), "Your version: %s" % require('tito')[0].version ]) self.display_version = self._get_display_version() with chdir(find_git_root()): self.git_commit_id = get_build_commit(tag=self.build_tag, test=self.test) self.relative_project_dir = get_relative_project_dir( project_name=self.project_name, commit=self.git_commit_id) if self.relative_project_dir is None and self.test: warn_out(".tito/packages/%s doesn't exist " "in git, using current directory" % self.project_name) self.relative_project_dir = get_relative_project_dir_cwd( self.git_root) tgz_base = self._get_tgz_name_and_ver() self.tgz_filename = tgz_base + ".tar.gz" self.tgz_dir = tgz_base self.artifacts = [] # A copy of the git code from commit we're building: self.rpmbuild_gitcopy = os.path.join(self.rpmbuild_sourcedir, self.tgz_dir) # Used to make sure we only modify the spec file for a test build # once. The srpm method may be called multiple times during koji # releases to create the proper disttags, but we only want to modify # the spec file once. self.ran_setup_test_specfile = False # NOTE: These are defined later when/if we actually dump a copy of the # project source at the tag we're building. Only then can we search for # a spec file. self.spec_file_name = None self.spec_file = None # Set to path to srpm once we build one. self.srpm_location = None