diff options
author | Andrew Robbins <contact@andrewrobbins.info> | 2017-06-27 05:33:18 -0400 |
---|---|---|
committer | Andrew Robbins <contact@andrewrobbins.info> | 2017-06-28 00:21:04 -0400 |
commit | f1c378c027db012956d5e8a9585004250550d581 (patch) | |
tree | 81d87f55e9471bb38c23a4657076e76997855ead /libs/project | |
parent | 3f32c13d5ac9159978556bc3fcfd73f39b4e218d (diff) | |
download | librebootfr-f1c378c027db012956d5e8a9585004250550d581.tar.gz librebootfr-f1c378c027db012956d5e8a9585004250550d581.zip |
Added functions for downloading/patching archives
i.e., source tarballs are (partially) supported
Diffstat (limited to 'libs/project')
-rwxr-xr-x | libs/project | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/libs/project b/libs/project index 38e9b40d..93f07ae5 100755 --- a/libs/project +++ b/libs/project @@ -504,6 +504,27 @@ project_sources_archive_missing_check() { fi } +project_sources_prepare() { + local project="$1" + local sources_path="$2" + + # Not implemented yet / May end up not being needed + #project_sources_prepare_blobs + project_sources_prepare_patch "${project}" "${sources_path}" "$@" +} + +project_sources_prepare_patch() { + local project="$1" + local sources_path="$2" + + local project_path="$(project_path "${project}")" + local patches_path="${project_path}/${PATCHES}" + + for patch in "${patches_path}"/[!.]*.{patch,diff}; do + diff_patch_file "${sources_path}" "${patch}" + done +} + project_blobs_path() { local project=$1 shift @@ -676,6 +697,45 @@ project_download_check_git() { git_project_prepare_check "$project" "$repository" "$@" } +project_download_archive() { + local project="$1" + shift + local archive_uri="$1" + shift + local archive_dsig_uri="$1" + + local archive="${archive_uri##*/}" + local compress_fmt="${archive##*.tar}" + + local directory_prefix="${root}/${SOURCES}" + local archive_path="${root}/${SOURCES}/${archive}" + local sources_path="${root}/${SOURCES}/${project}" + + if [[ "${compress_fmt#*.}" != "${ARCHIVE#*.}" ]]; then + ARCHIVE="tar${compress_fmt}" + fi + + # TODO: Split this code block into separate functions + # Archive verification will be included at that point in time + if ! project_sources_directory_filled_check "${project}"; then + wget_wrapper "${directory_prefix}" "${archive_uri}" "${archive_dsig_uri}" + archive_extract "${archive_path}" "${directory_prefix}" + + mv "${archive_path%.tar*}" "${sources_path}" + fi + + # Patch the source, if necessary + project_sources_prepare "${project}" "${sources_path}" +} + +project_download_check_archive() { + local project="$1" + local sources_path="$2" + + # TODO: Write the following function + #project_sources_archive_extract_check "${project}" "${sources_path}" +} + project_extract() { local project=$1 shift |