@@ -12,6 +12,10 @@ local function printf(f, ...)
12
12
print (string.format (' [%s] ' .. f , cfg .name , ... ))
13
13
end
14
14
15
+ local function raisef (f , ...)
16
+ error (string.format (' [%s] ' .. f , cfg .name , ... ))
17
+ end
18
+
15
19
local function errorf (f , ...)
16
20
print (string.format (' [%s] ' .. f , cfg .name , ... ))
17
21
os.exit (1 )
@@ -39,7 +43,7 @@ local function ensure_rocksservers(path)
39
43
end
40
44
local data = f :read (f :stat ().size )
41
45
f :close ()
42
- if data :match (' rocks%.tarantool%.org' ) and data :match (' rocks%.moonscript%.org' ) then
46
+ if data :match (' rocks%.tarantool%.org' ) and ( data :match (' rocks%.moonscript%.org' ) or data : match ( ' luarocks%.org ' ) ) then
43
47
printf (' Already have proper rocks servers' )
44
48
return
45
49
end
@@ -54,7 +58,7 @@ local function ensure_rocksservers(path)
54
58
if not fh then
55
59
errorf (" Failed to open file %s: %s" , path , errno .strerror ())
56
60
end
57
- fh :write (' \n rocks_servers = {[[http://rocks.tarantool.org/ ]], [[https://rocks.moonscript .org]]}\n ' )
61
+ fh :write (' \n rocks_servers = {[[http://rocks.tarantool.org]], [[https://luarocks .org]]}\n ' )
58
62
fh :close ()
59
63
end
60
64
@@ -64,7 +68,7 @@ local function execute(cmd)
64
68
printf (" %s..." , raw_cmd )
65
69
local res = os.execute (' exec ' .. raw_cmd )
66
70
if res ~= 0 then
67
- errorf (' %s failed' , raw_cmd )
71
+ raisef (' %s failed' , raw_cmd )
68
72
end
69
73
return res
70
74
end
109
113
local function argparse (argparser , cmd )
110
114
cmd :option (' -m --meta-file' , ' path to meta.yaml file' )
111
115
:default (' ./meta.yaml' )
116
+ :convert (fio .abspath )
112
117
cmd :option (' -t --tree' , ' path to directory that will hold the dependencies' )
113
118
:default (' .rocks' )
114
119
:convert (fio .abspath )
@@ -125,10 +130,9 @@ local function run(args)
125
130
126
131
assert (args .meta_file ~= ' ' , ' meta file is required' )
127
132
128
- args .meta_file = fio .abspath (args .meta_file )
129
133
local meta_file = fio .open (args .meta_file )
130
134
if meta_file == nil then
131
- errorf (' Meta file %s does not exist ' , args .meta_file )
135
+ util . errorf (' Couldn \' t open %s: %s ' , args .meta_file , errno . strerror () )
132
136
end
133
137
local metatext = meta_file :read (meta_file :stat ().size )
134
138
local tree = fio .abspath (args .tree )
0 commit comments