|
@ -22,6 +22,11 @@ defaultRepoLocationConfig = "{URL_BASE}/repos.cfg" |
|
|
localInstalledPackagesFile = "/etc/spdata.svd" |
|
|
localInstalledPackagesFile = "/etc/spdata.svd" |
|
|
localConfigFile = "/etc/spm.cfg" |
|
|
localConfigFile = "/etc/spm.cfg" |
|
|
|
|
|
|
|
|
|
|
|
class Repository |
|
|
|
|
|
new: (name, src) => |
|
|
|
|
|
@name = name |
|
|
|
|
|
@src = src |
|
|
|
|
|
|
|
|
args, options = shell.parse(...) |
|
|
args, options = shell.parse(...) |
|
|
|
|
|
|
|
|
printUsage = -> |
|
|
printUsage = -> |
|
@ -59,7 +64,16 @@ getRepositories = -> |
|
|
io.stderr\write("Could not connect to the Internet. Please ensure you have an Internet connection.") |
|
|
io.stderr\write("Could not connect to the Internet. Please ensure you have an Internet connection.") |
|
|
return -1 |
|
|
return -1 |
|
|
|
|
|
|
|
|
return serial.unserialize(raw_repositories) |
|
|
|
|
|
|
|
|
deserialized_repositories = serial.unserialize(raw_repositories) |
|
|
|
|
|
|
|
|
|
|
|
repositories = {} |
|
|
|
|
|
for repositoryName, repository in pairs(deserialized_repositories) |
|
|
|
|
|
src = repository or nil |
|
|
|
|
|
if src == nil |
|
|
|
|
|
src = githubContentRoot .. repository.repo .."/master" |
|
|
|
|
|
repositories[repositoryName] = Repository(repositoryName, src) |
|
|
|
|
|
|
|
|
|
|
|
repositories |
|
|
|
|
|
|
|
|
-- Get Packages for src |
|
|
-- Get Packages for src |
|
|
getPackages = (src) -> |
|
|
getPackages = (src) -> |
|
@ -70,9 +84,6 @@ getPackages = (src) -> |
|
|
|
|
|
|
|
|
return serial.unserialize(packages) |
|
|
return serial.unserialize(packages) |
|
|
|
|
|
|
|
|
getGithubPackages = (repo) -> |
|
|
|
|
|
return getPackages(githubContentRoot .. repo .. "/master") |
|
|
|
|
|
|
|
|
|
|
|
--For sorting table values by alphabet |
|
|
--For sorting table values by alphabet |
|
|
compare = (a, b) -> |
|
|
compare = (a, b) -> |
|
|
for i = 1, math.min(#a, #b) |
|
|
for i = 1, math.min(#a, #b) |
|
@ -153,20 +164,12 @@ listPackages = (filter) -> |
|
|
return |
|
|
return |
|
|
|
|
|
|
|
|
for _, repository in pairs(repositories) |
|
|
for _, repository in pairs(repositories) |
|
|
packages = -1 |
|
|
|
|
|
target = -1 |
|
|
|
|
|
|
|
|
|
|
|
if repository.src |
|
|
|
|
|
print("Checking Repository " .. repository.src) |
|
|
print("Checking Repository " .. repository.src) |
|
|
packages = getPackages(repository.src) |
|
|
packages = getPackages(repository.src) |
|
|
target = repository.src |
|
|
|
|
|
elseif repository.repo |
|
|
|
|
|
print("Checking Repository " .. repository.repo) |
|
|
|
|
|
packages = getGithubPackages(repository.repo) |
|
|
|
|
|
target = repository.repo |
|
|
|
|
|
|
|
|
|
|
|
if packages == nil |
|
|
if packages == nil |
|
|
io.stderr\write("Error while trying to receive package list for " .. target .. "\n") |
|
|
|
|
|
|
|
|
io.stderr\write("Error while trying to receive package list for " .. repository.src .. "\n") |
|
|
return |
|
|
return |
|
|
elseif type(packages) == "table" |
|
|
elseif type(packages) == "table" |
|
|
for package in pairs(packages) |
|
|
for package in pairs(packages) |
|
@ -220,18 +223,10 @@ getInformation = (requestedPackage) -> |
|
|
return |
|
|
return |
|
|
|
|
|
|
|
|
for _, repository in pairs(repositories) |
|
|
for _, repository in pairs(repositories) |
|
|
packages = -1 |
|
|
|
|
|
target = -1 |
|
|
|
|
|
|
|
|
|
|
|
if repository.src |
|
|
|
|
|
packages = getPackages(repository.src) |
|
|
packages = getPackages(repository.src) |
|
|
target = repository.src |
|
|
|
|
|
elseif repository.repo |
|
|
|
|
|
packages = getGithubPackages(repository.repo) |
|
|
|
|
|
target = githubContentRoot .. repository.repo |
|
|
|
|
|
|
|
|
|
|
|
if packages == nil |
|
|
if packages == nil |
|
|
io.stderr\write("Error while trying to receive package list for " .. target .. "\n") |
|
|
|
|
|
|
|
|
io.stderr\write("Error while trying to receive package list for " .. repository.src .. "\n") |
|
|
elseif type(packages) == "table" |
|
|
elseif type(packages) == "table" |
|
|
for package in pairs(packages) |
|
|
for package in pairs(packages) |
|
|
if package == requestedPackage |
|
|
if package == requestedPackage |
|
|