MisterDA / love-release

:love_letter: Lua script that makes LÖVE game release easier
MIT License
449 stars 27 forks source link

Fixed debian release #63

Closed drmargarido closed 5 years ago

drmargarido commented 5 years ago

Changed chmod call to an execute call because fs.chmod was removed from luarocks.fs in version 3.

coveralls commented 5 years ago

Coverage Status

Coverage remained the same at 25.122% when pulling 2de38ef87ce0c87733db849c21c7eb814ec0f871 on drmargarido:fix-debian-release into 9bb41928fae0d392635004dc698b5db54bb2a65e on MisterDA:master.

MisterDA commented 5 years ago

Thanks for the bug fix!

A quick grep over the LuaRocks codebase shows that they’ve switched to LuaPosix functions, I’d rather follow their lead. http://luaposix.github.io/luaposix/modules/posix.html#chmod

spec/fs_spec.lua
36:         fs.execute("chmod -r " .. fs.Q(path))
44:         fs.execute("chmod -w " .. fs.Q(path))
52:         fs.execute("chmod -x " .. fs.Q(path))

spec/util/test_env.lua
640:            execute_bool("chmod og-wx ~/.ssh/authorized_keys")

src/luarocks/fs/lua.lua
399:      return posix.chmod(dest, fullattrs)
933:   local err = posix.chmod(filename, perms)

I’d escape the whole path, just in case.

Do you want to fix this, or should I do it? If you do, you can rebase force-push to this branch.

Thanks!

drmargarido commented 5 years ago

I can fix it, thanks for the feedback.

MisterDA commented 5 years ago

… and I can’t compile LuaPosix. https://github.com/luaposix/luaposix/issues/320

drmargarido commented 5 years ago

My installation of luaposix also failed initially with luarocks so I used their luke file to install it -> https://github.com/luaposix/luaposix/tree/master/build-aux

MisterDA commented 5 years ago

I think I’m gonna go with

diff --git a/src/scripts/debian.lua b/src/scripts/debian.lua
index 24ddf8e..e3b1578 100644
--- a/src/scripts/debian.lua
+++ b/src/scripts/debian.lua
@@ -109,7 +109,8 @@ function s.script(project)
       "love '"..loveFileDeb:gsub("'", "\\'").."'\n",
       true
   )
-  assert(fs.chmod(tempDir.."/usr/bin/"..project.package, "+x"))
+  assert(fs.set_permissions(fs.Q(tempDir.."/usr/bin/"..project.package)),
+                            "exec", "all") -- 755

   -- /usr/share/games/${PACKAGE}/${LOVE_FILE}
   copyFile(project.releaseDirectory.."/"..script.loveFile, loveFileDeb, true)
drmargarido commented 5 years ago

Yes, that's better

MisterDA commented 5 years ago

I get weird results with chmod and fs.Q. If there is a sample file test, all it does is putting quotes around the parameter.

cfg = require("luarocks.core.cfg")
cfg.init()
fs = require("luarocks.fs")
fs.init()
fs.set_permissions("test", "exec", "all") -- works
fs.set_permissions("'test'", "exec", "all") -- does not work