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

Added --output-dir flag in download command #98

Merged
merged 2 commits into from
Dec 19, 2024

Conversation

victormlg
Copy link
Contributor

No description provided.

@@ -296,7 +296,7 @@ def _iterate_over_packages(tags=None, version=None, edition=None, download=False
else:
for artifact in artifacts:
if download:
download_package(artifact.url)
download_package(artifact.url, directory=output_dir)
Copy link
Member

Choose a reason for hiding this comment

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

Take a look at the ticket again. We want to keep downloading to the same place, and then copy once it's done downloading and also checksum is verified.

Comment on lines 311 to 315
tmp_filename = '.{}.tmp'.format(filename)
tmp_output_path = os.path.join(output_dir, tmp_filename)

shutil.copyfile(package_path, tmp_output_path)
os.rename(tmp_output_path, output_path)
Copy link
Member

Choose a reason for hiding this comment

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

@victormlg This logic (generate tmp filename, copy to temp file, rename) is generally useful. Maybe you could put these 4 lines into a new function, called copy_file in utils.py?

tmp_output_path = os.path.join(output_dir, tmp_filename)

shutil.copyfile(input_path, tmp_output_path)
os.rename(tmp_output_path, output_path)
Copy link
Member

Choose a reason for hiding this comment

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

Please add a newline (empty line) at the end of the file. That's what the red circle with minus means here in GitHub.

Copy link
Member

@olehermanse olehermanse left a comment

Choose a reason for hiding this comment

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

@victormlg Looks good, can you squash the commits?

Ticket: CFE-3684
Signed-off-by: Victor Moene <[email protected]>
@olehermanse olehermanse merged commit e307c0c into cfengine:master Dec 19, 2024
5 checks passed
@victormlg victormlg deleted the CFE-3684 branch December 20, 2024 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants