aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorluau-project <luau.project@gmail.com>2025-06-24 11:42:16 -0300
committerHisham Muhammad <hisham@gobolinux.org>2025-06-25 04:55:54 +0000
commitbdb3572ac8d0b75f7bce5512cad8f03823d2ace8 (patch)
tree9e29985ee6d368cefdb3a7a442770b19e95288c5 /src
parent7d82773f963d9c332533a47f10729f71d0031559 (diff)
downloadluarocks-bdb3572ac8d0b75f7bce5512cad8f03823d2ace8.tar.gz
luarocks-bdb3572ac8d0b75f7bce5512cad8f03823d2ace8.tar.bz2
luarocks-bdb3572ac8d0b75f7bce5512cad8f03823d2ace8.zip
fix: create cache_dir when local_cache exists
Diffstat (limited to 'src')
-rw-r--r--src/luarocks/fetch.lua5
-rw-r--r--src/luarocks/fetch.tl9
2 files changed, 11 insertions, 3 deletions
diff --git a/src/luarocks/fetch.lua b/src/luarocks/fetch.lua
index bcee6f23..50363cc0 100644
--- a/src/luarocks/fetch.lua
+++ b/src/luarocks/fetch.lua
@@ -49,7 +49,10 @@ function fetch.fetch_caching(url, mirroring)
49 local repo_url, filename = url:match("^(.*)/([^/]+)$") 49 local repo_url, filename = url:match("^(.*)/([^/]+)$")
50 local name = repo_url:gsub("[/:]", "_") 50 local name = repo_url:gsub("[/:]", "_")
51 local cache_dir = dir.path(cfg.local_cache, name) 51 local cache_dir = dir.path(cfg.local_cache, name)
52 local ok = fs.make_dir(cache_dir) 52 local ok = fs.exists(cfg.local_cache)
53 if ok then
54 ok = fs.make_dir(cache_dir)
55 end
53 56
54 local cachefile = dir.path(cache_dir, filename) 57 local cachefile = dir.path(cache_dir, filename)
55 local checkfile = cachefile .. ".check" 58 local checkfile = cachefile .. ".check"
diff --git a/src/luarocks/fetch.tl b/src/luarocks/fetch.tl
index 2f81ac0c..75f0a157 100644
--- a/src/luarocks/fetch.tl
+++ b/src/luarocks/fetch.tl
@@ -49,12 +49,15 @@ function fetch.fetch_caching(url: string, mirroring?: string): string, string, s
49 local repo_url, filename = url:match("^(.*)/([^/]+)$") 49 local repo_url, filename = url:match("^(.*)/([^/]+)$")
50 local name = repo_url:gsub("[/:]","_") 50 local name = repo_url:gsub("[/:]","_")
51 local cache_dir = dir.path(cfg.local_cache, name) 51 local cache_dir = dir.path(cfg.local_cache, name)
52 local ok = fs.make_dir(cache_dir) 52 local ok = fs.exists(cfg.local_cache)
53 if ok then
54 ok = fs.make_dir(cache_dir)
55 end
53 56
54 local cachefile = dir.path(cache_dir, filename) 57 local cachefile = dir.path(cache_dir, filename)
55 local checkfile = cachefile .. ".check" 58 local checkfile = cachefile .. ".check"
56 59
57 if (fs.file_age(checkfile) < 10 or 60 if (fs.exists(checkfile) and fs.file_age(checkfile) < 10 or
58 cfg.aggressive_cache and (not name:match("^manifest"))) and fs.exists(cachefile) 61 cfg.aggressive_cache and (not name:match("^manifest"))) and fs.exists(cachefile)
59 then 62 then
60 return cachefile, nil, nil, true 63 return cachefile, nil, nil, true
@@ -75,6 +78,8 @@ function fetch.fetch_caching(url: string, mirroring?: string): string, string, s
75 if not ok then 78 if not ok then
76 return nil, "Failed creating temporary cache directory "..cache_dir 79 return nil, "Failed creating temporary cache directory "..cache_dir
77 end 80 end
81 cachefile = dir.path(cache_dir, filename)
82 checkfile = cachefile .. ".check"
78 lock = fs.lock_access(cache_dir) 83 lock = fs.lock_access(cache_dir)
79 end 84 end
80 85