summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorubq323 <ubq323@ubq323.website>2022-08-04 00:07:15 +0100
committerubq323 <ubq323@ubq323.website>2022-08-04 00:07:15 +0100
commit7194fe6b9bb528ca141ea81fbed0933c01442174 (patch)
treee6c1d160dcb7831795c36a6770d967f073d7a733
parentad253b470f23380344ddcde45417b77026f7bc46 (diff)
pm
-rw-r--r--pm.lua14
1 files changed, 13 insertions, 1 deletions
diff --git a/pm.lua b/pm.lua
index 9139e42..2351ce0 100644
--- a/pm.lua
+++ b/pm.lua
@@ -7,6 +7,10 @@ local function perr(err,what)
end
local _manifests = {}
+local function clear_cache()
+ for k in pairs(_manifests) do _manifests[k] = nil end
+end
+
local function manifest(pkgname)
if _manifests[pkgname] then return _manifests[pkgname] end
print("fetching manifest of '"..pkgname.."'...")
@@ -52,7 +56,6 @@ local function recursive_depsof(pkgname)
local lookedat = {}
local deps = {}
local function F(pkgname)
- print("F",pkgname)
if not lookedat[pkgname] then
lookedat[pkgname] = true
for k,_ in pairs(manifest(pkgname).deps) do
@@ -65,6 +68,15 @@ local function recursive_depsof(pkgname)
return deps
end
+local function recursive_filesof(pkgname)
+ local deps = recursive_depsof(pkgname)
+ local files = {}
+ for dep in pairs(deps) do
+ for file in pairs(manifest(dep).files) do files[file] = true end
+ end
+ return files
+end
+
local function dlfile(filename)
local file,err=fs.open("/"..filename,"w")
if err then error("fs.open "..err) end