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.
This commit is contained in:
		
							parent
							
								
									8ac267c8db
								
							
						
					
					
						commit
						95f53863ec
					
				| @ -1,20 +1,20 @@ | |||||||
| #!/bin/sh -e | #!/bin/sh -e | ||||||
| # Win64Depends.sh: download dependencies from MSYS2 for cross-compilation | # 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/ | repository=https://repo.msys2.org/mingw/mingw64/ | ||||||
| 
 | 
 | ||||||
| status() { | status() { | ||||||
| 	echo "$(tput bold)-- $*$(tput sgr0)" | 	echo "$(tput bold)-- $*$(tput sgr0)" | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| # TODO: Try to verify checksums, it will be relatively low-effort. |  | ||||||
| dbsync() { | dbsync() { | ||||||
| 	status Fetching repository DB | 	status Fetching repository DB | ||||||
| 	[ -f db.tsv ] || curl -# "$repository/mingw64.db" | bsdtar -xOf- | awk ' | 	[ -f db.tsv ] || curl -# "$repository/mingw64.db" | bsdtar -xOf- | awk ' | ||||||
| 		function flush() { print f["%NAME%"] f["%FILENAME%"] f["%DEPENDS%"] } | 		function flush() { print f["%NAME%"] f["%FILENAME%"] f["%DEPENDS%"] } | ||||||
| 		NR > 1 && $0 == "%FILENAME%" { flush(); for (i in f) delete f[i] } | 		NR > 1 && $0 == "%FILENAME%" { flush(); for (i in f) delete f[i] } | ||||||
| 		{ if (/^[^%]/) f[field] = f[field] $0 "\t"; else field = $0 } | 		!/^[^%]/ { field = $0; next } { f[field] = f[field] $0 "\t" } | ||||||
| 		END { flush() } | 		field == "%SHA256SUM%" { path = "*packages/" f["%FILENAME%"] | ||||||
|  | 			sub(/\t$/, "", path); print $0, path > "db.sums" } END { flush() } | ||||||
| 	' > db.tsv | 	' > db.tsv | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -23,13 +23,10 @@ fetch() { | |||||||
| 	mkdir -p packages | 	mkdir -p packages | ||||||
| 	awk -F'\t' 'function get(name,    i, a) { | 	awk -F'\t' 'function get(name,    i, a) { | ||||||
| 		if (visited[name]++ || !(name in filenames)) return | 		if (visited[name]++ || !(name in filenames)) return | ||||||
| 		print filenames[name] | 		print filenames[name]; split(deps[name], a); for (i in a) get(a[i]) | ||||||
| 		split(deps[name], a) |  | ||||||
| 		for (i in a) get(a[i]) |  | ||||||
| 	} BEGIN { while ((getline < "db.tsv") > 0) { | 	} BEGIN { while ((getline < "db.tsv") > 0) { | ||||||
| 		filenames[$1] = $2; deps[$1] = "" | 		filenames[$1] = $2; deps[$1] = ""; for (i = 3; i <= NF; i++) { | ||||||
| 		for (i = 3; i <= NF; i++) { gsub(/[<=>].*/, "", $i) | 			gsub(/[<=>].*/, "", $i); deps[$1] = deps[$1] $i FS } | ||||||
| 			deps[$1] = deps[$1] $i FS } |  | ||||||
| 	} for (i = 0; i < ARGC; i++) get(ARGV[i]) }' "$@" | while IFS= read -r name | 	} for (i = 0; i < ARGC; i++) get(ARGV[i]) }' "$@" | while IFS= read -r name | ||||||
| 	do | 	do | ||||||
| 		status Fetching "$name" | 		status Fetching "$name" | ||||||
| @ -37,6 +34,11 @@ fetch() { | |||||||
| 	done | 	done | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | verify() { | ||||||
|  | 	status Verifying checksums | ||||||
|  | 	sha256sum --ignore-missing --quiet -c db.sums | ||||||
|  | } | ||||||
|  | 
 | ||||||
| extract() { | extract() { | ||||||
| 	status Extracting packages | 	status Extracting packages | ||||||
| 	for subdir in * | 	for subdir in * | ||||||
| @ -62,8 +64,11 @@ cd win32-depends | |||||||
| dbsync | dbsync | ||||||
| fetch mingw-w64-x86_64-gtk3 mingw-w64-x86_64-lua \ | fetch mingw-w64-x86_64-gtk3 mingw-w64-x86_64-lua \ | ||||||
| 	mingw-w64-x86_64-libwinpthread-git # because we don't do "provides"? | 	mingw-w64-x86_64-libwinpthread-git # because we don't do "provides"? | ||||||
|  | verify | ||||||
| extract | extract | ||||||
| configure | configure | ||||||
| 
 | 
 | ||||||
|  | status Success | ||||||
|  | 
 | ||||||
| # XXX: Why is this override needed to run some GLib-based things under wine64? | # XXX: Why is this override needed to run some GLib-based things under wine64? | ||||||
| export XDG_DATA_DIRS=$(pwd)/share | export XDG_DATA_DIRS=$(pwd)/share | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user