diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2014-08-11 12:02:58 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2014-08-11 12:02:58 -0300 |
commit | fa6863a19d3dd40c43975ffb4b3384d9cad40228 (patch) | |
tree | fc56dd767a8c03e7b69efe21182a3cebbc2a60ce | |
parent | b66bc076af602d5afe1eb6f2bf0275d3e9bc2422 (diff) | |
download | luarocks-fa6863a19d3dd40c43975ffb4b3384d9cad40228.tar.gz luarocks-fa6863a19d3dd40c43975ffb4b3384d9cad40228.tar.bz2 luarocks-fa6863a19d3dd40c43975ffb4b3384d9cad40228.zip |
Apply portability fixes suggested by @ignacio.
-rw-r--r-- | src/luarocks/fs/unix.lua | 4 | ||||
-rw-r--r-- | src/luarocks/fs/win32.lua | 4 | ||||
-rw-r--r-- | src/luarocks/upload/api.lua | 8 |
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) |
108 | end | 108 | end |
109 | 109 | ||
110 | function unix.tmpname() | ||
111 | return os.tmpname() | ||
112 | end | ||
113 | |||
110 | return unix | 114 | return 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 |
215 | end | 215 | end |
216 | 216 | ||
217 | function win32.tmpname() | ||
218 | return os.getenv("TMP")..os.tmpname() | ||
219 | end | ||
220 | |||
217 | return win32 | 221 | return 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 |