Esempio n. 1
0
 def format_changelog_entry(self, tag):
     import git
     log.debug('    parsing changelog entry for {}'.format(tag))
     if isinstance(tag, git.Tag):
         tago = tag.tag
         date = datetime.datetime.fromtimestamp(tago.tagged_date)
         tz = tago.tagger_tz_offset
         version = tag.name.strip('v')
         author = tago.tagger.name
         email = tago.tagger.email
         message = tago.message.split('\n')[0]
         build = 1
     else:
         repo = git.Repo()
         config = repo.config_reader()
         version = str(tag)
         build = 1000
         author = config.get_value("user", "name", default="user")
         email = config.get_value("user",
                                  "email",
                                  default="<*****@*****.**>")
         message = 'Test build'
         date = datetime.datetime.now()
         tz = 0
     name = self.distribution.get_name()
     if self.format == 'rpm':
         formatter = self._format_entry_rpm
     elif self.format == 'deb':
         formatter = self._format_entry_deb
     else:
         raise RuntimeError("unsupported changelog format")
     return formatter(name, version, build, author, email, message, date,
                      tz)
Esempio n. 2
0
 def get_git_tags(self):
     import git
     repo = git.Repo()
     tags = repo.tags
     tags.sort(key=self._tag_version, reverse=True)
     log.debug('found {} git tags'.format(len(tags)))
     return tags
Esempio n. 3
0
 def format_changelog_entry(self, tag):
     log.debug('    parsing changelog entry for {}'.format(tag))
     if self.format == 'rpm':
         return self._format_entry_rpm(tag)
     elif self.format == 'deb':
         return self._format_entry_deb(tag)
     raise RuntimeError("unsupported changelog format")
Esempio n. 4
0
 def format_changelog_entry(self, tag):
     import git
     log.debug('    parsing changelog entry for {}'.format(tag))
     if isinstance(tag, git.Tag):
         tago = tag.tag
         date = datetime.datetime.fromtimestamp(tago.tagged_date)
         tz = tago.tagger_tz_offset
         version = tag.name.strip('v')
         author = tago.tagger.name
         email = tago.tagger.email
         message = tago.message.split('\n')[0]
         build = 1
     else:
         repo = git.Repo()
         commit = repo.head.commit
         date = commit.authored_datetime
         tz = commit.author_tz_offset
         version = str(tag)
         author = commit.author.name
         email = commit.author.email
         message = 'Test build'
         build = 1000
     name = self.distribution.get_name()
     if self.format == 'rpm':
         formatter = self._format_entry_rpm
     elif self.format == 'deb':
         formatter = self._format_entry_deb
     else:
         raise RuntimeError("unsupported changelog format")
     return formatter(name, version, build, author, email, message, date,
                      tz)
Esempio n. 5
0
 def get_git_tags(self):
     import git
     repo = git.Repo()
     tags = repo.tags
     tags.reverse()
     log.debug('found {} git tags'.format(len(tags)))
     return tags
Esempio n. 6
0
 def get_git_tags(self):
     import git
     repo = git.Repo()
     tags = repo.tags
     tags.sort(key=self._tag_version, reverse=True)
     log.debug('found {} git tags'.format(len(tags)))
     return tags
Esempio n. 7
0
 def format_changelog_entry(self, tag):
     log.debug('    parsing changelog entry for {}'.format(tag))
     if self.format == 'rpm':
         return self._format_entry_rpm(tag)
     elif self.format == 'deb':
         return self._format_entry_deb(tag)
     raise RuntimeError("unsupported changelog format")
Esempio n. 8
0
 def format_changelog_entry(self, tag):
     import git
     log.debug('    parsing changelog entry for {}'.format(tag))
     if isinstance(tag, git.Tag):
         tago = tag.tag
         date = datetime.datetime.fromtimestamp(tago.tagged_date)
         tz = tago.tagger_tz_offset
         version = tag.name.strip('v')
         author = tago.tagger.name
         email = tago.tagger.email
         message = tago.message.split('\n')[0]
         build = 1
     else:
         repo = git.Repo()
         config = repo.config_reader()
         version = str(tag)
         build = 1000
         author = config.get_value("user", "name", default="user")
         email = config.get_value("user", "email",
                                  default="<*****@*****.**>")
         message = 'Test build'
         date = datetime.datetime.now()
         tz = 0
     name = self.distribution.get_name()
     if self.format == 'rpm':
         formatter = self._format_entry_rpm
     elif self.format == 'deb':
         formatter = self._format_entry_deb
     else:
         raise RuntimeError("unsupported changelog format")
     return formatter(name, version, build, author, email, message,
                      date, tz)
Esempio n. 9
0
 def run(self):
     log.info('creating changelog')
     lines = []
     for tag in self.get_git_tags():
         if self.start_tag and self._tag_version(tag) < self.start_tag:
             log.debug('reached start tag ({}), stopping'.format(
                 self.start_tag))
             break
         lines.append(self.format_changelog_entry(tag))
     log.info('writing changelog to {}'.format(self.output))
     with open(self.output, 'w') as f:
         for line in lines:
             print(line, file=f)
Esempio n. 10
0
 def run(self):
     log.info('creating changelog')
     lines = []
     for tag in self.get_git_tags():
         if self.start_tag and self._tag_version(tag) < self.start_tag:
             log.debug('reached start tag ({}), stopping'.format(
                 self.start_tag))
             break
         lines.append(self.format_changelog_entry(tag))
     log.info('writing changelog to {}'.format(self.output))
     with open(self.output, 'w') as f:
         for line in lines:
             print(line, file=f)
Esempio n. 11
0
 def run(self):
     log.info('creating changelog')
     lines = []
     tags = self.get_git_tags()
     if not self.is_tag():
         version = self._tag_version(tags[0]).version
         devversion = '{0}.{1}.{2}-dev'.format(version[0], version[1],
                                               version[2])
         lines.append(self.format_changelog_entry(devversion))
     for tag in tags:
         if self.start_tag and self._tag_version(tag) < self.start_tag:
             log.debug('reached start tag ({}), stopping'.format(
                 self.start_tag))
             break
         lines.append(self.format_changelog_entry(tag))
     log.info('writing changelog to {}'.format(self.output))
     with open(self.output, 'w') as f:
         for line in lines:
             print(line, file=f)
Esempio n. 12
0
 def run(self):
     log.info('creating changelog')
     lines = []
     tags = self.get_git_tags()
     if not self.is_tag():
         version = self._tag_version(tags[0]).version
         devversion = '{0}.{1}.{2}-dev'.format(version[0], version[1],
                                               version[2])
         lines.append(self.format_changelog_entry(devversion))
     for tag in tags:
         if self.start_tag and self._tag_version(tag) < self.start_tag:
             log.debug('reached start tag ({}), stopping'.format(
                 self.start_tag))
             break
         lines.append(self.format_changelog_entry(tag))
     log.info('writing changelog to {}'.format(self.output))
     with open(self.output, 'w') as f:
         for line in lines:
             print(line, file=f)