From bbb9a0d5603303f400813346f25c2729ae88f2b3 Mon Sep 17 00:00:00 2001 From: Drew Short Date: Thu, 18 Jan 2018 16:57:18 -0600 Subject: [PATCH] Attempting to add cascadingrepository lookup --- src/bootstrap.moon | 5 +++++ src/repos.cfg | 3 +++ src/spm/spm.cfg | 7 +++++++ src/spm/spm.moon | 15 +++++++++++---- 4 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 src/spm/spm.cfg diff --git a/src/bootstrap.moon b/src/bootstrap.moon index b0f65c9..aeb8e14 100644 --- a/src/bootstrap.moon +++ b/src/bootstrap.moon @@ -13,8 +13,13 @@ if not component.isAvailable("internet") downloadSrc = "{URL_BASE}/spm/spm.min.lua" saveLocation = "/tmp/spm.lua" +downloadCfgSrc = "{URL_BASE}/spm/spm.cfg" +saveCfgLocation = "/etc/spm.cfg" + print("Downloading Temporary SPM") wget("-qf", downloadSrc, saveLocation) +if not fs.exists(saveCfgLocation) + wget("-qf", downloadCfgSrc, saveCfgLocation) spm = loadfile(saveLocation) diff --git a/src/repos.cfg b/src/repos.cfg index 053b276..b891ea6 100644 --- a/src/repos.cfg +++ b/src/repos.cfg @@ -5,4 +5,7 @@ ["Warrick's Software"] = { src = "{URL_BASE}/warricksothr" } + ["OPPM Repositories"] = { + link = "https://raw.githubusercontent.com/OpenPrograms/openprograms.github.io/master/repos.cfg" + } } \ No newline at end of file diff --git a/src/spm/spm.cfg b/src/spm/spm.cfg new file mode 100644 index 0000000..bdc3917 --- /dev/null +++ b/src/spm/spm.cfg @@ -0,0 +1,7 @@ +{ + --default installation path + path="/usr", + --Additional repositories and packages go here, for correct package syntax, check https://github.com/OpenPrograms/Vexatos-Programs/blob/master/oppm/etc/example-config.cfg + repos={ + } +} \ No newline at end of file diff --git a/src/spm/spm.moon b/src/spm/spm.moon index 19f3416..dd3c64e 100644 --- a/src/spm/spm.moon +++ b/src/spm/spm.moon @@ -57,8 +57,8 @@ getContent = (url) -> return content -- Request repository information -getRepositories = -> - success, raw_repositories = pcall(getContent, defaultRepoLocationConfig) +getRepositories = (repoLocation) -> + success, raw_repositories = pcall(getContent, repoLocation) if not success io.stderr\write("Could not connect to the Internet. Please ensure you have an Internet connection.") @@ -68,6 +68,13 @@ getRepositories = -> repositories = {} for repositoryName, repository in pairs(deserialized_repositories) + + if repository.link != nil + linked_repositories = getRepositories(repository.link) + for linkedRepositoryName, linkedRepository in pairs(linked_repositories) + repositories[linkedRepositoryName] = linkedRepository + continue + src = repository.src or nil if src == nil src = githubContentRoot .. repository.repo .."/master" @@ -154,7 +161,7 @@ listPackages = (filter) -> packageTable = {} print("Receiving Package list...") if not options.i - success, repositories = pcall(getRepositories) + success, repositories = pcall(getRepositories, defaultRepoLocationConfig) if not success or repositories == -1 io.stderr\write("Unable to connect to the Internet.\n") @@ -216,7 +223,7 @@ printPackages = (packages) -> -- Retrieve package information getInformation = (requestedPackage) -> - success, repositories = pcall(getRepositories) + success, repositories = pcall(getRepositories, defaultRepoLocationConfig) if not success or repositories == -1 io.stderr\write("Unable to connect to the Internet.\n")