Browse Source

fix up comments and add support for RC/BETA builds

main
John-Mark Gurney 5 years ago
parent
commit
0ddd319bee
Signed by: jmg GPG Key ID: 205F0B33DD006ADA
1 changed files with 50 additions and 14 deletions
  1. +50
    -14
      mksnapidx.awk

+ 50
- 14
mksnapidx.awk View File

@@ -29,6 +29,9 @@
BEGIN { BEGIN {
vmroot = "https://download.freebsd.org/ftp/snapshots/VM-IMAGES/" vmroot = "https://download.freebsd.org/ftp/snapshots/VM-IMAGES/"
isoroot = "https://download.freebsd.org/ftp/snapshots/ISO-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:" { tolower($1) == "message-id:" {
@@ -38,12 +41,10 @@ tolower($1) == "message-id:" {
} }


$0 == "== ISO CHECKSUMS ==" { $0 == "== ISO CHECKSUMS ==" {
root = isoroot
type = "iso" type = "iso"
} }


$0 == "== VM IMAGE CHECKSUMS ==" { $0 == "== VM IMAGE CHECKSUMS ==" {
root = vmroot
type = "vm" type = "vm"
} }


@@ -59,6 +60,8 @@ function isdate(date) {
#FreeBSD-13.0-CURRENT-sparc64-20181026-r339752-bootonly.iso.asc #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-arm64-aarch64-PINE64-LTS-20181026-r339752.img.xz
#FreeBSD-13.0-CURRENT-i386-20181026-r339752.vmdk.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" { $1 == "SHA512" {
# Strip parens # Strip parens
@@ -66,7 +69,7 @@ $1 == "SHA512" {


split(fname, dotparts, ".") 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] basename = dotparts[1] "." dotparts[2]


cnt = split(basename, parts, "-") cnt = split(basename, parts, "-")
@@ -75,30 +78,51 @@ $1 == "SHA512" {
arch = parts[4] arch = parts[4]
basearch = arch basearch = arch
if (parts[4] == "arm" || (parts[4] == "powerpc" && parts[5] == "powerpcspe") || parts[4] == "arm64") { 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] basearch = parts[5]
arch = parts[4] "-" parts[5] arch = parts[4] "-" parts[5]
nextidx = 6 nextidx = 6
} else
} else {
# FreeBSD-11.3-STABLE-amd64-20191011-r353406.qcow2.xz
nextidx = 5 nextidx = 5
}


# find date, may be platform first # 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" platform = "xxx"
date = parts[nextidx] date = parts[nextidx]
nextidx += 1 nextidx += 1
} else { } else {
# FreeBSD-13.0-CURRENT-arm64-aarch64-PINE64-LTS-20181026-r339752.img.xz
platform = parts[nextidx] platform = parts[nextidx]
date = parts[nextidx + 1] date = parts[nextidx + 1]
if (isdate(date)) { if (isdate(date)) {
# FreeBSD-13.0-CURRENT-arm64-aarch64-PINEBOOK-20191011-r353427.img.xz
nextidx += 2 nextidx += 2
} else { } else {
# FreeBSD-13.0-CURRENT-arm64-aarch64-PINE64-LTS-20181026-r339752.img.xz
date = parts[nextidx + 2] date = parts[nextidx + 2]
platform = parts[nextidx] "-" parts[nextidx + 1] platform = parts[nextidx] "-" parts[nextidx + 1]
nextidx += 3 nextidx += 3
} }
} }


if (nextidx == cnt)
if (nextidx >= cnt)
vers="xxx" vers="xxx"
else { else {
vers="" vers=""
@@ -108,20 +132,32 @@ $1 == "SHA512" {
sep="-" 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 # if this part doesn't begin w/ r (for svn rev), skip it, we can't parse
# others for now # 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 next
}


# double check that date is valid, if not, skip it # double check that date is valid, if not, skip it
if (!isdate(date))
if (date != "xxx" && !isdate(date))
next 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)
} }

Loading…
Cancel
Save