Skip to content

Commit 485d0f2

Browse files
committed
fetch-latest-releases.lua: stylua formmating
Apply stylua. No functional changes.
1 parent 42996e2 commit 485d0f2

1 file changed

Lines changed: 8 additions & 12 deletions

File tree

fetch-latest-releases.lua

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ local lfs = require("lfs")
1111
local m = {}
1212
m.mirror = os.getenv("MIRROR") or "https://cz.alpinelinux.org/alpine"
1313

14-
1514
function m.fatal(...)
1615
m.errormsg(...)
1716
os.exit(1)
@@ -60,12 +59,12 @@ function m.mkdockerfile(dir, rootfsfile)
6059
if not f then
6160
m.fatal("Error: %s: %s", filename, err)
6261
end
63-
f:write(string.format("FROM scratch\nADD %s /\nCMD [\"/bin/sh\"]\n", rootfsfile))
62+
f:write(string.format('FROM scratch\nADD %s /\nCMD ["/bin/sh"]\n', rootfsfile))
6463
f:close()
6564
end
6665

6766
function m.minirootfs_image(images)
68-
for _,img in pairs(images) do
67+
for _, img in pairs(images) do
6968
if img.flavor == "alpine-minirootfs" then
7069
return img
7170
end
@@ -76,26 +75,24 @@ end
7675
function m.get_minirootfs(images, destdir)
7776
local img = m.minirootfs_image(images)
7877
if destdir then
79-
local url = string.format("%s/%s/releases/%s/%s",
80-
m.mirror, img.branch, img.arch, img.file)
78+
local url = string.format("%s/%s/releases/%s/%s", m.mirror, img.branch, img.arch, img.file)
8179
local archdir = string.format("%s/%s", destdir, img.arch)
8280
local ok, errmsg = lfs.mkdir(archdir)
8381
m.fetch_file(url, string.format("%s/%s", archdir, img.file))
8482
m.mkdockerfile(archdir, img.file)
8583
print(img.file)
8684
end
87-
return { version=img.version, file=img.file, sha512=img.sha512 }
85+
return { version = img.version, file = img.file, sha512 = img.sha512 }
8886
end
8987

9088
-- get array of minirootsfs releases --
9189
function m.get_releases(branch, destdir)
92-
local arches = { "aarch64", "armhf", "armv7", "ppc64le" , "riscv64", "s390x", "x86", "x86_64" }
90+
local arches = { "aarch64", "armhf", "armv7", "ppc64le", "riscv64", "s390x", "x86", "x86_64" }
9391
local t = {}
9492
local loop = cqueues.new()
9593
for _, arch in pairs(arches) do
9694
loop:wrap(function()
97-
local url = string.format("%s/%s/releases/%s/latest-releases.yaml",
98-
m.mirror, branch, arch)
95+
local url = string.format("%s/%s/releases/%s/latest-releases.yaml", m.mirror, branch, arch)
9996
local status, body = m.fetch(url)
10097
if status == "200" then
10198
t[arch] = m.get_minirootfs((yaml.load(body)), destdir)
@@ -142,15 +139,14 @@ if not m.equal_versions(releases) then
142139
end
143140

144141
local f = io.open(string.format("%s/checksums.sha512", destdir), "w")
145-
for arch,rel in pairs(releases) do
142+
for arch, rel in pairs(releases) do
146143
local line = string.format("%s %s/%s\n", rel.sha512, arch, rel.file)
147144
f:write(line)
148-
version=rel.version
145+
version = rel.version
149146
end
150147
f:close()
151148

152149
-- write version
153150
f = io.open(string.format("%s/VERSION", destdir), "w")
154151
f:write(version)
155152
f:close()
156-

0 commit comments

Comments
 (0)