-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
primate
committed
Sep 18, 2024
1 parent
fd75482
commit 62ff40b
Showing
2 changed files
with
76 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,20 @@ | ||
// SOURCE: https://gitlab.com/tezos/tezos/-/releases | ||
// PROTOCOLS: PsParisC | ||
// PROTOCOLS: PsParisC, PsquebeC | ||
{ | ||
linux-arm64: { | ||
accuser: https://gitlab.com/tezos/tezos/-/package_files/133747971/download | ||
node: https://gitlab.com/tezos/tezos/-/package_files/133747938/download | ||
client: https://gitlab.com/tezos/tezos/-/package_files/133747755/download | ||
baker: https://gitlab.com/tezos/tezos/-/package_files/133747991/download | ||
baker-next: https://gitlab.com/tezos/tezos/-/package_files/148375495/download | ||
accuser: https://gitlab.com/tezos/tezos/-/package_files/148375523/download | ||
baker: https://gitlab.com/tezos/tezos/-/package_files/148375530/download | ||
node: https://gitlab.com/tezos/tezos/-/package_files/148375455/download | ||
accuser-next: https://gitlab.com/tezos/tezos/-/package_files/148375474/download | ||
client: https://gitlab.com/tezos/tezos/-/package_files/148375314/download | ||
} | ||
linux-x86_64: { | ||
accuser: https://gitlab.com/tezos/tezos/-/package_files/133747113/download | ||
node: https://gitlab.com/tezos/tezos/-/package_files/133747102/download | ||
client: https://gitlab.com/tezos/tezos/-/package_files/133747025/download | ||
baker: https://gitlab.com/tezos/tezos/-/package_files/133747130/download | ||
baker-next: https://gitlab.com/tezos/tezos/-/package_files/148373029/download | ||
accuser: https://gitlab.com/tezos/tezos/-/package_files/148373065/download | ||
baker: https://gitlab.com/tezos/tezos/-/package_files/148373115/download | ||
node: https://gitlab.com/tezos/tezos/-/package_files/148372947/download | ||
accuser-next: https://gitlab.com/tezos/tezos/-/package_files/148372983/download | ||
client: https://gitlab.com/tezos/tezos/-/package_files/148372743/download | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
-- SOURCE: https://gitlab.com/tezos/tezos/-/releases | ||
-- eli src/__xtz/update-sources.lua https://gitlab.com/tezos/tezos/-/packages/25835249 PtParisB | ||
|
||
local hjson = require "hjson" | ||
local args = table.pack(...) | ||
if #args < 2 then | ||
print("Usage: update-sources <source-url> [protocols]") | ||
return | ||
end | ||
|
||
local source = args[1] | ||
local protocol = args[2] | ||
local protocolNext | ||
if #args > 2 then | ||
protocolNext = args[3] | ||
end | ||
|
||
--- extract package id from url source - https://gitlab.com/tezos/tezos/-/packages/25835249 | ||
local packageId = source:match("packages/(%d+)") | ||
if not packageId then | ||
print("Invalid source url") | ||
return | ||
end | ||
|
||
local response = net.download_string("https://gitlab.com/api/v4/projects/3836952/packages/" .. | ||
packageId .. "/package_files?per_page=100") | ||
local files = hjson.parse(response) | ||
|
||
local currentSources = hjson.parse(fs.read_file("src/__xtz/sources.hjson")) | ||
for platform, sources in pairs(currentSources) do | ||
local newSources = {} | ||
-- extract arch from linux-x86_64 | ||
local arch = platform:match("linux%-(.*)") | ||
for sourceId, _ in pairs(sources) do | ||
-- build asset id => <arch>-octez-<sourceId> | ||
local assetIds = { [sourceId] = arch .. "-octez-" .. sourceId } | ||
if sourceId:match("baker") or sourceId:match("accuser") then | ||
assetIds[sourceId] = arch .. "-octez-" .. sourceId .. "-" .. protocol | ||
if protocolNext then | ||
assetIds[sourceId .. "-next"] = arch .. "-octez-" .. sourceId .. "-" .. protocolNext | ||
end | ||
end | ||
|
||
for assetId, assetName in pairs(assetIds) do | ||
-- lookup file id | ||
for _, file in ipairs(files) do | ||
if file.file_name == assetName then | ||
-- update source url | ||
-- https://gitlab.com/tezos/tezos/-/package_files/<id>/download | ||
newSources[assetId] = "https://gitlab.com/tezos/tezos/-/package_files/" .. file.id .. "/download" | ||
break | ||
end | ||
end | ||
end | ||
end | ||
currentSources[platform] = newSources | ||
end | ||
|
||
local newContent = "// SOURCE: https://gitlab.com/tezos/tezos/-/releases\n" | ||
newContent = newContent .. "// PROTOCOLS: " .. string.join(", ", protocol, protocolNext) .. "\n" | ||
newContent = newContent .. hjson.stringify(currentSources, { separator = true }) | ||
|
||
fs.write_file("src/__xtz/sources.hjson", newContent) |