aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2014-08-11 12:02:58 -0300
committerHisham Muhammad <hisham@gobolinux.org>2014-08-11 12:02:58 -0300
commitfa6863a19d3dd40c43975ffb4b3384d9cad40228 (patch)
treefc56dd767a8c03e7b69efe21182a3cebbc2a60ce
parentb66bc076af602d5afe1eb6f2bf0275d3e9bc2422 (diff)
downloadluarocks-fa6863a19d3dd40c43975ffb4b3384d9cad40228.tar.gz
luarocks-fa6863a19d3dd40c43975ffb4b3384d9cad40228.tar.bz2
luarocks-fa6863a19d3dd40c43975ffb4b3384d9cad40228.zip
Apply portability fixes suggested by @ignacio.
-rw-r--r--src/luarocks/fs/unix.lua4
-rw-r--r--src/luarocks/fs/win32.lua4
-rw-r--r--src/luarocks/upload/api.lua8
3 files changed, 12 insertions, 4 deletions
diff --git a/src/luarocks/fs/unix.lua b/src/luarocks/fs/unix.lua
index a70ed116..6ad5a678 100644
--- a/src/luarocks/fs/unix.lua
+++ b/src/luarocks/fs/unix.lua
@@ -107,4 +107,8 @@ function unix.replace_file(old_file, new_file)
107 return os.rename(new_file, old_file) 107 return os.rename(new_file, old_file)
108end 108end
109 109
110function unix.tmpname()
111 return os.tmpname()
112end
113
110return unix 114return unix
diff --git a/src/luarocks/fs/win32.lua b/src/luarocks/fs/win32.lua
index 238a25e9..12d86d1d 100644
--- a/src/luarocks/fs/win32.lua
+++ b/src/luarocks/fs/win32.lua
@@ -214,4 +214,8 @@ function win32.is_writable(file)
214 return result 214 return result
215end 215end
216 216
217function win32.tmpname()
218 return os.getenv("TMP")..os.tmpname()
219end
220
217return win32 221return win32
diff --git a/src/luarocks/upload/api.lua b/src/luarocks/upload/api.lua
index 4ab311f2..c5883355 100644
--- a/src/luarocks/upload/api.lua
+++ b/src/luarocks/upload/api.lua
@@ -141,21 +141,21 @@ function Api:request(url, params, post_params)
141 end 141 end
142 local method = "GET" 142 local method = "GET"
143 local out 143 local out
144 local tmpfile = os.tmpname() 144 local tmpfile = fs.tmpname()
145 if post_params then 145 if post_params then
146 method = "POST" 146 method = "POST"
147 local curl_cmd = fs.Q(vars.CURL).." -f -k -L --user-agent '"..cfg.user_agent.." via curl' " 147 local curl_cmd = fs.Q(vars.CURL).." -f -k -L --silent --user-agent \""..cfg.user_agent.." via curl\" "
148 for k,v in pairs(post_params) do 148 for k,v in pairs(post_params) do
149 local var = v 149 local var = v
150 if type(v) == "table" then 150 if type(v) == "table" then
151 var = "@"..v.fname 151 var = "@"..v.fname
152 end 152 end
153 curl_cmd = curl_cmd .. "--form '"..k.."="..var.."' " 153 curl_cmd = curl_cmd .. "--form \""..k.."="..var.."\" "
154 end 154 end
155 if cfg.connection_timeout and cfg.connection_timeout > 0 then 155 if cfg.connection_timeout and cfg.connection_timeout > 0 then
156 curl_cmd = curl_cmd .. "--connect-timeout "..tonumber(cfg.connection_timeout).." " 156 curl_cmd = curl_cmd .. "--connect-timeout "..tonumber(cfg.connection_timeout).." "
157 end 157 end
158 ok = fs.execute_string(curl_cmd..fs.Q(url).." 2> /dev/null 1> "..fs.Q(tmpfile)) 158 ok = fs.execute_string(curl_cmd..fs.Q(url).." -o "..fs.Q(tmpfile))
159 else 159 else
160 local ok, err = fs.download(url, tmpfile) 160 local ok, err = fs.download(url, tmpfile)
161 if not ok then 161 if not ok then