Skip to content

Commit

Permalink
Updated SPEC to incude checksum at an addon level, and added in a w…
Browse files Browse the repository at this point in the history
…arning when explicit repositories are specified, but not used.
  • Loading branch information
adamharrison committed Mar 29, 2024
1 parent 636fbcf commit dd06ba2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
3 changes: 2 additions & 1 deletion SPEC.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ Fields that are required are bolded.
with a dictionary, takes `ARCH` keys, and runs a different command per `ARCH`.
* `url`: Optionally a URL which specifies a direct download link to a single lua file.
precludes the use of `remote`, `path`. Usually a `singleton`.
* `checksum`: Provides a checksum to check against a `url`.
* `extra`: Optionally a dictionary which holds any desired extra information.

Any keys not present in this official listing render the manifest non-conforming.
Expand Down Expand Up @@ -121,7 +122,7 @@ be extracted inside the addon's directory.
Lite-XLs represent different version of lite-xl that are registered in this
repository. Lite-XLs has the following metadata, as well as a `files` array.

* `version`: A version specifier. Must take the form of x.x(.x)(-suffix).
* `version`: A version specifier. Must take the form of x(.x)\*(-suffix).
Suffixes can be used to denote different flavours of lite-xl.
* `mod_version`: The modversion the binary corresponds to.

Expand Down
10 changes: 8 additions & 2 deletions src/lpm.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1810,20 +1810,26 @@ function lpm.lite_xl_run(version, ...)
if is_argument_repo(str) then
table.insert(repositories, 1, Repository.url(str):add(AUTO_PULL_REMOTES))
system_bottle:invalidate_cache()
repositories[1].explicit = true
else
local id, version = common.split(":", str)
local potentials = { system_bottle:get_addon(id, version, { mod_version = lite_xl.mod_version }) }
local uniq = {}
local found_one = false
for i, addon in ipairs(potentials) do
if addon:is_core(system_bottle) then
uniq[addon.id] = true
uniq[addon.id] = addon
found_one = true
elseif not addon:is_orphan(system_bottle) and not uniq[addon.id] then
table.insert(addons, addon)
uniq[addon.id] = true
uniq[addon.id] = addon
found_one = true
end

if i > 1 and uniq[addon.id] and uniq[addon.id] ~= addon and addon.repository and addon.repository.explicit then
log.warning("your explicitly specified repository " .. addon.repository:url() .. " has a version of " .. addon.id .. " lower than that in " .. uniq[addon.id].repository:url() .. " (" .. addon.version .. " vs. " .. uniq[addon.id].version ..
"; in order to use the one in your specified repo, please specify " .. addon.id .. ":" .. addon.version)
end
end
if not found_one then error("can't find addon " .. str) end
end
Expand Down

0 comments on commit dd06ba2

Please sign in to comment.