@@ -107,19 +107,19 @@ function install_pkg(pkg_dir, deploy_dir, variables, preserve_pkg_dir)
107
107
108
108
-- check for dist.info
109
109
local info , err = mf .load_distinfo (sys .make_path (pkg_dir , " dist.info" ))
110
- if not info then return nil , " Error installing: the directory '" .. pkg_dir .. " ' doesn't exist or doesn't contain valid 'dist.info' file." end
110
+ if not info then return nil , " Error installing: the directory '" .. pkg_dir .. " ' doesn't exist or doesn't contain valid 'dist.info' file." , 501 end
111
111
112
112
-- check if the package is source
113
113
if is_source_type (pkg_dir ) then info = ensure_source_arch_and_type (info ) end
114
114
115
115
-- check package's architecture
116
116
if not (info .arch == " Universal" or info .arch == cfg .arch ) then
117
- return nil , " Error installing '" .. info .name .. " -" .. info .version .. " ': architecture '" .. info .arch .. " ' is not suitable for this machine."
117
+ return nil , " Error installing '" .. info .name .. " -" .. info .version .. " ': architecture '" .. info .arch .. " ' is not suitable for this machine." , 502
118
118
end
119
119
120
120
-- check package's type
121
121
if not (info .type == " all" or info .type == " source" or info .type == cfg .type ) then
122
- return nil , " Error installing '" .. info .name .. " -" .. info .version .. " ': architecture type '" .. info .type .. " ' is not suitable for this machine."
122
+ return nil , " Error installing '" .. info .name .. " -" .. info .version .. " ': architecture type '" .. info .type .. " ' is not suitable for this machine." , 502
123
123
end
124
124
125
125
local ok , err
@@ -133,7 +133,7 @@ function install_pkg(pkg_dir, deploy_dir, variables, preserve_pkg_dir)
133
133
134
134
-- check if we have cmake
135
135
ok = utils .system_dependency_available (" cmake" , " cmake --version" )
136
- if not ok then return nil , " Error when installing: Command 'cmake' not available on the system." end
136
+ if not ok then return nil , " Error when installing: Command 'cmake' not available on the system." , 503 end
137
137
138
138
-- set cmake variables
139
139
local cmake_variables = {}
@@ -153,15 +153,15 @@ function install_pkg(pkg_dir, deploy_dir, variables, preserve_pkg_dir)
153
153
cmake_variables .CMAKE_PROGRAM_PATH = table.concat ({cmake_variables .CMAKE_PROGRAM_PATH or " " , sys .make_path (deploy_dir , " bin" )}, " ;" )
154
154
155
155
-- build the package and deploy it
156
- ok , err = build_pkg (pkg_dir , deploy_dir , cmake_variables )
157
- if not ok then return nil , err end
156
+ ok , err , status = build_pkg (pkg_dir , deploy_dir , cmake_variables )
157
+ if not ok then return nil , err , status end
158
158
159
159
end
160
160
161
161
-- delete directory of fetched package
162
162
if not (cfg .debug or preserve_pkg_dir ) then sys .delete (pkg_dir ) end
163
163
164
- return ok , err
164
+ return ok , err , status
165
165
end
166
166
167
167
-- Build and deploy package from 'src_dir' to 'deploy_dir' using 'variables'.
@@ -180,7 +180,7 @@ function build_pkg(src_dir, deploy_dir, variables)
180
180
181
181
-- check for dist.info
182
182
local info , err = mf .load_distinfo (sys .make_path (src_dir , " dist.info" ))
183
- if not info then return nil , " Error building package from '" .. src_dir .. " ': it doesn't contain valid 'dist.info' file." end
183
+ if not info then return nil , " Error building package from '" .. src_dir .. " ': it doesn't contain valid 'dist.info' file." , 501 end
184
184
local pkg_name = info .name .. " -" .. info .version
185
185
186
186
-- set machine information
@@ -194,7 +194,7 @@ function build_pkg(src_dir, deploy_dir, variables)
194
194
-- create cmake cache
195
195
variables [" CMAKE_INSTALL_PREFIX" ] = deploy_dir
196
196
local cache_file = io.open (sys .make_path (cmake_build_dir , " cache.cmake" ), " w" )
197
- if not cache_file then return nil , " Error creating CMake cache file in '" .. cmake_build_dir .. " '" end
197
+ if not cache_file then return nil , " Error creating CMake cache file in '" .. cmake_build_dir .. " '" , 401 end
198
198
199
199
-- Fill in cache variables
200
200
for k ,v in pairs (variables ) do
@@ -224,11 +224,11 @@ function build_pkg(src_dir, deploy_dir, variables)
224
224
225
225
-- set the cmake cache
226
226
local ok = sys .exec (" cd " .. sys .quote (cmake_build_dir ) .. " && " .. cache_command .. " " .. sys .quote (src_dir ))
227
- if not ok then return nil , " Error preloading the CMake cache script '" .. sys .make_path (cmake_build_dir , " cmake.cache" ) .. " '" end
227
+ if not ok then return nil , " Error preloading the CMake cache script '" .. sys .make_path (cmake_build_dir , " cmake.cache" ) .. " '" , 402 end
228
228
229
229
-- build with cmake
230
230
ok = sys .exec (" cd " .. sys .quote (cmake_build_dir ) .. " && " .. build_command )
231
- if not ok then return nil , " Error building with CMake in directory '" .. cmake_build_dir .. " '" end
231
+ if not ok then return nil , " Error building with CMake in directory '" .. cmake_build_dir .. " '" , 403 end
232
232
233
233
-- if this is only simulation, exit sucessfully, skipping the next actions
234
234
if cfg .simulate then
@@ -245,7 +245,7 @@ function build_pkg(src_dir, deploy_dir, variables)
245
245
246
246
local ok = sys .exec (" cd " .. sys .quote (cmake_build_dir ) .. " && " .. cfg .cmake .. " " .. strip_option .. " " .. cfg .install_component_command :gsub (" #COMPONENT#" , component ))
247
247
248
- if not ok then return nil , " Error when installing the component '" .. component .. " ' with CMake in directory '" .. cmake_build_dir .. " '" end
248
+ if not ok then return nil , " Error when installing the component '" .. component .. " ' with CMake in directory '" .. cmake_build_dir .. " '" , 301 end
249
249
250
250
local install_mf = sys .make_path (cmake_build_dir , " install_manifest_" .. component .. " .txt" )
251
251
local mf , err
@@ -254,7 +254,7 @@ function build_pkg(src_dir, deploy_dir, variables)
254
254
-- collect files installed in this component
255
255
if sys .exists (install_mf ) then
256
256
mf , err = io.open (install_mf , " r" )
257
- if not mf then return nil , " Error when opening the CMake installation manifest '" .. install_mf .. " ': " .. err end
257
+ if not mf then return nil , " Error when opening the CMake installation manifest '" .. install_mf .. " ': " .. err , 302 end
258
258
for line in mf :lines () do
259
259
line = sys .check_separators (line )
260
260
local file = line :gsub (utils .escape_magic (deploy_dir .. sys .path_separator ()), " " )
@@ -272,7 +272,7 @@ function build_pkg(src_dir, deploy_dir, variables)
272
272
if cfg .test then
273
273
print (" Testing " .. sys .extract_name (src_dir ) .. " ..." )
274
274
ok = sys .exec (" cd " .. sys .quote (deploy_dir ) .. " && " .. cfg .test_command )
275
- if not ok then return nil , " Error when testing the module '" .. pkg_name .. " ' with CTest." end
275
+ if not ok then return nil , " Error when testing the module '" .. pkg_name .. " ' with CTest." , 201 end
276
276
end
277
277
278
278
-- Rewrite dependencies for binary package
0 commit comments