Skip to contentSkip to conversation

package/lua-augeas: new package

PATCH Superseded Herve Codina 3 participants 5 messages Oct 1, 2021 – Oct 4, 2021

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/lua-augeas: new package

The lua-augeas package provides a Lua binding for augeas

https://github.com/ncopa/lua-augeas

Based on initial work from Nicolas Carrier <[email protected]>

---
 DEVELOPERS                                    |  6 ++++
 package/Config.in                             |  1 +
 package/lua-augeas/Config.in                  | 10 +++++++
 package/lua-augeas/lua-augeas.hash            |  3 ++
 package/lua-augeas/lua-augeas.mk              | 30 +++++++++++++++++++
 .../testing/tests/package/test_lua_augeas.py  | 27 +++++++++++++++++
 6 files changed, 77 insertions(+)
 create mode 100644 package/lua-augeas/Config.in
 create mode 100644 package/lua-augeas/lua-augeas.hash
 create mode 100644 package/lua-augeas/lua-augeas.mk
 create mode 100644 support/testing/tests/package/test_lua_augeas.py
DEVELOPERS +6 -0
index 1f977190ab..81b84f8e3d 100644
@@ -1148,6 +1148,10 @@ F:	package/sysrepo/
 N:	Henrique Camargo <[email protected]>
 F:	package/json-glib/
 
+N:	Hervé Codina <[email protected]>
+F:	package/lua-augeas/
+F:	support/testing/tests/package/test_lua_augeas.py
+
 N:	Hiroshi Kawashima <[email protected]>
 F:	package/gauche/
 F:	package/gmrender-resurrect/
@@ -1980,10 +1984,12 @@ F:	configs/galileo_defconfig
 
 N:	Nicolas Carrier <[email protected]>
 F:	package/bmap-tools/
+F:	package/lua-augeas/
 F:	package/php-xdebug/
 F:	package/python-augeas/
 F:	package/python-flask-expects-json/
 F:	package/python-git/
+F:	support/testing/tests/package/test_lua_augeas.py
 F:	support/testing/tests/package/sample_bmap_tools.sh
 F:	support/testing/tests/package/sample_python_augeas.py
 F:	support/testing/tests/package/sample_python_flask_expects_json.py
package/Config.in +1 -0
index 2f83c87582..d4743fb9d1 100644
@@ -659,6 +659,7 @@ menu "Lua libraries/modules"
 	source "package/lpty/Config.in"
 	source "package/lrandom/Config.in"
 	source "package/lsqlite3/Config.in"
+	source "package/lua-augeas/Config.in"
 	source "package/lua-basexx/Config.in"
 	source "package/lua-binaryheap/Config.in"
 	source "package/lua-bit32/Config.in"
package/lua-augeas/Config.in new file +10 -0
new file mode 100644
index 0000000000..ed07da5426
@@ -0,0 +1,10 @@
+config BR2_PACKAGE_LUA_AUGEAS
+	bool "lua-augeas"
+	depends on BR2_PACKAGE_AUGEAS
+	help
+	  Lua binding for augeas library
+
+	  https://github.com/ncopa/lua-augeas
+
+comment "lua-augeas needs augeas"
+	depends on !BR2_PACKAGE_AUGEAS
\ No newline at end of file
package/lua-augeas/lua-augeas.hash new file +3 -0
new file mode 100644
index 0000000000..8497c48dc6
@@ -0,0 +1,3 @@
+# Locally computed:
+sha256 694fe887eebac27b558c9695042405f70a86382e92916094e7ba5f411673fbc1  lua-augeas-a6eace5116d1a711218a7c9086a4e3c4db88ee57.tar.gz
+sha256 1f5c5ee5da981332b7f73cc5a59af660b03104279e2aa21b6b86890430c3eff0  COPYRIGHT
package/lua-augeas/lua-augeas.mk new file +30 -0
new file mode 100644
index 0000000000..e1cecd7351
@@ -0,0 +1,30 @@
+################################################################################
+#
+# lua-augeas
+#
+################################################################################
+
+LUA_AUGEAS_VERSION = a6eace5116d1a711218a7c9086a4e3c4db88ee57
+LUA_AUGEAS_LICENSE = MIT
+LUA_AUGEAS_LICENSE_FILES = COPYRIGHT
+LUA_AUGEAS_SITE = $(call github,ncopa,lua-augeas,$(LUA_AUGEAS_VERSION))
+LUA_AUGEAS_DEPENDENCIES = luainterpreter augeas host-pkgconf
+
+LUA_AUGEAS_CONF_OPTS= \
+	PKGCONFIG="$(PKG_CONFIG_HOST_BINARY)" \
+	LDFLAGS="$(LDFLAGS)" \
+	LUA_VERSION="$(LUAINTERPRETER_ABIVER)" \
+	INSTALL_CMOD="/usr/lib/lua/$(LUAINTERPRETER_ABIVER)" \
+	LUA_CFLAGS=""
+
+define LUA_AUGEAS_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE1) -C $(@D) \
+		$(LUA_AUGEAS_CONF_OPTS) all
+endef
+
+define LUA_AUGEAS_INSTALL_TARGET_CMDS
+	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE1) -C $(@D) \
+		$(LUA_AUGEAS_CONF_OPTS) DESTDIR="$(TARGET_DIR)" install
+endef
+
+$(eval $(generic-package))
support/testing/tests/package/test_lua_augeas.py new file +27 -0
new file mode 100644
index 0000000000..2a612b6d32
@@ -0,0 +1,27 @@
+from tests.package.test_lua import TestLuaBase
+
+
+class TestLuaLuaAugeas(TestLuaBase):
+    config = TestLuaBase.config + \
+        """
+        BR2_PACKAGE_LUA=y
+        BR2_PACKAGE_AUGEAS=y
+        BR2_PACKAGE_LUA_AUGEAS=y
+        """
+
+    def test_run(self):
+        self.login()
+        self.module_test("augeas")
+
+
+class TestLuajitLuaAugeas(TestLuaBase):
+    config = TestLuaBase.config + \
+        """
+        BR2_PACKAGE_LUAJIT=y
+        BR2_PACKAGE_AUGEAS=y
+        BR2_PACKAGE_LUA_AUGEAS=y
+        """
+
+    def test_run(self):
+        self.login()
+        self.module_test("augeas")
Signature · 6 lines
2.31.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

Hello Hervé,

Quoted 7 lines · On Fri, 1 Oct 2021 14:53:01 +0200 Herve Codina <[email protected]>…

The lua-augeas package provides a Lua binding for augeas

https://github.com/ncopa/lua-augeas

Based on initial work from Nicolas Carrier <[email protected]>

Thanks!

package/lua-augeas/Config.in line 3

Quoted 9 lines
package/lua-augeas/Config.in new file +3 -0
new file mode 100644
index 0000000000..ed07da5426
@@ -0,0 +1,10 @@
+config BR2_PACKAGE_LUA_AUGEAS
+	bool "lua-augeas"
+	depends on BR2_PACKAGE_AUGEAS

I think a "select" here would be better. I looked at several other package/lua-*/Config.in, and most of the time we select the libraries that they need.

Of course, it means you would have to replicate the "depends on" of package/augeas/Config.in, but that's not a big deal.

package/lua-augeas/Config.in line 10

Quoted 8 lines
package/lua-augeas/Config.in new file +7 -0
+	help
+	  Lua binding for augeas library
+
+	  https://github.com/ncopa/lua-augeas
+
+comment "lua-augeas needs augeas"
+	depends on !BR2_PACKAGE_AUGEAS
\ No newline at end of file

Add a new line at the end of the file, and obviously update this comment.

Quoted 15 lines
package/lua-augeas/lua-augeas.hash new file +3 -0
new file mode 100644
index 0000000000..8497c48dc6
@@ -0,0 +1,3 @@
+# Locally computed:
+sha256 694fe887eebac27b558c9695042405f70a86382e92916094e7ba5f411673fbc1  lua-augeas-a6eace5116d1a711218a7c9086a4e3c4db88ee57.tar.gz
+sha256 1f5c5ee5da981332b7f73cc5a59af660b03104279e2aa21b6b86890430c3eff0  COPYRIGHT
package/lua-augeas/lua-augeas.mk new file +0 -0
new file mode 100644
index 0000000000..e1cecd7351

package/lua-augeas/lua-augeas.mk line 10

Quoted 10 lines
package/lua-augeas/lua-augeas.mk new file +10 -0
@@ -0,0 +1,30 @@
+################################################################################
+#
+# lua-augeas
+#
+################################################################################
+
+LUA_AUGEAS_VERSION = a6eace5116d1a711218a7c9086a4e3c4db88ee57
+LUA_AUGEAS_LICENSE = MIT
+LUA_AUGEAS_LICENSE_FILES = COPYRIGHT
+LUA_AUGEAS_SITE = $(call github,ncopa,lua-augeas,$(LUA_AUGEAS_VERSION))

Please put the SITE variable below the VERSION. There's no strict rule, but we tend to always have VERSION/SITE/SOURCE first and grouped together, and LICENSE/LICENSE_FILES afterwards.

package/lua-augeas/lua-augeas.mk line 15

Quoted 5 lines
package/lua-augeas/lua-augeas.mk new file +5 -0
+LUA_AUGEAS_DEPENDENCIES = luainterpreter augeas host-pkgconf
+
+LUA_AUGEAS_CONF_OPTS= \
+	PKGCONFIG="$(PKG_CONFIG_HOST_BINARY)" \
+	LDFLAGS="$(LDFLAGS)" \

$(LDFLAGS) doesn't exist in Buildroot. And LDFLAGS is already passed as part of $(TARGET_CONFIGURE_OPTS).

package/lua-augeas/lua-augeas.mk line 18

Quoted 3 lines
package/lua-augeas/lua-augeas.mk new file +3 -0
+	LUA_VERSION="$(LUAINTERPRETER_ABIVER)" \
+	INSTALL_CMOD="/usr/lib/lua/$(LUAINTERPRETER_ABIVER)" \
+	LUA_CFLAGS=""

LUA_CFLAGS is needed ?

package/lua-augeas/lua-augeas.mk line 20

Quoted 2 lines
package/lua-augeas/lua-augeas.mk new file +2 -0
+define LUA_AUGEAS_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE1) -C $(@D) \

is $(MAKE1) needed? This project has a single C source file, it would be challenging to have parallel build issues, no?

package/lua-augeas/lua-augeas.mk line 26

Quoted 5 lines
package/lua-augeas/lua-augeas.mk new file +5 -0
+		$(LUA_AUGEAS_CONF_OPTS) all
+endef
+
+define LUA_AUGEAS_INSTALL_TARGET_CMDS
+	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE1) -C $(@D) \

Same question here.

package/lua-augeas/lua-augeas.mk line 30

Quoted 4 lines
package/lua-augeas/lua-augeas.mk new file +4 -0
+		$(LUA_AUGEAS_CONF_OPTS) DESTDIR="$(TARGET_DIR)" install
+endef
+
+$(eval $(generic-package))

Thanks!

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw

Hello,

On Fri, 1 Oct 2021 15:26:10 +0200
Thomas Petazzoni <[email protected]> wrote:

[...]

Quoted 14 lines

package/lua-augeas/Config.in line 3

Quoted 9 lines
package/lua-augeas/Config.in new file +3 -0
new file mode 100644
index 0000000000..ed07da5426
@@ -0,0 +1,10 @@
+config BR2_PACKAGE_LUA_AUGEAS
+	bool "lua-augeas"
+	depends on BR2_PACKAGE_AUGEAS  

I think a "select" here would be better. I looked at several other package/lua-*/Config.in, and most of the time we select the libraries that they need.

Quoted 2 lines

Of course, it means you would have to replicate the "depends on" of package/augeas/Config.in, but that's not a big deal.

I used the same dependency construction as the one present in python-augeas (python binding for augeas).
Same kind of binding, same kind of dependency.

I can change to "select" here if you prefer.

Quoted 12 lines

package/lua-augeas/Config.in line 10

Quoted 9 lines
package/lua-augeas/Config.in new file +7 -0
+	help
+	  Lua binding for augeas library
+
+	  https://github.com/ncopa/lua-augeas
+
+comment "lua-augeas needs augeas"
+	depends on !BR2_PACKAGE_AUGEAS
\ No newline at end of file  

Add a new line at the end of the file, and obviously update this comment.

Oups, will be fixed in v2.

Quoted 1 line

[...]

Quoted 8 lines
Quoted 8 lines

+++ b/package/lua-augeas/lua-augeas.mk

package/lua-augeas/Config.in new file +6 -0
@@ -0,0 +1,30 @@
+################################################################################
+#
+# lua-augeas
+#
+################################################################################
+
Quoted 8 lines

package/lua-augeas/Config.in line 10

Quoted 4 lines
package/lua-augeas/Config.in new file +4 -0
+LUA_AUGEAS_VERSION = a6eace5116d1a711218a7c9086a4e3c4db88ee57
+LUA_AUGEAS_LICENSE = MIT
+LUA_AUGEAS_LICENSE_FILES = COPYRIGHT
+LUA_AUGEAS_SITE = $(call github,ncopa,lua-augeas,$(LUA_AUGEAS_VERSION))  

Please put the SITE variable below the VERSION. There's no strict rule, but we tend to always have VERSION/SITE/SOURCE first and grouped together, and LICENSE/LICENSE_FILES afterwards.

Ok, will be fixed in v2.

Quoted 9 lines

package/lua-augeas/Config.in line 15

Quoted 6 lines
package/lua-augeas/Config.in new file +5 -0
+LUA_AUGEAS_DEPENDENCIES = luainterpreter augeas host-pkgconf
+
+LUA_AUGEAS_CONF_OPTS= \
+	PKGCONFIG="$(PKG_CONFIG_HOST_BINARY)" \
+	LDFLAGS="$(LDFLAGS)" \  

$(LDFLAGS) doesn't exist in Buildroot. And LDFLAGS is already passed as part of $(TARGET_CONFIGURE_OPTS).

Yes LDFLAGS is passed by TARGET_CONFIGURE_OPTS and present in environment when make is called.

But, in lua_augeas makefile, we have:
LDFLAGS += -L/lib

With LDFLAGS in env, make can change LDFLAGS value to add '-L/lib'
and this lead to a compilation failure.
/home/hcodina/project/orolia/dev/buildroot/output/host/bin/arm-linux-gcc -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE - D_FILE_OFFSET_BITS=64 -Os -g0 -D_FORTIFY_SOURCE=1 -fPIC -DVERSION=\"0.1.2\" -L/lib -o augeas.so -fPIC -shared laugeas.o -L/home/hcodina/project/orolia/dev/buildroot/output/host/bin/../arm-buildroot-linux-gnueabi/sysroot/usr/lib -laugeas
arm-linux-gcc: ERROR: unsafe header/library path used in cross-compilation: '-L/lib'
make[2]: *** [Makefile:38: augeas.so] Error 1

The idea to have 'LDFLAGS="$(LDFLAGS)"' in LUA_AUGEAS_CONF_OPTS was to set LDFLAGS in make command line parameter using LDFLAGS value from environment (ie the one buildroot set). And so, as makefile ordinary assignments are ignored by make when the variable is set with command argument, avoid it to add '-L/lib'.

If this makes sense, I can add the following comment in v2:
LDFLAGS=$(LDFLAGS) is present to pass LDFLAGS from environment to command line.
With LDFLAGS in command line, related ordinary asignment present in the makefile are ignored and so lua-augeas makefile cannot not add '-L/lib' to this value.

Or I can simply add a patch to remove the incorrect line in lua-augeas makefile and remove 'LDFLAGS=$(LDFLAGS)' from make command line.

Which solution do you prefer ?

Quoted 6 lines

package/lua-augeas/Config.in line 18

Quoted 4 lines
package/lua-augeas/Config.in new file +3 -0
+	LUA_VERSION="$(LUAINTERPRETER_ABIVER)" \
+	INSTALL_CMOD="/usr/lib/lua/$(LUAINTERPRETER_ABIVER)" \
+	LUA_CFLAGS=""  

LUA_CFLAGS is needed ?

No, LUA_CFLAGS is not needed.
Will be removed in v2.

Quoted 6 lines

package/lua-augeas/Config.in line 20

Quoted 3 lines
package/lua-augeas/Config.in new file +2 -0
+define LUA_AUGEAS_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE1) -C $(@D) \  

is $(MAKE1) needed? This project has a single C source file, it would be challenging to have parallel build issues, no?

Changed to $(MAKE)

Quoted 8 lines

package/lua-augeas/Config.in line 25

Quoted 6 lines
package/lua-augeas/Config.in new file +5 -0
+		$(LUA_AUGEAS_CONF_OPTS) all
+endef
+
+define LUA_AUGEAS_INSTALL_TARGET_CMDS
+	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE1) -C $(@D) \  

Same question here.

Same change :)

Quoted 9 lines

package/lua-augeas/Config.in line 29

Quoted 5 lines
package/lua-augeas/Config.in new file +4 -0
+		$(LUA_AUGEAS_CONF_OPTS) DESTDIR="$(TARGET_DIR)" install
+endef
+
+$(eval $(generic-package))  

Thanks!

Thomas

Thanks for the review

Hervé

Signature · 7 lines
Hervé Codina, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#3 lore raw
Quoted 21 lines · Herve Codina

Hello,

On Fri, 1 Oct 2021 15:26:10 +0200
Thomas Petazzoni <[email protected]> wrote:

[...]

Quoted 14 lines

package/lua-augeas/Config.in line 3

Quoted 9 lines
package/lua-augeas/Config.in new file +3 -0
new file mode 100644
index 0000000000..ed07da5426
@@ -0,0 +1,10 @@
+config BR2_PACKAGE_LUA_AUGEAS
+	bool "lua-augeas"
+	depends on BR2_PACKAGE_AUGEAS

I think a "select" here would be better. I looked at several other package/lua-*/Config.in, and most of the time we select the libraries that they need.

Quoted 8 lines
Quoted 2 lines

Of course, it means you would have to replicate the "depends on" of package/augeas/Config.in, but that's not a big deal.

I used the same dependency construction as the one present in python-augeas (python binding for augeas).
Same kind of binding, same kind of dependency.

I can change to "select" here if you prefer.

Yes, select is preferred. I don't know why it was not done like that for
python-augeas.

[snip]

Quoted 6 lines

If this makes sense, I can add the following comment in v2:
LDFLAGS=$(LDFLAGS) is present to pass LDFLAGS from environment to command line.
With LDFLAGS in command line, related ordinary asignment present in the makefile are ignored and so lua-augeas makefile cannot not add '-L/lib' to this value.

Yes please add that comment. It can be in the commit message or in the .mk
file, up to you.

Regards,
Arnout

Quoted 45 lines

Or I can simply add a patch to remove the incorrect line in lua-augeas makefile and remove 'LDFLAGS=$(LDFLAGS)' from make command line.

Which solution do you prefer ?

Quoted 6 lines

package/lua-augeas/Config.in line 6

Quoted 4 lines
package/lua-augeas/Config.in new file +3 -0
+	LUA_VERSION="$(LUAINTERPRETER_ABIVER)" \
+	INSTALL_CMOD="/usr/lib/lua/$(LUAINTERPRETER_ABIVER)" \
+	LUA_CFLAGS=""

LUA_CFLAGS is needed ?

No, LUA_CFLAGS is not needed.
Will be removed in v2.

Quoted 6 lines

package/lua-augeas/Config.in line 8

Quoted 3 lines
package/lua-augeas/Config.in new file +2 -0
+define LUA_AUGEAS_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE1) -C $(@D) \

is $(MAKE1) needed? This project has a single C source file, it would be challenging to have parallel build issues, no?

Changed to $(MAKE)

Quoted 8 lines

package/lua-augeas/Config.in

Quoted 6 lines
package/lua-augeas/Config.in new file +5 -0
+		$(LUA_AUGEAS_CONF_OPTS) all
+endef
+
+define LUA_AUGEAS_INSTALL_TARGET_CMDS
+	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE1) -C $(@D) \

Same question here.

Same change :)

Quoted 8 lines

package/lua-augeas/Config.in

Quoted 5 lines
package/lua-augeas/Config.in new file +4 -0
+		$(LUA_AUGEAS_CONF_OPTS) DESTDIR="$(TARGET_DIR)" install
+endef
+
+$(eval $(generic-package))

Thanks!

Quoted 6 lines
Quoted 1 line

Thomas

Thanks for the review

Hervé

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#4 lore raw

Hi,

On Sun, 3 Oct 2021 12:30:08 +0200
Arnout Vandecappelle <[email protected]> wrote:

[...]

Quoted 4 lines
Quoted 1 line

I can change to "select" here if you prefer.

Yes, select is preferred. I don't know why it was not done like that for
python-augeas.

Will be changed to 'select' in v2

Quoted 11 lines

[snip]

Quoted 6 lines

If this makes sense, I can add the following comment in v2:
LDFLAGS=$(LDFLAGS) is present to pass LDFLAGS from environment to command line.
With LDFLAGS in command line, related ordinary asignment present in the makefile are ignored and so lua-augeas makefile cannot not add '-L/lib' to this value.

Yes please add that comment. It can be in the commit message or in the .mk
file, up to you.

Comment will be added in .mk in v2

Thanks for the review.

Hervé

Signature · 7 lines
Hervé Codina, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot