From 79066a41ec44e534ae0e794eddc489cfbd2ff134 Mon Sep 17 00:00:00 2001 From: Pavel Balaev Date: Tue, 31 Oct 2023 21:33:01 +0300 Subject: admin: remove now works with the file protocol (#1536) `admin add` can add rockspec using the file protocol without any problems: ./bin/luarocks-admin add testapp-scm-1.rockspec --server '/tmp/rocks/orig' But deletion only works using the rsync protocol. This patch adds deletion via file protocol. --- src/luarocks/admin/cmd/remove.lua | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/luarocks/admin/cmd/remove.lua b/src/luarocks/admin/cmd/remove.lua index 5d4c5fbb..ed7644e0 100644 --- a/src/luarocks/admin/cmd/remove.lua +++ b/src/luarocks/admin/cmd/remove.lua @@ -37,9 +37,6 @@ local function remove_files_from_server(refresh, rockfiles, server, upload_serve if not local_cache then return nil, protocol end - if protocol ~= "rsync" then - return nil, "This command requires 'rsync', check your configuration." - end local ok, err = fs.change_dir(at) if not ok then return nil, err end @@ -68,6 +65,17 @@ local function remove_files_from_server(refresh, rockfiles, server, upload_serve util.printout("Updating index.html...") index.make_index(local_cache) + if protocol == "file" then + local cmd = cfg.variables.RSYNC.." "..cfg.variables.RSYNCFLAGS.." --delete "..local_cache.."/ ".. server_path.."/" + util.printout(cmd) + fs.execute(cmd) + return true + end + + if protocol ~= "rsync" then + return nil, "This command requires 'rsync', check your configuration." + end + local srv, path = server_path:match("([^/]+)(/.+)") local cmd = cfg.variables.RSYNC.." "..cfg.variables.RSYNCFLAGS.." --delete -e ssh "..local_cache.."/ "..user.."@"..srv..":"..path.."/" -- cgit v1.2.3-55-g6feb