diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2018-04-20 10:44:46 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2018-05-31 11:16:09 -0300 |
commit | e512a6c0403ef4e6ac8b272bb2f1246b0ec57590 (patch) | |
tree | 01f7496dbb7456bb1f3ae666c16a5f29b86521fb /src | |
parent | 3b92924922a21a996adb1312e50dcdf87d1f61f8 (diff) | |
download | luarocks-e512a6c0403ef4e6ac8b272bb2f1246b0ec57590.tar.gz luarocks-e512a6c0403ef4e6ac8b272bb2f1246b0ec57590.tar.bz2 luarocks-e512a6c0403ef4e6ac8b272bb2f1246b0ec57590.zip |
write_rockspec: do not print license when detected
Diffstat (limited to 'src')
-rw-r--r-- | src/luarocks/cmd/write_rockspec.lua | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/luarocks/cmd/write_rockspec.lua b/src/luarocks/cmd/write_rockspec.lua index 53be404c..f3398a6a 100644 --- a/src/luarocks/cmd/write_rockspec.lua +++ b/src/luarocks/cmd/write_rockspec.lua | |||
@@ -146,16 +146,15 @@ local function detect_scm_url(directory) | |||
146 | detect_url_from_command("hg", "paths default", directory) | 146 | detect_url_from_command("hg", "paths default", directory) |
147 | end | 147 | end |
148 | 148 | ||
149 | local function show_license(rockspec) | 149 | local function check_license() |
150 | local fd = open_file("COPYING") or open_file("LICENSE") or open_file("MIT-LICENSE.txt") | 150 | local fd = open_file("COPYING") or open_file("LICENSE") or open_file("MIT-LICENSE.txt") |
151 | if not fd then return nil end | 151 | if not fd then return nil end |
152 | local data = fd:read("*a") | 152 | local data = fd:read("*a") |
153 | fd:close() | 153 | fd:close() |
154 | local is_mit = detect_mit_license(data) | 154 | if detect_mit_license(data) then |
155 | util.title("License for "..rockspec.package..":") | 155 | return "MIT", data |
156 | util.printout(data) | 156 | end |
157 | util.printout() | 157 | return nil, data |
158 | return is_mit | ||
159 | end | 158 | end |
160 | 159 | ||
161 | local function get_cmod_name(file) | 160 | local function get_cmod_name(file) |
@@ -371,10 +370,16 @@ function write_rockspec.command(flags, name, version, url_or_dir) | |||
371 | rockspec.description.detailed = flags["detailed"] or detailed | 370 | rockspec.description.detailed = flags["detailed"] or detailed |
372 | end | 371 | end |
373 | 372 | ||
374 | local is_mit = show_license(rockspec) | 373 | if not flags["license"] then |
375 | 374 | local license, fulltext = check_license() | |
376 | if is_mit and not flags["license"] then | 375 | if license then |
377 | rockspec.description.license = "MIT" | 376 | rockspec.description.license = license |
377 | elseif license then | ||
378 | util.title("Could not auto-detect type for project license:") | ||
379 | util.printout(fulltext) | ||
380 | util.printout() | ||
381 | util.title("Please fill in the source.license field manually or use --license.") | ||
382 | end | ||
378 | end | 383 | end |
379 | 384 | ||
380 | fill_as_builtin(rockspec, libs) | 385 | fill_as_builtin(rockspec, libs) |