Page MenuHomeFreeBSD

devel/lua-luarocks: update to 3.2.1
AbandonedPublic

Authored by russ.haley_gmail.com on Nov 2 2018, 4:45 AM.
Tags
  • Restricted Project
Referenced Files
Unknown Object (File)
Sun, Mar 17, 7:40 PM
Unknown Object (File)
Feb 22 2024, 3:55 AM
Unknown Object (File)
Feb 20 2024, 12:20 PM
Unknown Object (File)
Jan 22 2024, 10:55 AM
Unknown Object (File)
Jan 18 2024, 3:24 PM
Unknown Object (File)
Jan 17 2024, 6:16 PM
Unknown Object (File)
Jan 15 2024, 9:50 PM
Unknown Object (File)
Dec 20 2023, 8:04 AM
Subscribers

Details

Summary

Update to 3.2.1. This revision has upstream fix for the patch to handle unzip correctly. That patch has been removed.

Test Plan

Builds and installs. LuaRocks functions tested: search, install. Installed C based rocks in lua52 and lua53.

Tested build against Lua53, Lua52, Lua54 (https://reviews.freebsd.org/D14709) and LuaJIT.

Diff Detail

Repository
rP FreeBSD ports repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

russ.haley_gmail.com retitled this revision from Bump lua-rocks to 3.0.4 to devel/lua-luarocks: update to 3.0.1.Nov 2 2018, 4:49 AM
russ.haley_gmail.com retitled this revision from devel/lua-luarocks: update to 3.0.1 to devel/lua-luarocks: update to 3.0.4.
jbeich requested changes to this revision.Nov 2 2018, 5:00 AM

Fails to build. Rebasing after 760ad7c98a4a looks trivial.

===>  Patching for lua51-luarocks-3.0.4
===>  Applying FreeBSD patches for lua51-luarocks-3.0.4
1 out of 4 hunks failed--saving rejects to src/luarocks/core/cfg.lua.rej
=> FreeBSD patch patch-src_luarocks_core_cfg.lua failed to apply cleanly.
*** Error code 1
pkg-plist
2 โ†—(On Diff #49922)

Version suffix is already handled by USES=uniquefiles.

3 โ†—(On Diff #49922)

If you drop @sample then there would be no default config breaking luarocks.

This revision now requires changes to proceed.Nov 2 2018, 5:00 AM

Argh! Sorry about that @jbeich. I forgot to delete the patch in svn.

Doesn't work:

$ pkg install lua52-luarocks
$ luarocks-5.2 install --local penlight
Warning: Failed searching manifest: Failed extracting manifest file: 'unzip -n' program not found. Make sure unzip is installed and is available in your PATH (or you may want to edit the 'variables.UNZIP' value in file '/usr/local/etc/luarocks/config-5.2.lua')
Installing https://raw.githubusercontent.com/rocks-moonscript-org/moonrocks-mirror/master/penlight-1.5.4-1.rockspec
Missing dependencies for penlight 1.5.4-1:
   luafilesystem (not installed)

penlight 1.5.4-1 depends on luafilesystem (not installed)
Warning: Failed searching manifest: Failed extracting manifest file: 'unzip -n' program not found. Make sure unzip is installed and is available in your PATH (or you may want to edit the 'variables.UNZIP' value in file '/usr/local/etc/luarocks/config-5.2.lua')
Installing https://raw.githubusercontent.com/rocks-moonscript-org/moonrocks-mirror/master/luafilesystem-1.7.0-2.src.rock

Error: Failed installing dependency: https://raw.githubusercontent.com/rocks-moonscript-org/moonrocks-mirror/master/luafilesystem-1.7.0-2.src.rock - Failed unpacking rock file: /tmp/luarocks_luarocks-rock-luafilesystem-1.7.0-2-h01bYU/luafilesystem-1.7.0-2.src.rock: 'unzip -n' program not found. Make sure unzip is installed and is available in your PATH (or you may want to edit the 'variables.UNZIP' value in file '/usr/local/etc/luarocks/config-5.2.lua')

Argh! Sorry about that @jbeich. I forgot to delete the patch in svn.

Why? Maintainer is supposed to be able to rebase patches. If patches are dropped for other reasons rationale has to be explicitly stated (can be short).

Doesn't work:

$ pkg install lua52-luarocks
$ luarocks-5.2 install --local penlight
Warning: Failed searching manifest: Failed extracting manifest file: 'unzip -n' program not found. Make sure unzip is installed and is available in your PATH (or you may want to edit the 'variables.UNZIP' value in file '/usr/local/etc/luarocks/config-5.2.lua')
Installing https://raw.githubusercontent.com/rocks-moonscript-org/moonrocks-mirror/master/penlight-1.5.4-1.rockspec
Missing dependencies for penlight 1.5.4-1:
   luafilesystem (not installed)

penlight 1.5.4-1 depends on luafilesystem (not installed)
Warning: Failed searching manifest: Failed extracting manifest file: 'unzip -n' program not found. Make sure unzip is installed and is available in your PATH (or you may want to edit the 'variables.UNZIP' value in file '/usr/local/etc/luarocks/config-5.2.lua')
Installing https://raw.githubusercontent.com/rocks-moonscript-org/moonrocks-mirror/master/luafilesystem-1.7.0-2.src.rock

Error: Failed installing dependency: https://raw.githubusercontent.com/rocks-moonscript-org/moonrocks-mirror/master/luafilesystem-1.7.0-2.src.rock - Failed unpacking rock file: /tmp/luarocks_luarocks-rock-luafilesystem-1.7.0-2-h01bYU/luafilesystem-1.7.0-2.src.rock: 'unzip -n' program not found. Make sure unzip is installed and is available in your PATH (or you may want to edit the 'variables.UNZIP' value in file '/usr/local/etc/luarocks/config-5.2.lua')

Argh! Sorry about that @jbeich. I forgot to delete the patch in svn.

Why? Maintainer is supposed to be able to rebase patches. If patches are dropped for other reasons rationale has to be explicitly stated (can be short).

Quite right. A maintainer should also know better than to look at the patched file in the work directory and come to the incorrect conclusion that the patch is no longer needed. :-/
I'll push a rebased patch and then look why unzip might not be working next chance I get.

Patch file was removed in error. Rebased patch file for src/luarocks/core/cfg.lua.

Doesn't work:

$ pkg install lua52-luarocks
$ luarocks-5.2 install --local penlight
Warning: Failed searching manifest: Failed extracting manifest file: 'unzip -n' program not found. Make sure unzip is installed and is available in your PATH (or you may want to edit the 'variables.UNZIP' value in file '/usr/local/etc/luarocks/config-5.2.lua')
Installing https://raw.githubusercontent.com/rocks-moonscript-org/moonrocks-mirror/master/penlight-1.5.4-1.rockspec
Missing dependencies for penlight 1.5.4-1:
   luafilesystem (not installed)

penlight 1.5.4-1 depends on luafilesystem (not installed)
Warning: Failed searching manifest: Failed extracting manifest file: 'unzip -n' program not found. Make sure unzip is installed and is available in your PATH (or you may want to edit the 'variables.UNZIP' value in file '/usr/local/etc/luarocks/config-5.2.lua')
Installing https://raw.githubusercontent.com/rocks-moonscript-org/moonrocks-mirror/master/luafilesystem-1.7.0-2.src.rock

Error: Failed installing dependency: https://raw.githubusercontent.com/rocks-moonscript-org/moonrocks-mirror/master/luafilesystem-1.7.0-2.src.rock - Failed unpacking rock file: /tmp/luarocks_luarocks-rock-luafilesystem-1.7.0-2-h01bYU/luafilesystem-1.7.0-2.src.rock: 'unzip -n' program not found. Make sure unzip is installed and is available in your PATH (or you may want to edit the 'variables.UNZIP' value in file '/usr/local/etc/luarocks/config-5.2.lua')

I posted on the lua mailing list and it turns out luarocks 3.0.4 uses unzip -h to check for the existence of unzip. The unzip included with base FreeBSD doesn't provide this functionality but the version in ports/archivers does. As noted in the error message, the config-X.X.lua file provides a variable for UNZIP. I set the variable to point at /usr/local/bin/unzip and successfully built and installed luasec (via luarocks).

SO, my plan going forward is to add a dependency to archivers/unzip and patch the luarocks-X.X.lua config file. One thing I don't know yet is if I should add a patch in files/ for pre-build patching or if a post build step is required.

Doesn't work:

$ pkg install lua52-luarocks
$ luarocks-5.2 install --local penlight
Warning: Failed searching manifest: Failed extracting manifest file: 'unzip -n' program not found. Make sure unzip is installed and is available in your PATH (or you may want to edit the 'variables.UNZIP' value in file '/usr/local/etc/luarocks/config-5.2.lua')
Installing https://raw.githubusercontent.com/rocks-moonscript-org/moonrocks-mirror/master/penlight-1.5.4-1.rockspec
Missing dependencies for penlight 1.5.4-1:
   luafilesystem (not installed)

penlight 1.5.4-1 depends on luafilesystem (not installed)
Warning: Failed searching manifest: Failed extracting manifest file: 'unzip -n' program not found. Make sure unzip is installed and is available in your PATH (or you may want to edit the 'variables.UNZIP' value in file '/usr/local/etc/luarocks/config-5.2.lua')
Installing https://raw.githubusercontent.com/rocks-moonscript-org/moonrocks-mirror/master/luafilesystem-1.7.0-2.src.rock

Error: Failed installing dependency: https://raw.githubusercontent.com/rocks-moonscript-org/moonrocks-mirror/master/luafilesystem-1.7.0-2.src.rock - Failed unpacking rock file: /tmp/luarocks_luarocks-rock-luafilesystem-1.7.0-2-h01bYU/luafilesystem-1.7.0-2.src.rock: 'unzip -n' program not found. Make sure unzip is installed and is available in your PATH (or you may want to edit the 'variables.UNZIP' value in file '/usr/local/etc/luarocks/config-5.2.lua')

I posted on the lua mailing list and it turns out luarocks 3.0.4 uses unzip -h to check for the existence of unzip. The unzip included with base FreeBSD doesn't provide this functionality but the version in ports/archivers does. As noted in the error message, the config-X.X.lua file provides a variable for UNZIP. I set the variable to point at /usr/local/bin/unzip and successfully built and installed luasec (via luarocks).

SO, my plan going forward is to add a dependency to archivers/unzip and patch the luarocks-X.X.lua config file. One thing I don't know yet is if I should add a patch in files/ for pre-build patching or if a post build step is required.

sed is being difficult. I've added a sed line to the post-install target:

post-install:
# Let @sample manage default config
	sudo sed -i -- '/variables = {/ a \
		UNZIP = "/usr/local/bin/unzip";\
		' ${STAGEDIR}${ETCDIR}/config-${LUA_VER}.lua
	${MV} ${STAGEDIR}${ETCDIR}/config-${LUA_VER}.lua \
		${STAGEDIR}${ETCDIR}/config-${LUA_VER}.lua.sample

but I'm getting an error:

...
gmake[3]: Leaving directory '/usr/home/russellh/freebsd/ports/devel/lua-luarocks_304/work/luarocks-3.0.4'
gmake[2]: Leaving directory '/usr/home/russellh/freebsd/ports/devel/lua-luarocks_304/work/luarocks-3.0.4'
sed -i -- '/variables = {/ a  UNZIP = "/usr/local/bin/unzip"; ' /usr/home/russellh/freebsd/ports/devel/lua-luarocks_304/work/stage/usr/local/etc/luarocks/config-5.3.lua
sed: 1: "/variables = {/ a  UNZI ...": command a expects \ followed by text
*** Error code 1

Stop.
make[1]: stopped in /usr/home/russellh/freebsd/ports/devel/lua-luarocks_304
*** Error code 1

Stop.
make: stopped in /usr/home/russellh/freebsd/ports/devel/lua-luarocks_304
russellh@g1 ~/f/p/d/lua-luarocks_304>

I'll try again tomorrow.

What is the benefit of using archivers/unzip? unzip -h just shows help string. -h and --version are GNUisms. On BSDs one is supposed to read manpages first before playing with fire (e.g., shutdown -h ;). unzip is always available on DragonFly, FreeBSD and NetBSD but not OpenBSD. In the ports tree only FreeBSD and DragonFly are supported. While you can probably emulate which(1) in Lua then submit the fix upstream, in the ports patching out the offending check is another option.

post-install:
# Let @sample manage default config
	sudo sed -i -- '/variables = {/ a \
		UNZIP = "/usr/local/bin/unzip";\
		' ${STAGEDIR}${ETCDIR}/config-${LUA_VER}.lua
	${MV} ${STAGEDIR}${ETCDIR}/config-${LUA_VER}.lua \
		${STAGEDIR}${ETCDIR}/config-${LUA_VER}.lua.sample
  1. sudo is not required, ports can be built as regular user if the tree isn't owned by root
  2. sed -i syntax is different from GNU, backup suffix must always be specified but can be empty
  3. sed -i should be spelled as ${REINPLACE_CMD}
  4. a in BSD sed(1) must be followed by a real newline but make(1) would concatenate \ escaped newlines
  5. /usr/local should be spelled as ${PREFIX} (current port) or ${LOCALBASE} (dependencies, other ports)

What is the benefit of using archivers/unzip? unzip -h just shows help string. -h and --version are GNUisms. On BSDs one is supposed to read manpages first before playing with fire (e.g., shutdown -h ;). unzip is always available on DragonFly, FreeBSD and NetBSD but not OpenBSD. In the ports tree only FreeBSD and DragonFly are supported. While you can probably emulate which(1) in Lua then submit the fix upstream, in the ports patching out the offending check is another option.

My logic in choosing this path was to leave the upstream code alone and use ports to bring FreeBSD in line with intent of the upstream authors (that and I didn't have a chance to look at the LR sources. Thanks for that). I noticed that the port already had a dependency on archivers/zip so I thought pulling in unzip would be appropriate. Patching the tools.lua file does seem to be a more expedient/direct solution.

If I understood your comment on the BSDs correctly, you are saying that both DragonFlyBSD and FreeBSD use the FreeBSD ports tree, but NetBSD and OpenBSD do not? I had a vague understanding of this from other meanderings.

post-install:
# Let @sample manage default config
	sudo sed -i -- '/variables = {/ a \
		UNZIP = "/usr/local/bin/unzip";\
		' ${STAGEDIR}${ETCDIR}/config-${LUA_VER}.lua
	${MV} ${STAGEDIR}${ETCDIR}/config-${LUA_VER}.lua \
		${STAGEDIR}${ETCDIR}/config-${LUA_VER}.lua.sample
  1. sudo is not required, ports can be built as regular user if the tree isn't owned by root
  2. sed -i syntax is different from GNU, backup suffix must always be specified but can be empty
  3. sed -i should be spelled as ${REINPLACE_CMD}
  4. a in BSD sed(1) must be followed by a real newline but make(1) would concatenate \ escaped newlines
  5. /usr/local should be spelled as ${PREFIX} (current port) or ${LOCALBASE} (dependencies, other ports)
russ.haley_gmail.com edited the summary of this revision. (Show Details)
russ.haley_gmail.com edited the test plan for this revision. (Show Details)

Add patch that removes use of unsupported -h option. The option is used to check for the existence of unzip, which is present in the base FreeBSD image.

I just tested on 12-Release using a clean /usr/ports directory. The system force me to install Lua5.2 because Mk/bsd.default-versions.mk isn't patched (the upside is luarocks is tested with Lua52 now!). How do I go about getting the default version bumped? I would guess an exp-run would be required? I'd also like to see an exp-run to find out what's not current. @andrew_tao173.riddles.org.uk also has a patch in the works to add FLAVOURS to lua here: https://reviews.freebsd.org/D16494

Thoughts?

I'm happy to pick up the flavors work again if there's any likelihood of it actually going anywhere.

Hi @jbeich

I've installed cqueues, ldoc and penlight on freebsd 12.0 using Lua52. Output for ldoc and penlight installation:

russellh@fbsd-12:~> sudo luarocks-5.2 install ldoc
Installing https://luarocks.org/ldoc-1.4.6-2.rockspec
Missing dependencies for ldoc 1.4.6-2:
   penlight (not installed)

ldoc 1.4.6-2 depends on penlight (not installed)
Installing https://luarocks.org/penlight-1.5.4-1.rockspec

penlight 1.5.4-1 is now installed in /usr/local (license: MIT/X11)

ldoc 1.4.6-2 is now installed in /usr/local (license: MIT/X11)
russellh@fbsd-12:~> luarocks-5.2

LuaRocks 3.0.4, the Lua package manager

NAME
        /usr/local/bin/luarocks-5.2 - LuaRocks main command-line interface

SYNOPSIS
        /usr/local/bin/luarocks-5.2 [<flags...>] [VAR=VALUE]... <command> [<argument>]

GENERAL OPTIONS
        These apply to all commands, as appropriate:
...

Could we get this committed and then I can test using Andrews flavors support? https://reviews.freebsd.org/D16494

Cheers,
Russ

Hi @mat, this port update has been languishing for some time now. How do I get this committed without @jbeich removing his change request? I completed the requested changes some time ago and have been using this port update for a few weeks now.

russ.haley_gmail.com retitled this revision from devel/lua-luarocks: update to 3.0.4 to devel/lua-luarocks: update to 3.1.3.Jun 16 2019, 6:24 PM
russ.haley_gmail.com edited the summary of this revision. (Show Details)
russ.haley_gmail.com edited the test plan for this revision. (Show Details)
russ.haley_gmail.com retitled this revision from devel/lua-luarocks: update to 3.1.3 to devel/lua-luarocks: update to 3.2.1.
russ.haley_gmail.com edited the summary of this revision. (Show Details)

I worked with the upstream maintainer to fix the issue with the default FreeBSD unzip(1) implementation. The bug existed because LuaRocks would test for the existance of unzip using the -h option, which is not present in FreeBSD. LuaRocks now implicitly recognizes that FreeBSD has unzip so it doesn't test for it.

The only remaining patch is the one in src/luarocks/core/cfg.lua. This is a DragonflyBSD patch plus some default tweaks. I question why we are maintaining it; I have an unpatched, non-ports version of luarocks that compiles C modules fine? I mean no disrespect to the Dragonfly people, I just suspect they maintain their own patches and could always contact upstream? It would be much easier to maintain LR if we didn't have to patch it.

russ.haley_gmail.com edited the summary of this revision. (Show Details)
russ.haley_gmail.com edited the test plan for this revision. (Show Details)

This version is updated to use LUA_FLAVORS from here: https://reviews.freebsd.org/D16494. I have implemented options for each flavor.

Questions:
I don't know if options are the best choice? Is there a way to ignore (or not persist) the options selected during make config? (how does one specify FLAVOURS on the command line? Is that easier than specifying options on the command line?)

Luarocks has already been updated to 3.3.1 and this patch is broken. I'm abandoning this review.