From 7194fe6b9bb528ca141ea81fbed0933c01442174 Mon Sep 17 00:00:00 2001 From: ubq323 Date: Thu, 4 Aug 2022 00:07:15 +0100 Subject: pm --- pm.lua | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3