mirror of
https://github.com/Doodle3D/doodle3d-firmware.git
synced 2024-12-22 11:03:48 +01:00
Identify beta->stable transition as 'update' when includeBetas setting is false.
Fix in index generator in update publisher.
This commit is contained in:
parent
524ef027f5
commit
a5f0492a13
@ -298,7 +298,7 @@ local function generateIndex(newVersion, versionTable, isStable)
|
|||||||
idxFile:write("Files: " .. el.sysupgradeFilename .. "; " .. el.factoryFilename .. "\n")
|
idxFile:write("Files: " .. el.sysupgradeFilename .. "; " .. el.factoryFilename .. "\n")
|
||||||
idxFile:write("FileSize: " .. el.sysupgradeFileSize .. "; " .. el.factoryFileSize .. "\n")
|
idxFile:write("FileSize: " .. el.sysupgradeFileSize .. "; " .. el.factoryFileSize .. "\n")
|
||||||
idxFile:write("MD5: " .. el.sysupgradeMD5 .. "; " .. el.factoryMD5 .. "\n")
|
idxFile:write("MD5: " .. el.sysupgradeMD5 .. "; " .. el.factoryMD5 .. "\n")
|
||||||
idxFile:write("ReleaseDate: " .. um.formatDate(el.timestamp) .. "\n")
|
if el.timestamp then idxFile:write("ReleaseDate: " .. um.formatDate(el.timestamp) .. "\n") end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
idxFile:close()
|
idxFile:close()
|
||||||
|
@ -63,6 +63,7 @@ function M.status(request, response)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local canUpdate = updater.compareVersions(status.newestVersion, status.currentVersion, status.newestReleaseTimestamp, status.currentReleaseTimestamp) > 0
|
local canUpdate = updater.compareVersions(status.newestVersion, status.currentVersion, status.newestReleaseTimestamp, status.currentReleaseTimestamp) > 0
|
||||||
|
if (status.currentVersion.suffix ~= nil) and not includeBetas then canUpdate = true end -- always allow downgrade from beta to stable if !includeBetas
|
||||||
|
|
||||||
response:addData('newest_version', updater.formatVersion(status.newestVersion))
|
response:addData('newest_version', updater.formatVersion(status.newestVersion))
|
||||||
if status.currentReleaseTimestamp then response:addData('current_release_date', updater.formatDate(status.currentReleaseTimestamp)) end
|
if status.currentReleaseTimestamp then response:addData('current_release_date', updater.formatDate(status.currentReleaseTimestamp)) end
|
||||||
|
@ -439,16 +439,28 @@ function M.getStatus(withBetas)
|
|||||||
local verTable,msg = M.getAvailableVersions(withBetas and 'both' or 'stables')
|
local verTable,msg = M.getAvailableVersions(withBetas and 'both' or 'stables')
|
||||||
if not verTable then
|
if not verTable then
|
||||||
D("error: could not obtain available versions (" .. msg .. ")")
|
D("error: could not obtain available versions (" .. msg .. ")")
|
||||||
-- TODO: set an error state in result to signify we probably do not have internet access?
|
|
||||||
return false, result, msg
|
return false, result, msg
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- NOTE: to look up the current version we need a table containing all versions
|
||||||
|
local allVersionsTable,msg
|
||||||
|
if not withBetas then
|
||||||
|
allVersionsTable,msg = M.getAvailableVersions('both')
|
||||||
|
if not allVersionsTable then
|
||||||
|
D("error: could not obtain available versions including betas (" .. msg .. ")")
|
||||||
|
return false, result, msg
|
||||||
|
end
|
||||||
|
else
|
||||||
|
allVersionsTable = verTable
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
local newest = verTable and verTable[#verTable]
|
local newest = verTable and verTable[#verTable]
|
||||||
result.newestVersion = newest and newest.version or unknownVersion
|
result.newestVersion = newest and newest.version or unknownVersion
|
||||||
result.newestReleaseTimestamp = newest and newest.timestamp
|
result.newestReleaseTimestamp = newest and newest.timestamp
|
||||||
|
|
||||||
-- look up timestamp of current version
|
-- look up timestamp of current version
|
||||||
local cEnt = M.findVersion(result.currentVersion, nil, verTable)
|
local cEnt = M.findVersion(result.currentVersion, nil, allVersionsTable)
|
||||||
if cEnt then
|
if cEnt then
|
||||||
result.currentReleaseTimestamp = cEnt.timestamp
|
result.currentReleaseTimestamp = cEnt.timestamp
|
||||||
else
|
else
|
||||||
@ -531,7 +543,6 @@ function M.versionsEqual(versionA, versionB, timestampA, timestampB)
|
|||||||
end
|
end
|
||||||
|
|
||||||
--- Returns information on a version if it can be found in a collection of versions as returned by @{getAvailableVersions}.
|
--- Returns information on a version if it can be found in a collection of versions as returned by @{getAvailableVersions}.
|
||||||
-- FIXME: if no version table is passed in, it will be downloaded but betas will never be included
|
|
||||||
-- @tparam table version The version to look for.
|
-- @tparam table version The version to look for.
|
||||||
-- @tparam bool[opt] withBetas If verTable is not given, download versions including beta releases
|
-- @tparam bool[opt] withBetas If verTable is not given, download versions including beta releases
|
||||||
-- @tparam table[opt] verTable A table containing a collection of versions, if not passed in, it will be obtained using @{getAvailableVersions}.
|
-- @tparam table[opt] verTable A table containing a collection of versions, if not passed in, it will be obtained using @{getAvailableVersions}.
|
||||||
@ -541,7 +552,7 @@ end
|
|||||||
function M.findVersion(version, withBetas, verTable, timestamp)
|
function M.findVersion(version, withBetas, verTable, timestamp)
|
||||||
local msg = nil
|
local msg = nil
|
||||||
version = M.parseVersion(version)
|
version = M.parseVersion(version)
|
||||||
if not verTable then verTable,msg = M.getAvailableVersions(withBetas and 'both' or nil) end
|
if not verTable then verTable,msg = M.getAvailableVersions(withBetas and 'both' or 'stables') end
|
||||||
|
|
||||||
if not verTable then return nil,msg end
|
if not verTable then return nil,msg end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user