pkg-luarocks: fix top-level parallel makefile support
authorFabio Porcedda <fabio.porcedda@gmail.com>
Wed, 1 Jul 2015 08:10:47 +0000 (10:10 +0200)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Sat, 4 Jul 2015 13:21:33 +0000 (15:21 +0200)
In the *-install-target phase the manifest file is being updated, if multiply packages try to update it they fail.

To avoid multiple access to the manifest file use flock to sync
multiple luarocks packages.

e.g. installing three luarocks packages:
make lua-cjson-build lua-coat-build lua-coatpersistent-build
make lua-cjson lua-coat lua-coatpersistent -j

Fix error:
Updating manifest for /home/tetsuya/buildroot/br2/output/target/usr/lib/luarocks/rocks
No existing manifest. Attempting to rebuild...

Error: rock_manifest file not found for lua-coat 0.9.1-1 - not a LuaRocks 2 tree?

[Thomas: get rid of LUAROCKS_RUN, and use LUAROCKS_RUN_ENV +
LUAROCKS_RUN_CMD everywhere.]

Signed-off-by: Fabio Porcedda <fabio.porcedda@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
package/luarocks/luarocks.mk
package/pkg-luarocks.mk

index 2b6c9753a3008f206b8863215eec6c3b871d65e4..ccbaaf79478350f6b9ec715b7f1fd8dd9ffd76f5 100644 (file)
@@ -53,8 +53,8 @@ endef
 
 $(eval $(host-generic-package))
 
-LUAROCKS_RUN = LUA_PATH="$(HOST_DIR)/usr/share/lua/$(LUAINTERPRETER_ABIVER)/?.lua" \
-       $(LUA_RUN) $(HOST_DIR)/usr/bin/luarocks
+LUAROCKS_RUN_ENV = LUA_PATH="$(HOST_DIR)/usr/share/lua/$(LUAINTERPRETER_ABIVER)/?.lua"
+LUAROCKS_RUN_CMD = $(LUA_RUN) $(HOST_DIR)/usr/bin/luarocks
 
 define LUAROCKS_FINALIZE_TARGET
        rm -rf $(TARGET_DIR)/usr/lib/luarocks
index 83f338efd5675bc8bd5c6d0d54f78aa3a9e4ac69..da5c912c8138e8599ee5cc5853e4a86a6f8247cc 100644 (file)
@@ -49,7 +49,7 @@ $(2)_DEPENDENCIES     += host-luarocks luainterpreter
 ifndef $(2)_EXTRACT_CMDS
 define $(2)_EXTRACT_CMDS
        cd $$($(2)_DIR)/.. && \
-               $$(LUAROCKS_RUN) unpack --force $$(DL_DIR)/$$($(2)_SOURCE)
+               $$(LUAROCKS_RUN_ENV) $$(LUAROCKS_RUN_CMD) unpack --force $$(DL_DIR)/$$($(2)_SOURCE)
 endef
 endif
 
@@ -58,8 +58,8 @@ endif
 #
 ifndef $(2)_INSTALL_TARGET_CMDS
 define $(2)_INSTALL_TARGET_CMDS
-       cd $$($(2)_SRCDIR) && \
-               $$(LUAROCKS_RUN) make --keep $$($(2)_ROCKSPEC) $$($(2)_BUILD_OPTS)
+       cd $$($(2)_SRCDIR) && $$(LUAROCKS_RUN_ENV) flock $$(TARGET_DIR) \
+               $$(LUAROCKS_RUN_CMD) make --keep $$($(2)_ROCKSPEC) $$($(2)_BUILD_OPTS)
 endef
 endif