def __init__(self, config=None, keep_version=False, offline=False, user_config=None): VersionTagger.__init__(self, config=config, keep_version=keep_version, offline=offline, user_config=user_config) self.today = strftime("%a %b %d %T %Z %Y") self.changes_file_name = self.spec_file_name.replace('.spec', '.changes') self.changes_file = os.path.join(self.full_project_dir, self.changes_file_name) self._new_changelog_msg = "Initial package release" self.changelog_regex = re.compile('^\s%s\s%s(\s<%s>)?' % (self.today, self.git_user, self.git_email.replace("+", "\+").replace(".", "\.")))
def __init__(self, config=None, keep_version=False, offline=False, user_config=None): VersionTagger.__init__(self, config=config) self.gemspec_file_name = find_file_with_extension(suffix=".gemspec") new_version = subprocess.check_output( ["ruby", "-e", "gspec = eval(File.read('" + self.gemspec_file_name + "')); " + "print(gspec.version)"] ) regex = re.compile("^(\d+(?:\.\d+)*)-?(.*)$") match = re.match(regex, new_version) if match: debug("Deduced version='%s' release='%s'" % (match.group(1), match.group(2))) self._use_version = match.group(1) """ The release value is currently parsed, but unused. """ self._use_release = match.group(2)
def _generate_default_changelog(self, last_tag): """ Generate changelog. Strip git log entries not matching: "bugzilla - <comment>" "- <comment>" "[[ comment ]]" @param last_tag: Last git tag. @type last_tag: str @return: The generated changelog. @rtype: str """ entry = [] generated = VersionTagger._generate_default_changelog(self, last_tag) for line in generated.split('\n'): match = re.match(BUGZILLA_REGEX, line) if match: entry.append(line) continue match = re.match(FEATURE_REGEX, line) if match: entry.append(match.group(2)) continue match = re.search(EMBEDDED_REGEX, line) if match: entry.append(match.group(2).strip()) continue return '\n'.join(entry)
def _generate_default_changelog(self, last_tag): """ Generate changelog. Strip git log entries not matching: "bugzilla - <comment>" "- <comment>" "[[ comment ]]" @param last_tag: Last git tag. @type last_tag: str @return: The generated changelog. @rtype: str """ entry = [] generated = VersionTagger._generate_default_changelog(self, last_tag) for line in generated.split('\n'): match = re.match(BUGZILLA_REGEX, line) if match: entry.append(line) continue match = re.match(FEATURE_REGEX, line) if match: entry.append(match.group(2)) continue match = re.search(EMBEDDED_REGEX, line) if match: entry.append(match.group(2).strip()) continue if len(entry) == 0: entry.append(PULP_REBUILD) return '\n'.join(entry)
def __init__(self, config=None, keep_version=False, offline=False, user_config=None): VersionTagger.__init__(self, config=config) self.gemspec_file_name = find_file_with_extension(suffix=".gemspec") new_version = subprocess.check_output([ "ruby", "-e", "gspec = eval(File.read('" + self.gemspec_file_name + "')); " + "print(gspec.version)" ]) regex = re.compile("^(\d+(?:\.\d+)*)-?(.*)$") match = re.match(regex, new_version) if match: debug("Deduced version='%s' release='%s'" % (match.group(1), match.group(2))) self._use_version = match.group(1) """ The release value is currently parsed, but unused. """ self._use_release = match.group(2)
def _bump_version(self): """ Force options we need. """ version = os.environ.get(FORCED_VERSION) if version: self._use_version = version forced = True else: forced = False return VersionTagger._bump_version(self, False, False, forced)
def __init__(self, config=None, keep_version=False, offline=False, user_config=None): VersionTagger.__init__(self, config=config, keep_version=keep_version, offline=offline, user_config=user_config) self.today = strftime("%a %b %d %T %Z %Y") self.changes_file_name = self.spec_file_name.replace( '.spec', '.changes') self.changes_file = os.path.join(self.full_project_dir, self.changes_file_name) self._new_changelog_msg = "Initial package release" self.changelog_regex = re.compile( '^\s%s\s%s(\s<%s>)?' % (self.today, self.git_user, self.git_email.replace( "+", "\+").replace(".", "\.")))
def _bump_version(self): """ Bump the version unless VERSION_AND_RELEASE specified in the environment. When specified, both the version and release are forced as specified. VERSION_AND_RELEASE must be VR part of NEVRA Eg: 2.0.1-0.1.alpha """ version = os.environ.get(VERSION_AND_RELEASE) if version: parts = version.rsplit('-', 1) if len(parts) != 2: error_out('"%s" not valid' % version) self.__update_spec(*parts) return version else: return VersionTagger._bump_version(self)
def _bump_version(self): """ Force options we need. """ return VersionTagger._bump_version(self, False, False, True)
def test_today_datetime(self): self.config["buildconfig"] = {"changelog_date_with_time": True} tagger = VersionTagger(self.config) assert tagger.today == "Wed Apr 22 15:02:00 UTC 2020"
def test_today(self): tagger = VersionTagger(self.config) assert tagger.today == "Wed Apr 22 2020"