diff options
-rw-r--r-- | src/luarocks/fetch/cvs.tl (renamed from src/luarocks/fetch/cvs.lua) | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/luarocks/fetch/cvs.lua b/src/luarocks/fetch/cvs.tl index d78e6e60..c8fc5e3d 100644 --- a/src/luarocks/fetch/cvs.lua +++ b/src/luarocks/fetch/cvs.tl | |||
@@ -1,13 +1,14 @@ | |||
1 | 1 | ||
2 | --- Fetch back-end for retrieving sources from CVS. | 2 | --- Fetch back-end for retrieving sources from CVS. |
3 | local cvs = {} | 3 | local record cvs |
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 CVS. | 12 | --- Download sources for building a rock, using CVS. |
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,10 +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 cvs.get_sources(rockspec, extract, dest_dir) | 19 | function cvs.get_sources(rockspec: Rockspec, extract: boolean, dest_dir?: string): string, string --? extract not needed |
19 | assert(rockspec:type() == "rockspec") | ||
20 | assert(type(dest_dir) == "string" or not dest_dir) | ||
21 | |||
22 | local cvs_cmd = rockspec.variables.CVS | 20 | local cvs_cmd = rockspec.variables.CVS |
23 | local ok, err_msg = fs.is_tool_available(cvs_cmd, "CVS") | 21 | local ok, err_msg = fs.is_tool_available(cvs_cmd, "CVS") |
24 | if not ok then | 22 | if not ok then |
@@ -32,7 +30,7 @@ function cvs.get_sources(rockspec, extract, dest_dir) | |||
32 | table.insert(command, 4, "-r") | 30 | table.insert(command, 4, "-r") |
33 | table.insert(command, 5, rockspec.source.tag) | 31 | table.insert(command, 5, rockspec.source.tag) |
34 | end | 32 | end |
35 | local store_dir | 33 | local store_dir: string |
36 | if not dest_dir then | 34 | if not dest_dir then |
37 | store_dir = fs.make_temp_dir(name_version) | 35 | store_dir = fs.make_temp_dir(name_version) |
38 | if not store_dir then | 36 | if not store_dir then |
@@ -42,9 +40,9 @@ function cvs.get_sources(rockspec, extract, dest_dir) | |||
42 | else | 40 | else |
43 | store_dir = dest_dir | 41 | store_dir = dest_dir |
44 | end | 42 | end |
45 | local ok, err = fs.change_dir(store_dir) | 43 | local okchange, err = fs.change_dir(store_dir) |
46 | if not ok then return nil, err end | 44 | if not okchange then return nil, err end |
47 | if not fs.execute(unpack(command)) then | 45 | if not fs.execute(table.unpack(command)) then |
48 | return nil, "Failed fetching files from CVS." | 46 | return nil, "Failed fetching files from CVS." |
49 | end | 47 | end |
50 | fs.pop_dir() | 48 | fs.pop_dir() |