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
commit619b85008bafdeb1e12a214a5f0161e035bfb84f (patch)
treebfa1504531f086ca567a2a4e1a88357cfa416cbe
parente1b0b8234fb97e98686e557ed90a8f01019927c3 (diff)
downloadluarocks-619b85008bafdeb1e12a214a5f0161e035bfb84f.tar.gz
luarocks-619b85008bafdeb1e12a214a5f0161e035bfb84f.tar.bz2
luarocks-619b85008bafdeb1e12a214a5f0161e035bfb84f.zip
Teal: convert luarocks.fetch.sscm
-rw-r--r--src/luarocks/fetch/sscm.tl (renamed from src/luarocks/fetch/sscm.lua)11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/luarocks/fetch/sscm.lua b/src/luarocks/fetch/sscm.tl
index 32bb2ecc..7c850a4b 100644
--- a/src/luarocks/fetch/sscm.lua
+++ b/src/luarocks/fetch/sscm.tl
@@ -1,10 +1,13 @@
1 1
2--- Fetch back-end for retrieving sources from Surround SCM Server 2--- Fetch back-end for retrieving sources from Surround SCM Server
3local sscm = {} 3local record sscm
4end
4 5
5local fs = require("luarocks.fs") 6local fs = require("luarocks.fs")
6local dir = require("luarocks.dir") 7local dir = require("luarocks.dir")
7 8
9local type Rockspec = require("luarocks.core.types.rockspec").Rockspec
10
8--- Download sources via Surround SCM Server for building a rock. 11--- Download sources via Surround SCM Server for building a rock.
9-- @param rockspec table: The rockspec table 12-- @param rockspec table: The rockspec table
10-- @param extract boolean: Unused in this module (required for API purposes.) 13-- @param extract boolean: Unused in this module (required for API purposes.)
@@ -12,9 +15,7 @@ local dir = require("luarocks.dir")
12-- @return (string, string) or (nil, string): The absolute pathname of 15-- @return (string, string) or (nil, string): The absolute pathname of
13-- the fetched source tarball and the temporary directory created to 16-- the fetched source tarball and the temporary directory created to
14-- store it; or nil and an error message. 17-- store it; or nil and an error message.
15function sscm.get_sources(rockspec, extract, dest_dir) 18function sscm.get_sources(rockspec: Rockspec, extract: boolean, dest_dir?: string): string, string
16 assert(rockspec:type() == "rockspec")
17 assert(type(dest_dir) == "string" or not dest_dir)
18 19
19 local sscm_cmd = rockspec.variables.SSCM 20 local sscm_cmd = rockspec.variables.SSCM
20 local module = rockspec.source.module or dir.base_name(rockspec.source.url) 21 local module = rockspec.source.module or dir.base_name(rockspec.source.url)
@@ -23,7 +24,7 @@ function sscm.get_sources(rockspec, extract, dest_dir)
23 return nil, "Error retrieving branch and repository from rockspec." 24 return nil, "Error retrieving branch and repository from rockspec."
24 end 25 end
25 -- Search for working directory. 26 -- Search for working directory.
26 local working_dir 27 local working_dir: string
27 local tmp = io.popen(string.format(sscm_cmd..[[ property "/" -d -b%s -p%s]], branch, repository)) 28 local tmp = io.popen(string.format(sscm_cmd..[[ property "/" -d -b%s -p%s]], branch, repository))
28 for line in tmp:lines() do 29 for line in tmp:lines() do
29 --%c because a chr(13) comes in the end. 30 --%c because a chr(13) comes in the end.