Skip to content

Commit bb736d9

Browse files
Eduard Čubaj-mracek
authored andcommitted
[swdb]: fix - stop iteration when reading Obsoleting package
Obsoleting state was merged with Install state, so there are no more multiple states for this Fix RPMDB attributes extraction from DnfPackage
1 parent 61da130 commit bb736d9

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

dnf/db/history.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -136,20 +136,20 @@ def reason(self, pkg):
136136
return self.swdb.reason(str(pkg))
137137

138138
def ipkg_to_rpmdata(self, ipkg):
139+
""" Extract RPMDB data from Dnf.Package """
139140
pid = self.pkg2pid(ipkg, create=False)
140141
rpmdata = SwdbRpmData.new(
141142
pid,
142-
getattr(ipkg, "buildtime", 0),
143-
getattr(ipkg, "buildhost", ''),
144-
getattr(ipkg, "license", ''),
145-
getattr(ipkg, "packager", ''),
146-
getattr(ipkg, "size", ''),
147-
getattr(ipkg, "sourcerpm", ''),
148-
getattr(ipkg, "url", ''),
149-
getattr(ipkg, "vendor", ''),
150-
getattr(ipkg, "committer", ''),
151-
getattr(ipkg, "committime", 0)
152-
)
143+
int((getattr(ipkg, "buildtime", None) or 0)),
144+
str((getattr(ipkg, "buildhost", None) or '')),
145+
str((getattr(ipkg, "license", None) or '')),
146+
str((getattr(ipkg, "packager", None) or '')),
147+
str((getattr(ipkg, "size", None) or '')),
148+
str((getattr(ipkg, "sourcerpm", None) or '')),
149+
str((getattr(ipkg, "url", None) or '')),
150+
str((getattr(ipkg, "vendor", None) or '')),
151+
str((getattr(ipkg, "committer", None) or '')),
152+
int((getattr(ipkg, "committime", None) or 0)))
153153
return rpmdata
154154

155155
def ipkg_to_pkg(self, ipkg):

dnf/history.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ def transaction_nevra_ops(self, id_):
112112
if obsoleted_nevras: # Read obsoleting package.
113113
assert hpkg.obsoleting
114114
obsoleting_nevra = hpkg.nevra
115-
hpkg = next(reversed_it)
116115

117116
# Replaced.
118117
if hpkg.state in {'Reinstalled', 'Downgraded', 'Updated'}:

0 commit comments

Comments
 (0)