From 1ba64d6e6b32495378c42a8c8a5547276f872488 Mon Sep 17 00:00:00 2001 From: Dennis Gilmore Date: Tue, 29 Apr 2014 16:29:34 -0500 Subject: [PATCH] 3.04 release --- git-changelog | 111 +++++++++++++++++++++++++++++++++++++++++++++++ pungi.spec | 9 +++- setup.py | 2 +- src/bin/pungi.py | 2 +- 4 files changed, 121 insertions(+), 3 deletions(-) create mode 100755 git-changelog diff --git a/git-changelog b/git-changelog new file mode 100755 index 00000000..88df9d60 --- /dev/null +++ b/git-changelog @@ -0,0 +1,111 @@ +#!/usr/bin/python +# +# git-changelog - Output a rpm changelog +# +# Copyright (C) 2009-2010 Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published +# by the Free Software Foundation; either version 2.1 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program. If not, see . +# +# Author: David Cantrell +# Author: Brian C. Lane + +import os +import re +import subprocess +import sys +import textwrap +from optparse import OptionParser + + + +class ChangeLog: + def __init__(self, name, version): + self.name = name + self.version = version + self.ignore = None + + def _getCommitDetail(self, commit, field): + proc = subprocess.Popen(['git', 'log', '-1', + "--pretty=format:%s" % field, commit], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE).communicate() + + ret = proc[0].strip('\n').split('\n') + + if len(ret) == 1 and ret[0].find('@') != -1: + ret = ret[0].split('@')[0] + elif len(ret) == 1: + ret = ret[0] + else: + ret = filter(lambda x: x != '', ret) + + return ret + + def getLog(self): + if not self.name: + range = "%s.." % (self.version) + else: + range = "%s-%s.." % (self.name, self.version) + proc = subprocess.Popen(['git', 'log', '--pretty=oneline', range], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE).communicate() + lines = filter(lambda x: x.find('l10n: ') != 41 and \ + x.find('Merge commit') != 41 and \ + x.find('Merge branch') != 41, + proc[0].strip('\n').split('\n')) + + if self.ignore and self.ignore != '': + for commit in self.ignore.split(','): + lines = filter(lambda x: not x.startswith(commit), lines) + + log = [] + for line in lines: + fields = line.split(' ') + commit = fields[0] + + summary = self._getCommitDetail(commit, "%s") + long = self._getCommitDetail(commit, "%b") + author = self._getCommitDetail(commit, "%aE") + + log.append(("%s (%s)" % (summary.strip(), author))) + + return log + + def formatLog(self): + s = "" + for msg in self.getLog(): + sublines = textwrap.wrap(msg, 77) + s = s + "- %s\n" % sublines[0] + + if len(sublines) > 1: + for subline in sublines[1:]: + s = s + " %s\n" % subline + + return s + +def main(): + parser = OptionParser() + parser.add_option("-n", "--name", dest="name", + help="Name of package used in tags") + parser.add_option("-v", "--version", dest="version", + help="Last version, changelog is commits after this tag") + (options, args) = parser.parse_args() + + cl = ChangeLog(options.name, options.version) + print cl.formatLog() + +if __name__ == "__main__": + main() + + diff --git a/pungi.spec b/pungi.spec index 0e3d1a12..ffaeaf22 100644 --- a/pungi.spec +++ b/pungi.spec @@ -1,7 +1,7 @@ %{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} Name: pungi -Version: 3.03 +Version: 3.04 Release: 1%{?dist} Summary: Distribution compose tool @@ -56,6 +56,13 @@ rm -rf $RPM_BUILD_ROOT /var/cache/pungi %changelog +* Tue Apr 29 2014 Dennis Gilmore - 3.03-1 - revert to the old way of doing versioning as the change in 3.01 did not work diff --git a/setup.py b/setup.py index fb17530c..00df0578 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from distutils.core import setup import glob setup(name='pungi', - version='3.03', # make sure src/bin/pungi.py is updated to match + version='3.04', # make sure src/bin/pungi.py is updated to match description='Distribution compose tool', author='Dennis Gilmore', author_email='dgilmore@fedoraproject.org', diff --git a/src/bin/pungi.py b/src/bin/pungi.py index 9d0e7068..fc72b692 100755 --- a/src/bin/pungi.py +++ b/src/bin/pungi.py @@ -181,7 +181,7 @@ if __name__ == '__main__': today = time.strftime('%Y%m%d', time.localtime()) def get_arguments(config): - parser = OptionParser("%prog [--help] [options]", version="%prog 3.03") + parser = OptionParser("%prog [--help] [options]", version="%prog 3.04") def set_config(option, opt_str, value, parser, config): config.set('pungi', option.dest, value)