aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThijs Schreijer <thijs@thijsschreijer.nl>2014-01-28 22:37:08 +0100
committerThijs Schreijer <thijs@thijsschreijer.nl>2014-01-28 22:37:08 +0100
commit2078f83cc348c5b149fde1e4614ddc3e5b3d9b93 (patch)
tree971a20044f67bca8171b814bb422c539ca3a77a6
parentbd471f78761aad2d548edf4f0a14bdbd20bb710e (diff)
downloadluarocks-2078f83cc348c5b149fde1e4614ddc3e5b3d9b93.tar.gz
luarocks-2078f83cc348c5b149fde1e4614ddc3e5b3d9b93.tar.bz2
luarocks-2078f83cc348c5b149fde1e4614ddc3e5b3d9b93.zip
adds a --branch=<branchname> option. The branchename is passed as BRANCH to the rockspec environment
-rw-r--r--src/luarocks/command_line.lua7
-rw-r--r--src/luarocks/fetch.lua7
2 files changed, 13 insertions, 1 deletions
diff --git a/src/luarocks/command_line.lua b/src/luarocks/command_line.lua
index 19d04290..f9fba300 100644
--- a/src/luarocks/command_line.lua
+++ b/src/luarocks/command_line.lua
@@ -113,6 +113,13 @@ function run_command(...)
113 die("Invalid entry for --deps-mode.") 113 die("Invalid entry for --deps-mode.")
114 end 114 end
115 115
116 if flags["branch"] then
117 if flags["branch"] == true or flags["branch"] == "" then
118 die("Argument error: use --branch=<branch-name>")
119 end
120 cfg.branch = flags["branch"]
121 end
122
116 if flags["tree"] then 123 if flags["tree"] then
117 if flags["tree"] == true or flags["tree"] == "" then 124 if flags["tree"] == true or flags["tree"] == "" then
118 die("Argument error: use --tree=<path>") 125 die("Argument error: use --tree=<path>")
diff --git a/src/luarocks/fetch.lua b/src/luarocks/fetch.lua
index 7960acb4..e0525dde 100644
--- a/src/luarocks/fetch.lua
+++ b/src/luarocks/fetch.lua
@@ -144,10 +144,15 @@ end
144function load_local_rockspec(filename, quick) 144function load_local_rockspec(filename, quick)
145 assert(type(filename) == "string") 145 assert(type(filename) == "string")
146 filename = fs.absolute_name(filename) 146 filename = fs.absolute_name(filename)
147 local rockspec, err = persist.load_into_table(filename) 147 local rockspec, err = persist.load_into_table(filename, {BRANCH = cfg.branch}) -- temp add BRANCH
148 if not rockspec then 148 if not rockspec then
149 return nil, "Could not load rockspec file "..filename.." ("..err..")" 149 return nil, "Could not load rockspec file "..filename.." ("..err..")"
150 end 150 end
151 if rockspec.BRANCH ~= cfg.branch then
152 return nil, "Invalid rockspec, BRANCH constant was illegally modified by rockspec"
153 else
154 rockspec.BRANCH = nil -- remove temporary added field
155 end
151 local globals = err 156 local globals = err
152 157
153 local ok, err = true, nil 158 local ok, err = true, nil