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

Fix SRPM collection #63

Closed
wants to merge 3 commits into from
Closed

Conversation

chmeliik
Copy link
Contributor

@chmeliik chmeliik commented Apr 9, 2024

Previously, the sib_dirs.rpms_dir would only get initialized in
prepare_base_image_sources.

While processing prefetched SRPMs, if base image sources were not
processed, the rpms_dir would still be unset. The SRPMs would get copied
into os.path.join("", ...) (so somewhere in the current directory) and
the script would ignore all of them, because the condition for including
the rpms_dir is that sib_dirs.rpms_dir must be set.

Fix by always initializing rpms_dir at the beginning and changing the
condition from "rpms_dir must be set" to "rpms_dir must not be empty".

chmeliik added 3 commits April 9, 2024 18:08
Instead of calling tar in a subprocess, extract the member using
Python's tarfile library.

This vastly simplifies mocking, so unit tests no longer have to
patch("source_build.extract_blob_member"). This way, the extraction
actually happens and the tests are a bit less disconnected from the
actual behavior.

Signed-off-by: Adam Cmiel <[email protected]>
Previously, the sib_dirs.rpms_dir would only get initialized in
prepare_base_image_sources.

While processing prefetched SRPMs, if base image sources were not
processed, the rpms_dir would still be unset. The SRPMs would get copied
into os.path.join("", ...) (so somewhere in the current directory) and
the script would ignore all of them, because the condition for including
the rpms_dir is that sib_dirs.rpms_dir must be set.

Fix by always initializing rpms_dir at the beginning and changing the
condition from "rpms_dir must be set" to "rpms_dir must not be empty".

Signed-off-by: Adam Cmiel <[email protected]>
Instead of creating the cachi2 directory in setUpClass and cleaning it
up in tearDownClass, do this for each test case (in setUp and tearDown).

That way, the custom try-finally code for cleanup is no longer needed.

Signed-off-by: Adam Cmiel <[email protected]>
Copy link
Contributor

@tkdchen tkdchen left a comment

Choose a reason for hiding this comment

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

#62 covers the rpm_dir issue already. Also no need to update extract_blob_member method, it is useless and removed in the #62

@chmeliik chmeliik closed this Apr 17, 2024
@chmeliik chmeliik deleted the fix-srpm-collection branch April 17, 2024 10:57
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.

2 participants