From 0ddd319bee0312ce1d83167ad159e7a7840c2903 Mon Sep 17 00:00:00 2001 From: John-Mark Gurney Date: Fri, 18 Oct 2019 01:35:07 -0700 Subject: [PATCH] fix up comments and add support for RC/BETA builds --- mksnapidx.awk | 64 ++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 50 insertions(+), 14 deletions(-) diff --git a/mksnapidx.awk b/mksnapidx.awk index d22b6c3..3889574 100644 --- a/mksnapidx.awk +++ b/mksnapidx.awk @@ -29,6 +29,9 @@ BEGIN { vmroot = "https://download.freebsd.org/ftp/snapshots/VM-IMAGES/" isoroot = "https://download.freebsd.org/ftp/snapshots/ISO-IMAGES/" + + relvmroot = "https://download.freebsd.org/ftp/releases/VM-IMAGES/" + relisoroot = "https://download.freebsd.org/ftp/releases/ISO-IMAGES/" } tolower($1) == "message-id:" { @@ -38,12 +41,10 @@ tolower($1) == "message-id:" { } $0 == "== ISO CHECKSUMS ==" { - root = isoroot type = "iso" } $0 == "== VM IMAGE CHECKSUMS ==" { - root = vmroot type = "vm" } @@ -59,6 +60,8 @@ function isdate(date) { #FreeBSD-13.0-CURRENT-sparc64-20181026-r339752-bootonly.iso.asc #FreeBSD-13.0-CURRENT-arm64-aarch64-PINE64-LTS-20181026-r339752.img.xz #FreeBSD-13.0-CURRENT-i386-20181026-r339752.vmdk.xz +#FreeBSD-12.1-BETA3-amd64-mini-memstick.img.xz +#FreeBSD-12.1-RC1-amd64-mini-memstick.img.xz $1 == "SHA512" { # Strip parens @@ -66,7 +69,7 @@ $1 == "SHA512" { split(fname, dotparts, ".") - # recombine around version string, strips of ALL extensions (including vm type) + # recombine around dot in version, strips off ALL extensions (including vm type) basename = dotparts[1] "." dotparts[2] cnt = split(basename, parts, "-") @@ -75,30 +78,51 @@ $1 == "SHA512" { arch = parts[4] basearch = arch if (parts[4] == "arm" || (parts[4] == "powerpc" && parts[5] == "powerpcspe") || parts[4] == "arm64") { + # FreeBSD-11.3-STABLE-arm64-aarch64-20191011-r353406-memstick.img basearch = parts[5] arch = parts[4] "-" parts[5] nextidx = 6 - } else + } else { + # FreeBSD-11.3-STABLE-amd64-20191011-r353406.qcow2.xz nextidx = 5 + } # find date, may be platform first - if (isdate(parts[nextidx])) { + if (index(parts[3], "BETA") == 1 || index(parts[3], "RC") == 1) { + if (nextidx > cnt) { + # FreeBSD-12.1-BETA3-i386.vhd.xz + platform = "xxx" + } else if (cnt == nextidx) { + # FreeBSD-12.1-RC1-powerpc-powerpcspe-dvd1.iso + platform = parts[nextidx] + nextidx += 1 + } else { + # FreeBSD-12.1-BETA3-amd64-mini-memstick.img.xz + platform = parts[nextidx] "-" parts[nextidx + 1] + nextidx += 2 + } + date = "xxx" + } else if (isdate(parts[nextidx])) { + # FreeBSD-11.3-STABLE-amd64-20191011-r353406.qcow2.xz platform = "xxx" date = parts[nextidx] nextidx += 1 } else { + # FreeBSD-13.0-CURRENT-arm64-aarch64-PINE64-LTS-20181026-r339752.img.xz platform = parts[nextidx] date = parts[nextidx + 1] if (isdate(date)) { + # FreeBSD-13.0-CURRENT-arm64-aarch64-PINEBOOK-20191011-r353427.img.xz nextidx += 2 } else { + # FreeBSD-13.0-CURRENT-arm64-aarch64-PINE64-LTS-20181026-r339752.img.xz date = parts[nextidx + 2] platform = parts[nextidx] "-" parts[nextidx + 1] nextidx += 3 } } - if (nextidx == cnt) + if (nextidx >= cnt) vers="xxx" else { vers="" @@ -108,20 +132,32 @@ $1 == "SHA512" { sep="-" } } - if (type == "vm") { - vers = dotparts[3] - url = root parts[2] "-" parts[3] "/" basearch "/" date "/" fname - } else - url = root parts[2] "/" fname + if (index(parts[3], "BETA") == 1 || index(parts[3], "RC") == 1) { + if (type == "vm") + url = relvmroot parts[2] "-" parts[3] "/" basearch "/Latest/" fname + else + url = relisoroot parts[2] "/" fname + } else { + if (type == "vm") { + vers = dotparts[3] + url = vmroot parts[2] "-" parts[3] "/" basearch "/" date "/" fname + } else + url = isoroot parts[2] "/" fname + } # if this part doesn't begin w/ r (for svn rev), skip it, we can't parse # others for now - if (substr(parts[nextidx], 1, 1) != "r") + rev = parts[nextidx] + if (index(parts[3], "BETA") == 1 || index(parts[3], "RC") == 1) { + # FreeBSD-12.1-RC1-amd64-mini-memstick.img.xz + rev = "unspec" + } else if (substr(rev, 1, 1) != "r") { next + } # double check that date is valid, if not, skip it - if (!isdate(date)) + if (date != "xxx" && !isdate(date)) next - printf("%s %s %s %s %s %s %s %s %s %s\n", type, parts[2] "-" parts[3], arch, platform, date, parts[nextidx], vers, fname, url, MID) + printf("%s %s %s %s %s %s %s %s %s %s\n", type, parts[2] "-" parts[3], arch, platform, date, rev, vers, fname, url, MID) }