kiss: remove occurrence of blank checksum files when checksums aren't needed. Closes #185
This commit is contained in:
parent
6998e9f58c
commit
6ba7b61bfb
24
kiss
24
kiss
|
@ -130,9 +130,6 @@ pkg_lint() {
|
||||||
[ "$release" ] || die "$1" "Release field not found in version file"
|
[ "$release" ] || die "$1" "Release field not found in version file"
|
||||||
[ -x build ] || die "$1" "Build file not found or not executable"
|
[ -x build ] || die "$1" "Build file not found or not executable"
|
||||||
[ -f sources ] || war "$1" "Sources file not found"
|
[ -f sources ] || war "$1" "Sources file not found"
|
||||||
|
|
||||||
[ ! -f sources ] || [ "$2" ] || [ -f checksums ] ||
|
|
||||||
die "$1" "Checksums are missing"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pkg_find() {
|
pkg_find() {
|
||||||
|
@ -743,9 +740,16 @@ pkg_verify() {
|
||||||
for pkg do repo_dir=$(pkg_find "$pkg")
|
for pkg do repo_dir=$(pkg_find "$pkg")
|
||||||
[ -f "$repo_dir/sources" ] || continue
|
[ -f "$repo_dir/sources" ] || continue
|
||||||
|
|
||||||
|
verify_sum=$(pkg_checksums "$pkg")
|
||||||
|
|
||||||
|
[ "$verify_sum" ] || continue
|
||||||
|
[ -f "$repo_dir/checksums" ] || die "$pkg" "checksums file missing"
|
||||||
|
|
||||||
# Check that the first column (separated by whitespace) match in both
|
# Check that the first column (separated by whitespace) match in both
|
||||||
# checksum files. If any part of either file differs, mismatch. Abort.
|
# checksum files. If any part of either file differs, mismatch. Abort.
|
||||||
pkg_checksums "$pkg" | awk "$verify_cmd" - "$repo_dir/checksums" || {
|
printf '%s\n' "$verify_sum" |
|
||||||
|
|
||||||
|
awk "$verify_cmd" - "$repo_dir/checksums" || {
|
||||||
log "$pkg" "Checksum mismatch"
|
log "$pkg" "Checksum mismatch"
|
||||||
|
|
||||||
# Instead of dying above, log it to the terminal. Also define a
|
# Instead of dying above, log it to the terminal. Also define a
|
||||||
|
@ -1443,20 +1447,26 @@ args() {
|
||||||
;;
|
;;
|
||||||
|
|
||||||
c|checksum)
|
c|checksum)
|
||||||
for pkg do pkg_lint "$pkg" c; done
|
for pkg do pkg_lint "$pkg"; done
|
||||||
for pkg do pkg_sources "$pkg" c; done
|
for pkg do pkg_sources "$pkg" c; done
|
||||||
for pkg do
|
for pkg do
|
||||||
repo_dir=$(pkg_find "$pkg")
|
repo_dir=$(pkg_find "$pkg")
|
||||||
|
|
||||||
# Support packages without sources. Simply do nothing.
|
|
||||||
[ -f "$repo_dir/sources" ] || {
|
[ -f "$repo_dir/sources" ] || {
|
||||||
log "$pkg" "No sources file, skipping checksums"
|
log "$pkg" "No sources file, skipping checksums"
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sums=$(pkg_checksums "$pkg")
|
||||||
|
|
||||||
|
[ "$sums" ] || {
|
||||||
|
log "$pkg" "No sources needing checksums"
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
# False positive ('>> file' with no command).
|
# False positive ('>> file' with no command).
|
||||||
# shellcheck disable=2188
|
# shellcheck disable=2188
|
||||||
pkg_checksums "$pkg" |
|
printf '%s\n' "$sums" |
|
||||||
|
|
||||||
if 2>/dev/null >> "$repo_dir/checksums"; then
|
if 2>/dev/null >> "$repo_dir/checksums"; then
|
||||||
tee "$repo_dir/checksums"
|
tee "$repo_dir/checksums"
|
||||||
|
|
Loading…
Reference in New Issue