diff options
| author | Pavel Balaev <mail@void.so> | 2023-10-31 21:33:01 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-10-31 15:33:01 -0300 |
| commit | 79066a41ec44e534ae0e794eddc489cfbd2ff134 (patch) | |
| tree | e4185c08d2313be7710438a78ad99c0ff81a6df0 /src | |
| parent | b8a2710a2cefbddc5e6b494db186014b341412e4 (diff) | |
| download | luarocks-79066a41ec44e534ae0e794eddc489cfbd2ff134.tar.gz luarocks-79066a41ec44e534ae0e794eddc489cfbd2ff134.tar.bz2 luarocks-79066a41ec44e534ae0e794eddc489cfbd2ff134.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/luarocks/admin/cmd/remove.lua | 14 |
1 files changed, 11 insertions, 3 deletions
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 | |||
| 37 | if not local_cache then | 37 | if not local_cache then |
| 38 | return nil, protocol | 38 | return nil, protocol |
| 39 | end | 39 | end |
| 40 | if protocol ~= "rsync" then | ||
| 41 | return nil, "This command requires 'rsync', check your configuration." | ||
| 42 | end | ||
| 43 | 40 | ||
| 44 | local ok, err = fs.change_dir(at) | 41 | local ok, err = fs.change_dir(at) |
| 45 | if not ok then return nil, err end | 42 | if not ok then return nil, err end |
| @@ -68,6 +65,17 @@ local function remove_files_from_server(refresh, rockfiles, server, upload_serve | |||
| 68 | util.printout("Updating index.html...") | 65 | util.printout("Updating index.html...") |
| 69 | index.make_index(local_cache) | 66 | index.make_index(local_cache) |
| 70 | 67 | ||
| 68 | if protocol == "file" then | ||
| 69 | local cmd = cfg.variables.RSYNC.." "..cfg.variables.RSYNCFLAGS.." --delete "..local_cache.."/ ".. server_path.."/" | ||
| 70 | util.printout(cmd) | ||
| 71 | fs.execute(cmd) | ||
| 72 | return true | ||
| 73 | end | ||
| 74 | |||
| 75 | if protocol ~= "rsync" then | ||
| 76 | return nil, "This command requires 'rsync', check your configuration." | ||
| 77 | end | ||
| 78 | |||
| 71 | local srv, path = server_path:match("([^/]+)(/.+)") | 79 | local srv, path = server_path:match("([^/]+)(/.+)") |
| 72 | local cmd = cfg.variables.RSYNC.." "..cfg.variables.RSYNCFLAGS.." --delete -e ssh "..local_cache.."/ "..user.."@"..srv..":"..path.."/" | 80 | local cmd = cfg.variables.RSYNC.." "..cfg.variables.RSYNCFLAGS.." --delete -e ssh "..local_cache.."/ "..user.."@"..srv..":"..path.."/" |
| 73 | 81 | ||
