From 8d030a06ed62aef4cf0b4648b54b712069a0d3ad Mon Sep 17 00:00:00 2001 From: Ignacio BurgueƱo Date: Thu, 18 Jun 2015 12:26:38 -0300 Subject: Checks if tool is installed (svn, cvs, hg) --- src/luarocks/fetch/cvs.lua | 7 ++++++- src/luarocks/fetch/hg.lua | 6 +++++- src/luarocks/fetch/svn.lua | 4 ++++ 3 files changed, 15 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/luarocks/fetch/cvs.lua b/src/luarocks/fetch/cvs.lua index cc9fd655..fad1ca0d 100644 --- a/src/luarocks/fetch/cvs.lua +++ b/src/luarocks/fetch/cvs.lua @@ -20,9 +20,14 @@ function cvs.get_sources(rockspec, extract, dest_dir) assert(type(rockspec) == "table") assert(type(dest_dir) == "string" or not dest_dir) + local cvs_cmd = rockspec.variables.CVS + if not fs.execute_quiet(cvs_cmd, "--version") then + return nil, "'"..cvs_cmd.."' program not found. Is CVS installed? You may want to edit variables.CVS" + end + local name_version = rockspec.name .. "-" .. rockspec.version local module = rockspec.source.module or dir.base_name(rockspec.source.url) - local command = {rockspec.variables.CVS, "-d"..rockspec.source.pathname, "export", module} + local command = {cvs_cmd, "-d"..rockspec.source.pathname, "export", module} if rockspec.source.tag then table.insert(command, 4, "-r") table.insert(command, 5, rockspec.source.tag) diff --git a/src/luarocks/fetch/hg.lua b/src/luarocks/fetch/hg.lua index e736a071..055e3bbe 100644 --- a/src/luarocks/fetch/hg.lua +++ b/src/luarocks/fetch/hg.lua @@ -21,9 +21,13 @@ function hg.get_sources(rockspec, extract, dest_dir) assert(type(dest_dir) == "string" or not dest_dir) local hg_cmd = rockspec.variables.HG + if not fs.execute_quiet(hg_cmd, "--version") then + return nil, "'"..hg_cmd.."' program not found. Is Mercurial installed? You may want to edit variables.HG" + end + local name_version = rockspec.name .. "-" .. rockspec.version -- Strip off special hg:// protocol type - local url = rockspec.source.url:gsub("^hg://", "") + local url = rockspec.source.url:gsub("^hg://", "") local module = dir.base_name(url) diff --git a/src/luarocks/fetch/svn.lua b/src/luarocks/fetch/svn.lua index abeacf9a..8fe582f6 100644 --- a/src/luarocks/fetch/svn.lua +++ b/src/luarocks/fetch/svn.lua @@ -21,6 +21,10 @@ function svn.get_sources(rockspec, extract, dest_dir) assert(type(dest_dir) == "string" or not dest_dir) local svn_cmd = rockspec.variables.SVN + if not fs.execute_quiet(svn_cmd, "--version") then + return nil, "'"..svn_cmd.."' program not found. Is Subversion installed? You may want to edit variables.SVN" + end + local name_version = rockspec.name .. "-" .. rockspec.version local module = rockspec.source.module or dir.base_name(rockspec.source.url) local url = rockspec.source.url:gsub("^svn://", "") -- cgit v1.2.3-55-g6feb