-
Notifications
You must be signed in to change notification settings - Fork 180
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
Workaround for python3-debian bug about collecting control file #7215
Conversation
88d7a5b
to
2e1f0d3
Compare
fname = fname[1:] | ||
|
||
try: | ||
fobj = control.tgz().extractfile(fname) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only potential problem I see that at least Debian 11 is using control.tar.xz
inside deb files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for noticing it! I think it should be able to open also tar xz files https://salsa.debian.org/python-debian-team/python-debian/-/blob/master/lib/debian/debfile.py?ref_type=heads#L159
def tgz(self):
# type: () -> tarfile.TarFile
"""Return a TarFile object corresponding to this part of a .deb
package.
Despite the name, this method gives access to various kind of
compressed tar archives, not only gzipped ones.
"""
I'll try to sync some debian 11 deb and see what happens
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe they just confusing with the method name. But it's better to double check for sure. Thanks for taking care of it 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @vzhestkov , Is control.tar.xz
in all Debian 11 packages ? I'm not sure how to check it, but I tried to sync https://deb.nodesource.com/node_18.x/dists/bullseye/main/binary-amd64/
and the changes worked as expected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, I extracted the deb package and it has control.tar.gz
..do you know some repo with packages with control.tar.xz
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tested with https://download.opensuse.org/repositories/systemsmanagement:/saltstack:/bundle:/Debian11/Debian_11/ and it works fine :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for checking 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one more nitpicky suggestion, but other than that looks good for me.
Thanks for taking care of it 👍
fname = fname[1:] | ||
|
||
try: | ||
fobj = control.tgz().extractfile(fname) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for checking 👍
python/uyuni/common/rhn_deb.py
Outdated
try: | ||
fobj = control.tgz().extractfile(fname) | ||
except KeyError: | ||
raise debfile.DebError("File not found inside package") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe explicitly specify that it refers to a control file?
What does this PR change?
Python-debian has changed the way it looks up the file names from the tar headers. Somehow they enforce the dot-slash (./) in the file name starting from the version 0.1.44, while it's totally possible to have a tar with file names as simple relative paths like control, not ./control. Since we cannot downgrade the version (introduced to fix https://github.com/SUSE/spacewalk/issues/17726 ) I just introduced a new method to do the same steps performed in version < 0.1.44 (as described here https://github.com/SUSE/spacewalk/issues/21530#issuecomment-1576992005 )
There's already a bug opened to fix issue in
python-debian
library https://www.mail-archive.com/pkg-python-debian-maint@alioth-lists.debian.net/msg00598.htmlGUI diff
No difference.
Documentation
Test coverage
https://ci.suse.de/view/Manager/view/Uyuni-PRs/job/uyuni-prs-ci-tests/2442/
DONE
Links
Fixes https://github.com/SUSE/spacewalk/issues/21530
Fixes https://github.com/SUSE/spacewalk/issues/21212
Fixes https://github.com/SUSE/spacewalk/issues/20605
Fixes https://github.com/SUSE/spacewalk/issues/21699
Fixes #6396
Fixes https://github.com/SUSE/spacewalk/issues/21700
Fixes #6195
Changelogs
Make sure the changelogs entries you are adding are compliant with https://github.com/uyuni-project/uyuni/wiki/Contributing#changelogs and https://github.com/uyuni-project/uyuni/wiki/Contributing#uyuni-projectuyuni-repository
If you don't need a changelog check, please mark this checkbox:
If you uncheck the checkbox after the PR is created, you will need to re-run
changelog_test
(see below)Re-run a test
If you need to re-run a test, please mark the related checkbox, it will be unchecked automatically once it has re-run: