aboutsummaryrefslogtreecommitdiff
path: root/kiss-new
diff options
context:
space:
mode:
authordylan.araps@gmail.com <dylan.araps@gmail.com>2019-06-29 08:16:12 +0000
committerdylan.araps@gmail.com <dylan.araps@gmail.com>2019-06-29 08:16:12 +0000
commit4404899c5f1cdda813d5ab48a0b85d1d987c0727 (patch)
treeae66b0487e06800b87b0f0d6faa0a43460a986a6 /kiss-new
parentc3e46ba962f4593df3014363d727f7e06e754e9b (diff)
downloadcpt-4404899c5f1cdda813d5ab48a0b85d1d987c0727.tar.gz
kiss-new: Started work on package verification.
FossilOrigin-Name: d682ef5fb6f8a418965f57224d25a8dbedc145dc2ee24f6294c468e3495b2ee3
Diffstat (limited to 'kiss-new')
-rwxr-xr-xkiss-new44
1 files changed, 39 insertions, 5 deletions
diff --git a/kiss-new b/kiss-new
index 77d25ef..9ad9a59 100755
--- a/kiss-new
+++ b/kiss-new
@@ -145,7 +145,10 @@ pkg_sources() {
continue
}
- wget "$src" || die "[$1]: Failed to download $src."
+ wget "$src" || {
+ rm -f "${src##*/}"
+ die "[$1]: Failed to download $src."
+ }
;;
# Local files (Any source that is non-remote is assumed to be local).
@@ -204,6 +207,8 @@ pkg_build() {
}
log "Installing: $*."
+ for pkg; do pkg_lint "$pkg"; done
+
for pkg; do
# Find the package's repository files. This needs to keep
# happening as we can't store this data in any kind of data
@@ -226,14 +231,33 @@ pkg_build() {
die "Run '$kiss checksum ${no_checkums% }' to generate checksums."
for pkg; do pkg_sources "$pkg"; done
+
+ for pkg; do
+ # 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 "$pkg")
+
+ pkg_checksums "$pkg"
+
+ cmp -s "$cac_dir/checksums-$pkg" "$repo_dir/checksums" || {
+ log "[$pkg]: Checksum mismatch."
+
+ # Instead of dying above, log it to the terminal. Also define a
+ # variable so we *can* die after all checksum files have been
+ # checked.
+ mismatch="$mismatch$pkg "
+ }
+ done
+
+ # Die here as packages with differing checksums were found above.
+ [ "$mismatch" ] &&
+ die "Checksum mismatch with: ${mismatch% }"
}
pkg_checksums() {
# Generate checksums for packages.
# This also downloads any remote sources.
- for pkg; do pkg_lint "$pkg"; done
- for pkg; do pkg_sources "$pkg"; done
-
for pkg; do
# Find the package's repository files. This needs to keep
# happening as we can't store this data in any kind of data
@@ -270,7 +294,8 @@ pkg_checksums() {
src_path=
;;
esac
- done < "$repo_dir/sources" > "$repo_dir/checksums"
+ done < "$repo_dir/sources" | \
+ tee "$cac_dir/checksums-$pkg" > "$repo_dir/checksums"
log "[$pkg]: Generated checksums."
done
@@ -309,7 +334,12 @@ setup_caching() {
pkg_clean() {
# Clean up on exit or error. This removes everything related
# to the build.
+
+ # Remove temporary directories.
rm -rf -- "$mak_dir" "$pkg_dir" "$tar_dir"
+
+ # Remove temporary checksum files.
+ rm -rf -- "$cac_dir/checksums-"*
}
root_check() {
@@ -342,6 +372,10 @@ args() {
c*)
shift
[ "$1" ] || die "'kiss checksum' requires an argument."
+
+ for pkg; do pkg_lint "$pkg"; done
+ for pkg; do pkg_sources "$pkg"; done
+
pkg_checksums "$@"
;;