From 64a977d2eaa461b3ec583dc6dab9cf38f55ce377 Mon Sep 17 00:00:00 2001
From: "dylan.araps@gmail.com" <dylan.araps@gmail.com>
Date: Sat, 29 Jun 2019 07:02:42 +0000
Subject: kiss-new: Ensure that each package has checksums.

FossilOrigin-Name: 72655c01aa409ceb9161a6316816f9ae3acd3baa7a7aac0dcd29ae9d3d8bbdda
---
 kiss-new | 26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

(limited to 'kiss-new')

diff --git a/kiss-new b/kiss-new
index 69ba4c2..1fe6de0 100755
--- a/kiss-new
+++ b/kiss-new
@@ -151,8 +151,30 @@ pkg_sources() {
 }
 
 pkg_build() {
-    # Build packages.
-    :
+    # Build packages and turn them into packaged tarballs. This function
+    # also checks checksums, downloads sources and ensure all dependencies
+    # are installed.
+
+    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")
+
+        # Ensure that checksums exist prior to building the package.
+        [ -f "$repo_dir/checksums" ] || {
+            log "[$pkg]: Checksums are missing."
+
+            # Instead of dying above, log it to the terminal. Also define a
+            # variable so we *can* die after all checksum files have been
+            # checked.
+            no_checkums="$no_checkums$pkg "
+        }
+    done
+
+    # Die here as packages without checksums were found above.
+    [ "$no_checkums" ] &&
+        die "Run '$kiss checksum ${no_checkums% }' to generate checksums."
 }
 
 pkg_checksums() {
-- 
cgit v1.2.3