diff options
author | Bogdano Arendartchuk <bogdano@mandriva.org> | 2008-03-03 21:11:46 +0000 |
---|---|---|
committer | Bogdano Arendartchuk <bogdano@mandriva.org> | 2008-03-03 21:11:46 +0000 |
commit | e8dc997b06d5e5b50ba4f51dc74cd68ca8f6d612 (patch) | |
tree | d0b68c69f3c73aeb639296bdf900e6559d24ed94 | |
parent | 74df7c8e80bac7b44f148fbd702e523982698fdf (diff) | |
download | mgarepo-e8dc997b06d5e5b50ba4f51dc74cd68ca8f6d612.tar mgarepo-e8dc997b06d5e5b50ba4f51dc74cd68ca8f6d612.tar.gz mgarepo-e8dc997b06d5e5b50ba4f51dc74cd68ca8f6d612.tar.bz2 mgarepo-e8dc997b06d5e5b50ba4f51dc74cd68ca8f6d612.tar.xz mgarepo-e8dc997b06d5e5b50ba4f51dc74cd68ca8f6d612.zip |
Added options -o, -p, -s to rpmlog
These options are just direct flags to the new function get_changelog()
-rw-r--r-- | RepSys/commands/rpmlog.py | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/RepSys/commands/rpmlog.py b/RepSys/commands/rpmlog.py index 5ba5fdd..561b0fd 100644 --- a/RepSys/commands/rpmlog.py +++ b/RepSys/commands/rpmlog.py @@ -3,10 +3,13 @@ # This program will convert the output of "svn log" to be suitable # for usage in an rpm %changelog session. # -from RepSys import Error +from RepSys import Error, RepSysTree from RepSys.command import * -from RepSys.log import svn2rpm +from RepSys.svn import SVN +from RepSys.log import get_changelog, split_spec_changelog +from cStringIO import StringIO import getopt +import os import sys HELP = """\ @@ -18,6 +21,9 @@ Options: -r REV Collect logs from given revision to revision 0 -n NUM Output only last NUM entries -T FILE %changelog template file to be used + -o Append old package changelog + -p Append changelog found in .spec file + -s Sort changelog entries, even from the old log -h Show this message Examples: @@ -30,14 +36,30 @@ def parse_options(): parser.add_option("-r", dest="revision") parser.add_option("-n", dest="size", type="int") parser.add_option("-T", "--template", dest="template", type="string") + parser.add_option("-o", dest="oldlog", default=False, + action="store_true") + parser.add_option("-p", dest="usespec", default=False, + action="store_true") + parser.add_option("-s", dest="sort", default=False, + action="store_true") opts, args = parser.parse_args() if len(args) != 1: raise Error, "invalid arguments" opts.pkgdirurl = default_parent(args[0]) return opts -def rpmlog(pkgdirurl, revision, size, template): - sys.stdout.write(svn2rpm(pkgdirurl, revision, size, template=template)) +def rpmlog(pkgdirurl, revision, size, template, oldlog, usespec, sort): + another = None + if usespec: + svn = SVN() + pkgname = RepSysTree.pkgname(pkgdirurl) + specurl = os.path.join(pkgdirurl, "current/SPECS", pkgname + + ".spec") + rawspec = svn.cat(specurl, rev=revision) + spec, another = split_spec_changelog(StringIO(rawspec)) + newlog = get_changelog(pkgdirurl, another=another, rev=revision, + size=size, sort=sort, template=template, oldlog=oldlog) + sys.stdout.writelines(newlog) def main(): do_command(parse_options, rpmlog) |