-
Notifications
You must be signed in to change notification settings - Fork 9
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
Support for adding modules from an archive #31
Conversation
6001c55
to
fd7dcfb
Compare
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.
Looks good in general. Thanks for working on this. Please rebase and fix merge conflicts. The test failure should already be addressed in master.
cfbs/commands.py
Outdated
# TODO: use Python modules instead of CLI tools? | ||
if archive_type.startswith(_SUPPORTED_TAR_TYPES): | ||
sh("cd %s; tar -xf %s" % (content_dir, archive_path)) | ||
elif archive_type == (".zip"): | ||
sh("cd %s; unzip %s" % (content_dir, archive_path)) | ||
else: | ||
raise RuntimeError("Unhandled archive type: '%s'. Please report this at %s." % | ||
(url, "https://github.com/cfengine/cfbs/issues")) | ||
|
||
os.unlink(archive_path) |
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.
I guess tar
is usually available, but I definitely know that I've had stuff not working because of missing unzip
before. A python option would be good.
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.
Yeah, but TBH, I don't consider that too important for now. If you want to work with .zip
archives, you most likely have unzip
installed or you can easily install it. I can add a check and a proper error message, though.
.strip("/") also strips leading slashes.
So that it has a better chance working with git repositories that are not at GitHub and various sources in general. Ticket: CFE-3772 Changelog: None
Just like when adding modules from a git repository, but downloading and extracting an archive instead of 'git clone'. The archive needs to contain the 'cfbs.json' index file and one or more modules. Ticket: CFE-3772 Changelog: 'cfbs add' now supports adding modules from archives
Ticket: CFE-3772 Changelog: None
fd7dcfb
to
24e97c0
Compare
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.
ACK
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.
ACK
Just like when adding modules from a git repository.