Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent reposync tracebacks on packages with empty release #7594

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions python/spacewalk/satellite_tools/repo_plugins/yum_src.py
Original file line number Diff line number Diff line change
Expand Up @@ -1180,6 +1180,10 @@ def list_packages(self, filters, latest):
for pack in pkglist:
new_pack = ContentPackage()
epoch, version, release = RawSolvablePackage._parse_solvable_evr(pack.evr)
# Prevent repeating to download the package with empty release on each run.
# Release should be specified in the package. Assuming empty release as 0.
if release == "":
release = "0"
new_pack.setNVREA(pack.name, version, release, epoch, pack.arch)
new_pack.unique_id = RawSolvablePackage(pack)
checksum = pack.lookup_checksum(solv.SOLVABLE_CHECKSUM)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Prevent reposync tracebacks on packages with empty release (bsc#1213738)
17 changes: 10 additions & 7 deletions python/uyuni/common/rhn_rpm.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,14 @@ def __getitem__(self, name):
item = sstr(item)
elif isinstance(item, list):
item = [sstr(i) if isinstance(i, bytes) else i for i in item]

# Workaround to make it possible to overlap empty release with 0
# to prevent tracebacks on synchronization the packages with empty release.
# Actually there is no way to set values back to the header,
# so __setitem__ is useless in this class.
if name == "release" and item == "":
item = "0"

return item

def __contains__(self, name):
Expand All @@ -101,12 +109,7 @@ def __delitem__(self, name):
del self.hdr[name]

def __getattr__(self, name):
item = getattr(self.hdr, name)
if isinstance(item, bytes):
item = sstr(item)
elif isinstance(item, list):
item = [sstr(i) if isinstance(i, bytes) else i for i in item]
return item
return __getitem__(name)

def __len__(self):
return len(self.hdr)
Expand Down Expand Up @@ -220,7 +223,7 @@ def read_header(self):
e = sys.exc_info()[1]
raise_with_tb(InvalidPackageError(e), sys.exc_info()[2])
except:
raise_with_tb(InvalidPackageError, sys.exc_info()[2])
raise_with_tb(InvalidPackageError(), sys.exc_info()[2])
self.checksum_type = self.header.checksum_type()

def _get_header_byte_range(self):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Prevent reposync tracebacks on packages with empty release (bsc#1213738)