mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-18 03:36:47 -04:00
Yet another OPPM update
Hopefully this fixes dependency installation problems. I need some testers!
This commit is contained in:
parent
ea88404d90
commit
39c7ab5522
@ -111,13 +111,13 @@ local function readFromFile(fNum)
|
|||||||
return serial.unserialize(sPacks) or {-1}
|
return serial.unserialize(sPacks) or {-1}
|
||||||
end
|
end
|
||||||
|
|
||||||
local function saveToFile(tPacks)
|
local function saveToFile(packs)
|
||||||
local file,msg = io.open("/etc/opdata.svd","wb")
|
local file,msg = io.open("/etc/opdata.svd","wb")
|
||||||
if not file then
|
if not file then
|
||||||
io.stderr:write("Error while trying to save package names: "..msg)
|
io.stderr:write("Error while trying to save package names: "..msg)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local sPacks = serial.serialize(tPacks)
|
local sPacks = serial.serialize(packs)
|
||||||
file:write(sPacks)
|
file:write(sPacks)
|
||||||
file:close()
|
file:close()
|
||||||
end
|
end
|
||||||
@ -155,7 +155,7 @@ local function listPackages(filter)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
local lRepos = readFromFile(2)
|
local lRepos = readFromFile(2)
|
||||||
if lRepos then
|
if lRepos and lRepos.repos then
|
||||||
for _,j in pairs(lRepos.repos) do
|
for _,j in pairs(lRepos.repos) do
|
||||||
for k in pairs(j) do
|
for k in pairs(j) do
|
||||||
if not k.hidden then
|
if not k.hidden then
|
||||||
@ -166,8 +166,8 @@ local function listPackages(filter)
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
local lPacks = {}
|
local lPacks = {}
|
||||||
local tPacks = readFromFile(1)
|
local packs = readFromFile(1)
|
||||||
for i in pairs(tPacks) do
|
for i in pairs(packs) do
|
||||||
table.insert(lPacks,i)
|
table.insert(lPacks,i)
|
||||||
end
|
end
|
||||||
packages = lPacks
|
packages = lPacks
|
||||||
@ -185,8 +185,8 @@ local function listPackages(filter)
|
|||||||
return packages
|
return packages
|
||||||
end
|
end
|
||||||
|
|
||||||
local function printPackages(tPacks)
|
local function printPackages(packs)
|
||||||
if tPacks==nil or not tPacks[1] then
|
if packs==nil or not packs[1] then
|
||||||
print("No package matching specified filter found.")
|
print("No package matching specified filter found.")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -194,7 +194,7 @@ local function printPackages(tPacks)
|
|||||||
local xRes,yRes = gpu.getResolution()
|
local xRes,yRes = gpu.getResolution()
|
||||||
print("--OpenPrograms Package list--")
|
print("--OpenPrograms Package list--")
|
||||||
local xCur,yCur = term.getCursor()
|
local xCur,yCur = term.getCursor()
|
||||||
for _,j in ipairs(tPacks) do
|
for _,j in ipairs(packs) do
|
||||||
term.write(j.."\n")
|
term.write(j.."\n")
|
||||||
yCur = yCur+1
|
yCur = yCur+1
|
||||||
if yCur>yRes-1 then
|
if yCur>yRes-1 then
|
||||||
@ -276,6 +276,8 @@ local function provideInfo(pack)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local tPacks = readFromFile(1)
|
||||||
|
|
||||||
local function installPackage(pack,path,update)
|
local function installPackage(pack,path,update)
|
||||||
update = update or false
|
update = update or false
|
||||||
if not pack then
|
if not pack then
|
||||||
@ -292,7 +294,6 @@ local function installPackage(pack,path,update)
|
|||||||
end
|
end
|
||||||
pack = string.lower(pack)
|
pack = string.lower(pack)
|
||||||
|
|
||||||
local tPacks = readFromFile(1)
|
|
||||||
if not tPacks then
|
if not tPacks then
|
||||||
io.stderr:write("Error while trying to read local package names")
|
io.stderr:write("Error while trying to read local package names")
|
||||||
return
|
return
|
||||||
@ -309,6 +310,7 @@ local function installPackage(pack,path,update)
|
|||||||
print("Updating package "..pack)
|
print("Updating package "..pack)
|
||||||
path = nil
|
path = nil
|
||||||
for i,j in pairs(info.files) do
|
for i,j in pairs(info.files) do
|
||||||
|
if tPacks[pack] then
|
||||||
for k,v in pairs(tPacks[pack]) do
|
for k,v in pairs(tPacks[pack]) do
|
||||||
if k==i then
|
if k==i then
|
||||||
path = string.gsub(fs.path(v),j.."/?$","/")
|
path = string.gsub(fs.path(v),j.."/?$","/")
|
||||||
@ -318,6 +320,10 @@ local function installPackage(pack,path,update)
|
|||||||
if path then
|
if path then
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
io.stderr:write("error while checking update path")
|
||||||
|
return
|
||||||
|
end
|
||||||
end
|
end
|
||||||
path = shell.resolve(string.gsub(path,"^/?","/"),nil)
|
path = shell.resolve(string.gsub(path,"^/?","/"),nil)
|
||||||
end
|
end
|
||||||
@ -386,7 +392,7 @@ local function installPackage(pack,path,update)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
if info.dependencies then
|
if info.dependencies then
|
||||||
term.write("Done.\nInstalling Dependencies...")
|
term.write("Done.\nInstalling Dependencies...\n")
|
||||||
for i,j in pairs(info.dependencies) do
|
for i,j in pairs(info.dependencies) do
|
||||||
local nPath
|
local nPath
|
||||||
if string.find(j,"^//") then
|
if string.find(j,"^//") then
|
||||||
@ -413,7 +419,7 @@ local function installPackage(pack,path,update)
|
|||||||
if not depInfo then
|
if not depInfo then
|
||||||
term.write("\nDependency package "..i.." does not exist.")
|
term.write("\nDependency package "..i.." does not exist.")
|
||||||
end
|
end
|
||||||
installPackage(string.lower(i),fs.concat(path,j))
|
installPackage(string.lower(i),fs.concat(path,j),update)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -475,8 +481,8 @@ local function updatePackage(pack)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if args[1] == "list" then
|
if args[1] == "list" then
|
||||||
local tPacks = listPackages(args[2])
|
local packs = listPackages(args[2])
|
||||||
printPackages(tPacks)
|
printPackages(packs)
|
||||||
elseif args[1] == "info" then
|
elseif args[1] == "info" then
|
||||||
provideInfo(args[2])
|
provideInfo(args[2])
|
||||||
elseif args[1] == "install" then
|
elseif args[1] == "install" then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user