| Summary: | RFE: convenience method for changelogs | ||
|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | Dennis Gregorovic <dgregor> |
| Component: | kobo | Assignee: | Daniel Mach <dmach> |
| Status: | CLOSED WORKSFORME | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
| Severity: | unspecified | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | rawhide | CC: | dmach |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2017-01-27 16:46:35 UTC | Type: | --- |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
This might work: http://git.fedorahosted.org/cgit/kobo.git/commit/?id=8eb8ce82a46bd95f73eb33bae5bdc0ba6a86e771 Please close this bug if the code works for you. |
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)