diff --git a/abuild.in b/abuild.in index 8a93cf2..5c80ad4 100644 --- a/abuild.in +++ b/abuild.in @@ -2260,7 +2260,11 @@ checksum() { [ -z "$source" ] && return 0 fetch for s in $source; do - files="$files $(filename_from_uri $s)" + local name="$(filename_from_uri $s)" + case " $files " in + *" $name "*) die "duplicate found in \$source: $name";; + esac + files="$files $name" done msg "Updating the sha512sums in APKBUILD..." diff --git a/tests/abuild.bats b/tests/abuild.bats index b552ef0..1df0129 100644 --- a/tests/abuild.bats +++ b/tests/abuild.bats @@ -97,3 +97,17 @@ teardown() { sha512sum -c sums } +@test "abuild: test duplicates in checksum generation" { + mkdir -p "$tmpdir"/foo "$tmpdir"/foo/dir1 "$tmpdir"/foo/dir2 + cat >> "$tmpdir"/foo/APKBUILD <<-EOF + pkgname="foo" + pkgver="1.0" + source="dir1/testfile dir2/testfile" + EOF + echo "first" > "$tmpdir"/foo/dir1/testfile + echo "second" > "$tmpdir"/foo/dir2/testfile + cd "$tmpdir"/foo + run $ABUILD checksum + [ $status -ne 0 ] +} +