Implement repo import for prepackged CRS packages #140
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Right now, importing CRS packages created with
bpt pkg create
into a repository is kind of awkward, because you have to manually expand them first before runningbpt repo import
.The description of
bpt repo import
already states Import a directory or package into a CRS repository and the header ofbpt::crs::repository
already contained a method prototype forimport_targz()
, making it obvious that the intention to provide "direct" imports was there already.Notable changes:
bpt::crs::repository::import_targz()
. Note thatimport_targz()
andimport_dir()
share most of the implementation.bpt repo import
(bpt::cli::cmd::<anon>::_import_file()
) checks if the provided path is a (potentially symlinked) regular file or a directory and then calls eitherbpt::crs::repository::import_targz()
orbpt::crs::repository::import_dir()
.bpt::crs::e_repo_importing_dir
tobpt::crs::e_repo_importing_path
and changed various occurences of the worddir
topath
.The import algorithm for CRS packages is basically:
$repo/tmp/...
)I experimented with a different approach for a bit, extracting just the
pkg.json
and storing the original archive in the repository. This has the downside (upside?) that packages containing arbitrary files can be stored in the repository. The current approach would discard any unsupported files during the import, because the archive is rebuilt from scratch.