diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2015-03-19 15:55:32 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2015-03-19 15:55:32 -0300 |
commit | f15e49ddaa95fe24f97f9ea465ddcee2cb38e745 (patch) | |
tree | 87149c2029bcd72fd8e45f47aa0dc07cbc20efe9 | |
parent | 9567ac54e7f869a0099c824187b5fcdb80917bc5 (diff) | |
parent | 20eb94723f142f2bba420a05046157a3e115a3f0 (diff) | |
download | luarocks-f15e49ddaa95fe24f97f9ea465ddcee2cb38e745.tar.gz luarocks-f15e49ddaa95fe24f97f9ea465ddcee2cb38e745.tar.bz2 luarocks-f15e49ddaa95fe24f97f9ea465ddcee2cb38e745.zip |
Merge pull request #330 from mpeterv/hg-support
Improve hg support
-rw-r--r-- | Makefile.setup.inc | 3 | ||||
-rw-r--r-- | src/luarocks/fetch/hg.lua | 2 | ||||
-rw-r--r-- | src/luarocks/fetch/hg_http.lua | 24 | ||||
-rw-r--r-- | src/luarocks/fetch/hg_https.lua | 8 | ||||
-rw-r--r-- | src/luarocks/fetch/hg_ssh.lua | 8 |
5 files changed, 43 insertions, 2 deletions
diff --git a/Makefile.setup.inc b/Makefile.setup.inc index eb51ba5e..ef498e9b 100644 --- a/Makefile.setup.inc +++ b/Makefile.setup.inc | |||
@@ -15,5 +15,6 @@ manif_core.lua fetch.lua unpack.lua validate.lua cfg.lua download.lua \ | |||
15 | help.lua util.lua index.lua cache.lua refresh_cache.lua loader.lua \ | 15 | help.lua util.lua index.lua cache.lua refresh_cache.lua loader.lua \ |
16 | admin_remove.lua fetch/hg.lua fetch/git_file.lua new_version.lua lint.lua \ | 16 | admin_remove.lua fetch/hg.lua fetch/git_file.lua new_version.lua lint.lua \ |
17 | purge.lua path.lua path_cmd.lua write_rockspec.lua doc.lua upload.lua \ | 17 | purge.lua path.lua path_cmd.lua write_rockspec.lua doc.lua upload.lua \ |
18 | upload/api.lua upload/multipart.lua fetch/git_http.lua | 18 | upload/api.lua upload/multipart.lua fetch/git_http.lua fetch/hg_http.lua \ |
19 | fetch/hg_https.lua fetch/hg_ssh.lua | ||
19 | 20 | ||
diff --git a/src/luarocks/fetch/hg.lua b/src/luarocks/fetch/hg.lua index b2ba56e9..e736a071 100644 --- a/src/luarocks/fetch/hg.lua +++ b/src/luarocks/fetch/hg.lua | |||
@@ -30,7 +30,7 @@ function hg.get_sources(rockspec, extract, dest_dir) | |||
30 | local command = {hg_cmd, "clone", url, module} | 30 | local command = {hg_cmd, "clone", url, module} |
31 | local tag_or_branch = rockspec.source.tag or rockspec.source.branch | 31 | local tag_or_branch = rockspec.source.tag or rockspec.source.branch |
32 | if tag_or_branch then | 32 | if tag_or_branch then |
33 | command = {hg_cmd, "clone", "--rev", url, module} | 33 | command = {hg_cmd, "clone", "--rev", tag_or_branch, url, module} |
34 | end | 34 | end |
35 | local store_dir | 35 | local store_dir |
36 | if not dest_dir then | 36 | if not dest_dir then |
diff --git a/src/luarocks/fetch/hg_http.lua b/src/luarocks/fetch/hg_http.lua new file mode 100644 index 00000000..8f506daf --- /dev/null +++ b/src/luarocks/fetch/hg_http.lua | |||
@@ -0,0 +1,24 @@ | |||
1 | |||
2 | --- Fetch back-end for retrieving sources from hg repositories | ||
3 | -- that use http:// transport. For example, for fetching a repository | ||
4 | -- that requires the following command line: | ||
5 | -- `hg clone http://example.com/foo` | ||
6 | -- you can use this in the rockspec: | ||
7 | -- source = { url = "hg+http://example.com/foo" } | ||
8 | local hg_http = {} | ||
9 | |||
10 | local hg = require("luarocks.fetch.hg") | ||
11 | |||
12 | --- Download sources for building a rock, using hg over http. | ||
13 | -- @param rockspec table: The rockspec table | ||
14 | -- @param extract boolean: Unused in this module (required for API purposes.) | ||
15 | -- @param dest_dir string or nil: If set, will extract to the given directory. | ||
16 | -- @return (string, string) or (nil, string): The absolute pathname of | ||
17 | -- the fetched source tarball and the temporary directory created to | ||
18 | -- store it; or nil and an error message. | ||
19 | function hg_http.get_sources(rockspec, extract, dest_dir) | ||
20 | rockspec.source.url = rockspec.source.url:gsub("^hg.", "") | ||
21 | return hg.get_sources(rockspec, extract, dest_dir) | ||
22 | end | ||
23 | |||
24 | return hg_http | ||
diff --git a/src/luarocks/fetch/hg_https.lua b/src/luarocks/fetch/hg_https.lua new file mode 100644 index 00000000..e67417fe --- /dev/null +++ b/src/luarocks/fetch/hg_https.lua | |||
@@ -0,0 +1,8 @@ | |||
1 | |||
2 | --- Fetch back-end for retrieving sources from hg repositories | ||
3 | -- that use https:// transport. For example, for fetching a repository | ||
4 | -- that requires the following command line: | ||
5 | -- `hg clone https://example.com/foo` | ||
6 | -- you can use this in the rockspec: | ||
7 | -- source = { url = "hg+https://example.com/foo" } | ||
8 | return require "luarocks.fetch.hg_http" | ||
diff --git a/src/luarocks/fetch/hg_ssh.lua b/src/luarocks/fetch/hg_ssh.lua new file mode 100644 index 00000000..0c365fab --- /dev/null +++ b/src/luarocks/fetch/hg_ssh.lua | |||
@@ -0,0 +1,8 @@ | |||
1 | |||
2 | --- Fetch back-end for retrieving sources from hg repositories | ||
3 | -- that use ssh:// transport. For example, for fetching a repository | ||
4 | -- that requires the following command line: | ||
5 | -- `hg clone ssh://example.com/foo` | ||
6 | -- you can use this in the rockspec: | ||
7 | -- source = { url = "hg+ssh://example.com/foo" } | ||
8 | return require "luarocks.fetch.hg_http" | ||