aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorV1K1NGbg <victor@ilchev.com>2024-08-22 17:49:05 -0300
committerHisham Muhammad <hisham@gobolinux.org>2024-10-21 13:30:51 -0300
commitfe692ffc7971337e3fcafba6b679a1e8ea16264d (patch)
tree5ea4cdda91ccdc338e077f613c041d6bd7a35191
parentd9e3df1be0776eb82525ec76c0b450d1621ed2dc (diff)
downloadluarocks-fe692ffc7971337e3fcafba6b679a1e8ea16264d.tar.gz
luarocks-fe692ffc7971337e3fcafba6b679a1e8ea16264d.tar.bz2
luarocks-fe692ffc7971337e3fcafba6b679a1e8ea16264d.zip
Teal: convert luarocks.fetch.cvs
-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.
3local cvs = {} 3local record cvs
4 4end
5local unpack = unpack or table.unpack
6 5
7local fs = require("luarocks.fs") 6local fs = require("luarocks.fs")
8local dir = require("luarocks.dir") 7local dir = require("luarocks.dir")
9local util = require("luarocks.util") 8local util = require("luarocks.util")
10 9
10local 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.
18function cvs.get_sources(rockspec, extract, dest_dir) 19function 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()