Bug 749906 - RFE: convenience method for changelogs
Summary: RFE: convenience method for changelogs
Keywords:
Status: CLOSED WORKSFORME
Alias: None
Product: Fedora
Classification: Fedora
Component: kobo
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Daniel Mach
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-10-28 20:22 UTC by Dennis Gregorovic
Modified: 2017-01-27 16:46 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-01-27 16:46:35 UTC
Type: ---


Attachments (Terms of Use)

Description Dennis Gregorovic 2011-10-28 20:22:15 UTC
Changelog information is spread across three headers in rpms.  It would be useful if rpmlib had a method that combined the data and that RpmWrapper objects exposed this through an attribute.  Sample code:

def get_changelogs(hdr, max=-1, timeformat="%a %b %d %Y"):
    if max == 0:
        return
    s = []
    names = get_header_field(hdr, 'CHANGELOGNAME')
    times = get_header_field(hdr, 'CHANGELOGTIME')
    text = get_header_field(hdr, 'CHANGELOGTEXT')
    i = 0
    while (i < max or max < 0) and i < len(names):
        if isinstance(times, int):
            time_value = time.gmtime(times)
        elif isinstance(times, list):
            time_value = time.gmtime(times[i])
        time_text = time.strftime(timeformat, time_value)
        s.append((time_value, "%s %s\n%s" % (time_text, names[i], text[i])))
        i += 1
    return s

@property
def changelogs(self):
    return kobo.rpmlib.get_changelogs(self.header)

Comment 1 Daniel Mach 2012-10-30 10:42:56 UTC
This might work:
http://git.fedorahosted.org/cgit/kobo.git/commit/?id=8eb8ce82a46bd95f73eb33bae5bdc0ba6a86e771

Please close this bug if the code works for you.


Note You need to log in before you can comment on or make changes to this bug.