1
0
mirror of https://github.com/AR2000AR/openComputers_codes.git synced 2025-09-08 14:41:14 +02:00

[pm] bugfixes

This commit is contained in:
2023-04-07 18:40:02 +02:00
parent 3c05a36315
commit b1b53d6ab3
4 changed files with 19 additions and 17 deletions

View File

@@ -145,10 +145,10 @@ elseif (mode == "install") then
if (manifest.version == "oppm" or currentManifest.version == "oppm") then
--do nothing. We force reinstallation for oppm since there is no version number
elseif (manifest.version == currentManifest.version and not opts["allow-same-version"]) then
print("Already installed")
printf("Package %q is already installed", manifest.package)
os.exit(0)
elseif (compareVersion(currentManifest.version, manifest.version)) then --downgrade
print("Cannot downgrade package")
elseif (compareVersion(currentManifest.version, manifest.version) and not opts["allow-same-version"]) then --downgrade
printf("Cannot downgrade package %q", manifest.package)
os.exit(1)
end
end

View File

@@ -88,10 +88,11 @@ def makePackage(packageInfo, source=None, outputDirectory='./packages/'):
file.write(lua.encode(manifest))
version = manifest["version"]
with tarfile.open(pathlib.Path(outputDirectory, f"{packageName}_({version}).tar"), 'w') as tar:
# manifest["archiveName"] = f"{packageName}_({version}).tar"
manifest["archiveName"] = f"{packageName}.tar"
with tarfile.open(pathlib.Path(outputDirectory, manifest["archiveName"]), 'w') as tar:
tar.add(tmpDir+"/CONTROL", arcname="CONTROL")
tar.add(tmpDir+'/DATA/', arcname="DATA")
manifest["archiveName"] = f"{packageName}_({version}).tar"
return manifest

View File

@@ -114,12 +114,12 @@ end
---@return string? data, string? reason
local function wget(url)
local request = internet.request(url)
local pcalled, ready
local ready, reason
repeat
pcalled, ready = pcall(request.finishConnect, request)
until pcalled == false or ready == true
if (pcalled == false) then
return nil, "Could not connect to " .. url
ready, reason = request.finishConnect()
until ready or reason
if (not ready) then
return nil, reason
end
local data = ""
repeat
@@ -225,12 +225,12 @@ local function update()
for _, repoURL in pairs(repos) do
printf("Found repository : %s", repoURL)
local request = internet.request(repoURL .. "/manifest")
local ready, pcalled = false, nil
local ready, reason
repeat
pcalled, ready = pcall(request.finishConnect, request)
until pcalled == false or ready == true
if (not pcalled) then
printferr("Could not get manifest from %s", repoURL)
ready, reason = request.finishConnect()
until ready or reason
if (not ready) then
printferr("Could not get manifest from %s\ns", repoURL, reason)
end
local data = ""
repeat
@@ -238,6 +238,7 @@ local function update()
if (read) then data = data .. read end
until not read
request.close()
local pcalled
pcalled, data = pcall(serialization.unserialize, data)
if (pcalled == false) then
printferr("Invalid manifest for %s", repoURL)

View File

@@ -303,7 +303,7 @@
dependencies = {
["libtar"] = "/"
},
version = "1.2.1",
version = "1.2.2",
name = "pm Package Manager",
description = "Package manager for OpenOS",
authors = "AR2000AR",
@@ -317,7 +317,7 @@
dependencies = {
["pm"] = "/"
},
version = "1.1.0"
version = "1.1.1"
name = "pm get",
description = "Download and install package for pm",
authors = "AR2000AR",