Skip to content

Commit fb17c99

Browse files
achow101dongcarl
andcommitted
guix: Don't include directory name in SHA256SUMS
The SHA256SUMS file can be used in a sha256sum -c command to verify downloaded binaries. However users are likely to download just a single file and not place this file in the correct directory relative to the SHA256SUMS file for the simple verification command to work. By not including the directory name in the SHA256SUMS file, it will be easier for users to verify downloaded binaries. Co-authored-by: Carl Dong <[email protected]>
1 parent 8193294 commit fb17c99

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

contrib/guix/guix-attest

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,18 @@ EOF
162162
echo "Attesting to build outputs for version: '${VERSION}'"
163163
echo ""
164164

165+
# Given a SHA256SUMS file as stdin that has lines like:
166+
# 0ba536819b221a91d3d42e978be016aac918f40984754d74058aa0c921cd3ea6 a/b/d/c/d/s/bitcoin-22.0rc2-riscv64-linux-gnu.tar.gz
167+
# ...
168+
#
169+
# Replace each line's file name with its basename:
170+
# 0ba536819b221a91d3d42e978be016aac918f40984754d74058aa0c921cd3ea6 bitcoin-22.0rc2-riscv64-linux-gnu.tar.gz
171+
# ...
172+
#
173+
basenameify_SHA256SUMS() {
174+
sed -E 's@(^[[:xdigit:]]{64}[[:space:]]+).+/([^/]+$)@\1\2@'
175+
}
176+
165177
outsigdir="$GUIX_SIGS_REPO/$VERSION/$signer_name"
166178
mkdir -p "$outsigdir"
167179
(
@@ -174,6 +186,7 @@ mkdir -p "$outsigdir"
174186
cat "${noncodesigned_fragments[@]}" \
175187
| sort -u \
176188
| sort -k2 \
189+
| basenameify_SHA256SUMS \
177190
> "$temp_noncodesigned"
178191
if [ -e noncodesigned.SHA256SUMS ]; then
179192
# The SHA256SUMS already exists, make sure it's exactly what we
@@ -201,6 +214,7 @@ mkdir -p "$outsigdir"
201214
cat "${sha256sum_fragments[@]}" \
202215
| sort -u \
203216
| sort -k2 \
217+
| basenameify_SHA256SUMS \
204218
> "$temp_all"
205219
if [ -e all.SHA256SUMS ]; then
206220
# The SHA256SUMS already exists, make sure it's exactly what we

0 commit comments

Comments
 (0)