aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2021-10-21 21:35:12 +0200
committerPřemysl Eric Janouch <p@janouch.name>2021-10-21 21:37:44 +0200
commit95f53863ec971bae69f1d25befd5722235c92cfb (patch)
treef4a889ac09940c42f8a396e816ed8316bcb52b84
parent8ac267c8db771bf87111e29f0511b26e145819fa (diff)
downloadlogdiag-95f53863ec971bae69f1d25befd5722235c92cfb.tar.gz
logdiag-95f53863ec971bae69f1d25befd5722235c92cfb.tar.xz
logdiag-95f53863ec971bae69f1d25befd5722235c92cfb.zip
Win64Depends.sh: verify package checksums
Now the script has nearly reached feature parity with Win32Depends.sh, though it can't be easily run on Windows.
-rw-r--r--Win64Depends.sh25
1 files changed, 15 insertions, 10 deletions
diff --git a/Win64Depends.sh b/Win64Depends.sh
index aa0deab..98b64a9 100644
--- a/Win64Depends.sh
+++ b/Win64Depends.sh
@@ -1,20 +1,20 @@
#!/bin/sh -e
# Win64Depends.sh: download dependencies from MSYS2 for cross-compilation
-# Dependencies: AWK, sed, cURL, bsdtar, wine64
+# Dependencies: AWK, sed, sha256sum, cURL, bsdtar, wine64
repository=https://repo.msys2.org/mingw/mingw64/
status() {
echo "$(tput bold)-- $*$(tput sgr0)"
}
-# TODO: Try to verify checksums, it will be relatively low-effort.
dbsync() {
status Fetching repository DB
[ -f db.tsv ] || curl -# "$repository/mingw64.db" | bsdtar -xOf- | awk '
function flush() { print f["%NAME%"] f["%FILENAME%"] f["%DEPENDS%"] }
NR > 1 && $0 == "%FILENAME%" { flush(); for (i in f) delete f[i] }
- { if (/^[^%]/) f[field] = f[field] $0 "\t"; else field = $0 }
- END { flush() }
+ !/^[^%]/ { field = $0; next } { f[field] = f[field] $0 "\t" }
+ field == "%SHA256SUM%" { path = "*packages/" f["%FILENAME%"]
+ sub(/\t$/, "", path); print $0, path > "db.sums" } END { flush() }
' > db.tsv
}
@@ -23,13 +23,10 @@ fetch() {
mkdir -p packages
awk -F'\t' 'function get(name, i, a) {
if (visited[name]++ || !(name in filenames)) return
- print filenames[name]
- split(deps[name], a)
- for (i in a) get(a[i])
+ print filenames[name]; split(deps[name], a); for (i in a) get(a[i])
} BEGIN { while ((getline < "db.tsv") > 0) {
- filenames[$1] = $2; deps[$1] = ""
- for (i = 3; i <= NF; i++) { gsub(/[<=>].*/, "", $i)
- deps[$1] = deps[$1] $i FS }
+ filenames[$1] = $2; deps[$1] = ""; for (i = 3; i <= NF; i++) {
+ gsub(/[<=>].*/, "", $i); deps[$1] = deps[$1] $i FS }
} for (i = 0; i < ARGC; i++) get(ARGV[i]) }' "$@" | while IFS= read -r name
do
status Fetching "$name"
@@ -37,6 +34,11 @@ fetch() {
done
}
+verify() {
+ status Verifying checksums
+ sha256sum --ignore-missing --quiet -c db.sums
+}
+
extract() {
status Extracting packages
for subdir in *
@@ -62,8 +64,11 @@ cd win32-depends
dbsync
fetch mingw-w64-x86_64-gtk3 mingw-w64-x86_64-lua \
mingw-w64-x86_64-libwinpthread-git # because we don't do "provides"?
+verify
extract
configure
+status Success
+
# XXX: Why is this override needed to run some GLib-based things under wine64?
export XDG_DATA_DIRS=$(pwd)/share