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

Workaround for python3-debian bug about collecting control file #7215

Merged
merged 1 commit into from
Jul 17, 2023

Conversation

mbussolotto
Copy link
Member

@mbussolotto mbussolotto commented Jun 28, 2023

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.html

GUI diff

No difference.

  • DONE

Documentation

  • No documentation needed
  • DONE

Test coverage

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

  • DONE

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:

  • No changelog needed

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:

  • Re-run test "changelog_test"
  • Re-run test "backend_unittests_pgsql"
  • Re-run test "java_pgsql_tests"
  • Re-run test "schema_migration_test_pgsql"
  • Re-run test "susemanager_unittests"
  • Re-run test "javascript_lint"
  • Re-run test "spacecmd_unittests"

@mbussolotto mbussolotto marked this pull request as ready for review June 28, 2023 14:43
@mbussolotto mbussolotto requested a review from a team as a code owner June 28, 2023 14:43
@mbussolotto mbussolotto force-pushed the fix_deb branch 2 times, most recently from 88d7a5b to 2e1f0d3 Compare June 29, 2023 12:16
fname = fname[1:]

try:
fobj = control.tgz().extractfile(fname)
Copy link
Contributor

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.

Copy link
Member Author

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

Copy link
Contributor

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 👍

Copy link
Member Author

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.

Copy link
Member Author

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 ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for checking 👍

Copy link
Contributor

@vzhestkov vzhestkov left a 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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for checking 👍

try:
fobj = control.tgz().extractfile(fname)
except KeyError:
raise debfile.DebError("File not found inside package")
Copy link
Contributor

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?

@mbussolotto mbussolotto merged commit 9372a09 into uyuni-project:master Jul 17, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Spacewalk-repo-sync File not found inside package Repo sync fail - Hashicorp
2 participants