Skip to content

Commit

Permalink
Merge pull request #3004 from g7/factory-news-utf8str
Browse files Browse the repository at this point in the history
factory-package-news: use a nicer name for the forcestr function
  • Loading branch information
dirkmueller committed Aug 9, 2023
2 parents 9200c9e + 4b9d08a commit 3232664
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions factory-package-news/factory-package-news.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# keep this script working there too.
#
# [0] https://github.com/rpm-software-management/rpm/commit/84920f898315d09a57a3f1067433eaeb7de5e830
def forcestr(content):
def utf8str(content):
return str(content, 'utf-8') if isinstance(content, bytes) else content


Expand Down Expand Up @@ -60,12 +60,12 @@ def readChangeLogs(self, args):
changelogs = dict()

def _getdata(h):
srpm = forcestr(h['sourcerpm'])
binrpm = forcestr(h['name'])
srpm = utf8str(h['sourcerpm'])
binrpm = utf8str(h['name'])

evr = dict()
for tag in ['name', 'version', 'release', 'sourcerpm']:
evr[tag] = forcestr(h[tag])
evr[tag] = utf8str(h[tag])
pkgdata[binrpm] = evr

# dirty hack to reduce kernel spam
Expand All @@ -89,7 +89,7 @@ def _getdata(h):
):
srpm = '%s-%s-%s.src.rpm' % ('kernel-source', m.group('version'), m.group('release'))
pkgdata[binrpm]['sourcerpm'] = srpm
print("%s -> %s" % (forcestr(h['sourcerpm']), srpm))
print("%s -> %s" % (utf8str(h['sourcerpm']), srpm))

if srpm in changelogs:
changelogs[srpm]['packages'].append(binrpm)
Expand All @@ -98,7 +98,7 @@ def _getdata(h):
data['changelogtime'] = h['changelogtime']
data['changelogtext'] = h['changelogtext']
for (t, txt) in enumerate(data['changelogtext']):
data['changelogtext'][t] = forcestr(txt)
data['changelogtext'][t] = utf8str(txt)
changelogs[srpm] = data

for arg in args:
Expand Down

0 comments on commit 3232664

Please sign in to comment.