diff options
author | V1K1NGbg <victor@ilchev.com> | 2024-08-22 17:49:05 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2024-10-21 13:30:51 -0300 |
commit | 131a6993c9759c8873c5e5bee40aa9a666c5506c (patch) | |
tree | 1841f396a6aaa3c1a30a370da7ca011fab8d01ba | |
parent | f86d6ad4897182543803d36e3b914a115f9925a4 (diff) | |
download | luarocks-131a6993c9759c8873c5e5bee40aa9a666c5506c.tar.gz luarocks-131a6993c9759c8873c5e5bee40aa9a666c5506c.tar.bz2 luarocks-131a6993c9759c8873c5e5bee40aa9a666c5506c.zip |
Teal: convert luarocks.fetch.svn
-rw-r--r-- | src/luarocks/fetch/svn.tl (renamed from src/luarocks/fetch/svn.lua) | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/luarocks/fetch/svn.lua b/src/luarocks/fetch/svn.tl index b6618afc..4d738d74 100644 --- a/src/luarocks/fetch/svn.lua +++ b/src/luarocks/fetch/svn.tl | |||
@@ -1,13 +1,14 @@ | |||
1 | 1 | ||
2 | --- Fetch back-end for retrieving sources from Subversion. | 2 | --- Fetch back-end for retrieving sources from Subversion. |
3 | local svn = {} | 3 | local record svn |
4 | 4 | end | |
5 | local unpack = unpack or table.unpack | ||
6 | 5 | ||
7 | local fs = require("luarocks.fs") | 6 | local fs = require("luarocks.fs") |
8 | local dir = require("luarocks.dir") | 7 | local dir = require("luarocks.dir") |
9 | local util = require("luarocks.util") | 8 | local util = require("luarocks.util") |
10 | 9 | ||
10 | local type Rockspec = require("luarocks.core.types.rockspec").Rockspec | ||
11 | |||
11 | --- Download sources for building a rock, using Subversion. | 12 | --- Download sources for building a rock, using Subversion. |
12 | -- @param rockspec table: The rockspec table | 13 | -- @param rockspec table: The rockspec table |
13 | -- @param extract boolean: Unused in this module (required for API purposes.) | 14 | -- @param extract boolean: Unused in this module (required for API purposes.) |
@@ -15,9 +16,7 @@ local util = require("luarocks.util") | |||
15 | -- @return (string, string) or (nil, string): The absolute pathname of | 16 | -- @return (string, string) or (nil, string): The absolute pathname of |
16 | -- the fetched source tarball and the temporary directory created to | 17 | -- the fetched source tarball and the temporary directory created to |
17 | -- store it; or nil and an error message. | 18 | -- store it; or nil and an error message. |
18 | function svn.get_sources(rockspec, extract, dest_dir) | 19 | function svn.get_sources(rockspec: Rockspec, extract: boolean, dest_dir?: string): string, string |
19 | assert(rockspec:type() == "rockspec") | ||
20 | assert(type(dest_dir) == "string" or not dest_dir) | ||
21 | 20 | ||
22 | local svn_cmd = rockspec.variables.SVN | 21 | local svn_cmd = rockspec.variables.SVN |
23 | local ok, err_msg = fs.is_tool_available(svn_cmd, "Subversion") | 22 | local ok, err_msg = fs.is_tool_available(svn_cmd, "Subversion") |
@@ -33,7 +32,7 @@ function svn.get_sources(rockspec, extract, dest_dir) | |||
33 | table.insert(command, 5, "-r") | 32 | table.insert(command, 5, "-r") |
34 | table.insert(command, 6, rockspec.source.tag) | 33 | table.insert(command, 6, rockspec.source.tag) |
35 | end | 34 | end |
36 | local store_dir | 35 | local store_dir: string |
37 | if not dest_dir then | 36 | if not dest_dir then |
38 | store_dir = fs.make_temp_dir(name_version) | 37 | store_dir = fs.make_temp_dir(name_version) |
39 | if not store_dir then | 38 | if not store_dir then |
@@ -43,13 +42,13 @@ function svn.get_sources(rockspec, extract, dest_dir) | |||
43 | else | 42 | else |
44 | store_dir = dest_dir | 43 | store_dir = dest_dir |
45 | end | 44 | end |
46 | local ok, err = fs.change_dir(store_dir) | 45 | local okchange, err = fs.change_dir(store_dir) |
47 | if not ok then return nil, err end | 46 | if not okchange then return nil, err end |
48 | if not fs.execute(unpack(command)) then | 47 | if not fs.execute(table.unpack(command)) then |
49 | return nil, "Failed fetching files from Subversion." | 48 | return nil, "Failed fetching files from Subversion." |
50 | end | 49 | end |
51 | ok, err = fs.change_dir(module) | 50 | okchange, err = fs.change_dir(module) |
52 | if not ok then return nil, err end | 51 | if not okchange then return nil, err end |
53 | for _, d in ipairs(fs.find(".")) do | 52 | for _, d in ipairs(fs.find(".")) do |
54 | if dir.base_name(d) == ".svn" then | 53 | if dir.base_name(d) == ".svn" then |
55 | fs.delete(dir.path(store_dir, module, d)) | 54 | fs.delete(dir.path(store_dir, module, d)) |