aboutsummaryrefslogtreecommitdiff
path: root/kiss-new
diff options
context:
space:
mode:
authordylan.araps@gmail.com <dylan.araps@gmail.com>2019-06-29 14:01:46 +0000
committerdylan.araps@gmail.com <dylan.araps@gmail.com>2019-06-29 14:01:46 +0000
commit5cd42f98ca9f6bc5d37798090a5d13c03f6b7383 (patch)
treebbbb2f89d84a72ee7bc1408cd8cbb3c8499866ed /kiss-new
parent2bffa8a44d7cf071e47dc659b3bbfa1dc0a60036 (diff)
downloadcpt-5cd42f98ca9f6bc5d37798090a5d13c03f6b7383.tar.gz
kiss-new: Added pkg_extract
FossilOrigin-Name: 61f706b77f9387e2c83afb21ea38655ed5200b641ed5696ebbed86fc83849a7a
Diffstat (limited to 'kiss-new')
-rwxr-xr-xkiss-new44
1 files changed, 44 insertions, 0 deletions
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() {