patches and low-level development discussion
 help / color / mirror / code / Atom feed
blob a5349d68a4d29be5f750650236420c9b5a7257eb 837 bytes (raw)
name: scripts/format-uuid.awk 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
 
# SPDX-License-Identifier: EUPL-1.2+
# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
function format_uuid(arg) {
	if (arg in found_so_far) {
		fail("Duplicate UUID, try changing the image (by even 1 bit)");
	}
	found_so_far[arg] = 1;
	print (substr(arg, 1, 8) "-" \
	       substr(arg, 9, 4) "-" \
	       substr(arg, 13, 4) "-" \
	       substr(arg, 17, 4) "-" \
	       substr(arg, 21, 12));
}

function fail(msg) {
	print msg > "/dev/stderr";
	exit 1;
}

BEGIN {
	FS = "";
	RS = "\n";
	if ((getline) != 1)
		fail("Empty input file");
	roothash = $0;
	if (roothash !~ /^[a-f0-9]{64}$/)
		fail("Invalid root hash");
	if (getline)
		fail("Junk after root hash");
	found_so_far[""] = "";
	for (i = 1; i != 49; i += 16) {
		format_uuid(substr($0, i, 32));
	}
	format_uuid(substr($0, 49, 16) substr($0, 1, 16));
}

debug log:

solving a5349d68a4d29be5f750650236420c9b5a7257eb ...
found a5349d68a4d29be5f750650236420c9b5a7257eb in https://inbox.spectrum-os.org/spectrum-devel/20251121-updates-v4-6-d4561c42776e@gmail.com/ ||
	https://inbox.spectrum-os.org/spectrum-devel/20251119-updates-v3-6-b88a99915509@gmail.com/ ||
	https://inbox.spectrum-os.org/spectrum-devel/20251029-updates-v1-4-401c1be2a11b@gmail.com/ ||
	https://inbox.spectrum-os.org/spectrum-devel/20251112-updates-v2-4-88d96bf81b79@gmail.com/

applying [1/1] https://inbox.spectrum-os.org/spectrum-devel/20251121-updates-v4-6-d4561c42776e@gmail.com/
diff --git a/scripts/format-uuid.awk b/scripts/format-uuid.awk
new file mode 100644
index 0000000000000000000000000000000000000000..a5349d68a4d29be5f750650236420c9b5a7257eb

Checking patch scripts/format-uuid.awk...
Applied patch scripts/format-uuid.awk cleanly.

skipping https://inbox.spectrum-os.org/spectrum-devel/20251119-updates-v3-6-b88a99915509@gmail.com/ for a5349d68a4d29be5f750650236420c9b5a7257eb
skipping https://inbox.spectrum-os.org/spectrum-devel/20251029-updates-v1-4-401c1be2a11b@gmail.com/ for a5349d68a4d29be5f750650236420c9b5a7257eb
skipping https://inbox.spectrum-os.org/spectrum-devel/20251112-updates-v2-4-88d96bf81b79@gmail.com/ for a5349d68a4d29be5f750650236420c9b5a7257eb
index at:
100644 a5349d68a4d29be5f750650236420c9b5a7257eb	scripts/format-uuid.awk

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://spectrum-os.org/git/crosvm
	https://spectrum-os.org/git/doc
	https://spectrum-os.org/git/mktuntap
	https://spectrum-os.org/git/nixpkgs
	https://spectrum-os.org/git/spectrum
	https://spectrum-os.org/git/ucspi-vsock
	https://spectrum-os.org/git/www

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).