From 5cd42f98ca9f6bc5d37798090a5d13c03f6b7383 Mon Sep 17 00:00:00 2001 From: "dylan.araps@gmail.com" Date: Sat, 29 Jun 2019 14:01:46 +0000 Subject: kiss-new: Added pkg_extract FossilOrigin-Name: 61f706b77f9387e2c83afb21ea38655ed5200b641ed5696ebbed86fc83849a7a --- kiss-new | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/kiss-new b/kiss-new index 250f8fd..166d144 100755 --- a/kiss-new +++ b/kiss-new @@ -162,6 +162,47 @@ pkg_sources() { done < "$repo_dir/sources" } +pkg_extract() { + # Extract all source archives to the build diectory and copy over + # any local repository files. + log "[$1]: Extracting sources..." + + # Store each downloaded source in named after the package it + # belongs to. This avoid conflicts between two packages having a + # source of the same name. + mkdir -p "$mak_dir/$1" && cd "$mak_dir/$1" + + # Find the package's repository files. This needs to keep + # happening as we can't store this data in any kind of data + # structure. + repo_dir=$(pkg_search "$1") + + while read -r src dest; do + mkdir -p "./$dest" + + case $src in + # Do nothing as git repository was downloaded to the build + # diectory directly. + git:*) ;; + + # Only 'tar' archives are currently supported for extaction. + # Any other filetypes are simply copied to '$mak_dir' which + # allows you to extract them manually. + *://*.tar*|*://*.tgz) + tar xf "$src_dir/$1/${src##*/}" -C "./$dest" \ + --strip-components 1 \ + || die "[$1]: Couldn't extract ${src##*/}." + ;; + + # Local files (Any source that is non-remote is assumed to be local). + *) + [ -f "$repo_dir/$src" ] || die "[$1]: Local file $src not found." + cp -f "$repo_dir/$src" "./$dest" + ;; + esac + done < "$repo_dir/sources" +} + pkg_depends() { # Resolve all dependencies and install them in the right order. @@ -267,6 +308,9 @@ pkg_build() { [ "$mismatch" ] && die "Checksum mismatch with: ${mismatch% }" log "Verified all checksums." + + for pkg; do pkg_extract "$pkg"; done + log "Extracted all sources." } pkg_checksums() { -- cgit v1.2.3