Skip to contentSkip to conversation

ubus: new package

PATCH New Alexey Mednyy 3 participants 3 messages Oct 15, 2014 – Oct 27, 2014

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 ubus: new package

---
 package/Config.in                                  |  1 +
 ...c-dependency-Werror-off-build-examples-of.patch | 49 ++++++++++++++++++++++
 package/ubus/Config.in                             | 14 +++++++
 package/ubus/ubus-01-json-definition-fix.patch     | 27 ++++++++++++
 package/ubus/ubus.mk                               | 28 +++++++++++++
 5 files changed, 119 insertions(+)
 create mode 100644 package/ubus/0001-fixed-json-c-dependency-Werror-off-build-examples-of.patch
 create mode 100644 package/ubus/Config.in
 create mode 100644 package/ubus/ubus-01-json-definition-fix.patch
 create mode 100644 package/ubus/ubus.mk
package/Config.in +1 -0
index 19bb9bf..16d4901 100644
@@ -896,6 +896,7 @@ menu "Other"
 	source "package/startup-notification/Config.in"
 	source "package/tz/Config.in"
 	source "package/tzdata/Config.in"
+	source "package/ubus/Config.in"
 endmenu
 
 menu "Security"
package/ubus/0001-fixed-json-c-dependency-Werror-off-build-examples-of.patch new file +49 -0

49 lines not on this page · raw message

package/ubus/Config.in new file +14 -0
new file mode 100644
index 0000000..b0f5de9
@@ -0,0 +1,14 @@
+config BR2_PACKAGE_UBUS
+	bool "ubus"
+	select BR2_PACKAGE_LIBUBOX
+	select BR2_PACKAGE_JSON_C
+	depends on !BR2_PREFER_STATIC_LIB
+	help
+	  OpenWrt micro bus architecture, project
+	  provide communication between various 
+	  daemons and applications.
+
+	  http://wiki.openwrt.org/doc/techref/ubus
+
+comment "ubus needs toolchain w/ dynamic library"
+	depends on BR2_PREFER_STATIC_LIB
package/ubus/ubus-01-json-definition-fix.patch new file +27 -0
new file mode 100644
index 0000000..50f9096
@@ -0,0 +1,27 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index cb2f420..86c4c4d 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -25,10 +25,20 @@ TARGET_LINK_LIBRARIES(ubus ubox)
+ ADD_EXECUTABLE(ubusd ubusd.c ubusd_id.c ubusd_obj.c ubusd_proto.c ubusd_event.c)
+ TARGET_LINK_LIBRARIES(ubusd ubox)
+ 
+-find_library(json NAMES json-c json)
++
++find_package(PkgConfig)
++PKG_CHECK_MODULES(JSONC json-c)
++IF(JSONC_FOUND)
++  ADD_DEFINITIONS(-DJSONC)
++  INCLUDE_DIRECTORIES(${JSONC_INCLUDE_DIRS})
++ENDIF()
++
+ ADD_EXECUTABLE(cli cli.c)
+ SET_TARGET_PROPERTIES(cli PROPERTIES OUTPUT_NAME ubus)
+-TARGET_LINK_LIBRARIES(cli ubus ubox blobmsg_json ${json})
++TARGET_LINK_LIBRARIES(cli ubus ubox blobmsg_json)
++IF(JSONC_FOUND)
++  TARGET_LINK_LIBRARIES(cli ${JSONC_LIBRARIES})
++ENDIF()
+ 
+ ADD_SUBDIRECTORY(lua)
+ ADD_SUBDIRECTORY(examples)
package/ubus/ubus.mk new file +28 -0
new file mode 100644
index 0000000..7728a0c
@@ -0,0 +1,28 @@
+################################################################################
+#
+# UBUS
+#
+################################################################################
+
+UBUS_VERSION = 4c4f35cf2230d70b9ddd87638ca911e8a563f2f3
+UBUS_SITE = git://nbd.name/luci2/ubus.git
+UBUS_LICENSE = LGPLv2.1
+UBUS_DEPENDENCIES = json-c libubox
+
+ifeq ($(BR2_PACKAGE_LUA_5_1),y)
+UBUS_DEPENDENCIES += lua
+UBUS_CONF_OPTS += -DLUAPATH=$(STAGING_DIR)/usr/lib/lua/5.1 \
+	-DLUA_CFLAGS=-I$(STAGING_DIR)/usr/include \
+	-DBUILD_LUA=ON
+else
+UBUS_CONF_OPTS += -DBUILD_LUA=OFF
+endif
+
+ifeq ($(BR2_PACKAGE_SYSTEMD),y)
+UBUS_DEPENDENCIES += systemd
+UBUS_CONF_OPTS += -DENABLE_SYSTEMD=ON
+else
+UBUS_CONF_OPTS += -DENABLE_SYSTEMD=OFF
+endif
+
+$(eval $(cmake-package))
Signature · 1 line
1.9.1
#1 lore raw

PATCH v4 1/1 ubus: new package

Alexey, All,

On 2014-10-15 18:10 +0400, Alexey Mednyy spake thusly:

Quoted 12 lines
---
 package/Config.in                                  |  1 +
 ...c-dependency-Werror-off-build-examples-of.patch | 49 ++++++++++++++++++++++
 package/ubus/Config.in                             | 14 +++++++
 package/ubus/ubus-01-json-definition-fix.patch     | 27 ++++++++++++
 package/ubus/ubus.mk                               | 28 +++++++++++++
 5 files changed, 119 insertions(+)
 create mode 100644 package/ubus/0001-fixed-json-c-dependency-Werror-off-build-examples-of.patch
 create mode 100644 package/ubus/Config.in
 create mode 100644 package/ubus/ubus-01-json-definition-fix.patch
 create mode 100644 package/ubus/ubus.mk

Please, be consistent in the naming of the patches. The correct naming
is: NNNN-title.patch

So, your 0001 patch is correctly named, but your ubus-01 should be something like: 0002-fix-json-definition.patch

Anyway, those two patches are incorrect (IMHO). I'd prefer you split them in semantically separated patches:
- one to remove Werror
- one to disable examples
- one to fix cjson dependency
- one to fix json definition

Maybe patches 3 and 4 could be squashed into a single patch, since they both deal with some json stuff (but one is about 'cjson', the other about just 'json', so I don't know; exercise your neurons! ;-) )

[--SNIP--]

package/ubus/Config.in line 5

Quoted 11 lines
package/ubus/Config.in new file +5 -0
new file mode 100644
index 0000000..b0f5de9
@@ -0,0 +1,14 @@
+config BR2_PACKAGE_UBUS
+	bool "ubus"
+	select BR2_PACKAGE_LIBUBOX
+	select BR2_PACKAGE_JSON_C
+	depends on !BR2_PREFER_STATIC_LIB

Unless ubus itself requires shared libraries, I'd state that the dependencies is inherited from libubox:

depends on !BR2_PREFER_STATIC_LIB # libubox

Quoted 6 lines
package/ubus/ubus.mk new file +0 -0
new file mode 100644
index 0000000..7728a0c

package/ubus/ubus.mk line 8

Quoted 8 lines
package/ubus/ubus.mk new file +8 -0
@@ -0,0 +1,28 @@
+################################################################################
+#
+# UBUS
+#
+################################################################################
+
+UBUS_VERSION = 4c4f35cf2230d70b9ddd87638ca911e8a563f2f3
+UBUS_SITE = git://nbd.name/luci2/ubus.git

We prefer http URLs, because the git protocol is often blocked by enterprise firewalls.

Unfortunately, it looks like there is no http access to that repository. Sigh... :-(

package/ubus/ubus.mk line 9

Quoted 1 line
package/ubus/ubus.mk new file +1 -0
+UBUS_LICENSE = LGPLv2.1

Indeed, that's LGPLv2.1, there is no 'or later'.
Also, there is no license file.

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#2 lore raw

PATCH v4 1/1 ubus: new package

In reply to Alexey Mednyy

Dear Alexey Mednyy,

Quoted 3 lines · Alexey Mednyy
 ...c-dependency-Werror-off-build-examples-of.patch | 49 ++++++++++++++++++++++
 package/ubus/Config.in                             | 14 +++++++
 package/ubus/ubus-01-json-definition-fix.patch     | 27 ++++++++++++

Your package does not build, as the two patches you've put in package/ubus/ conflict with each other:

Quoted 1 line
Quoted 1 line
Quoted 1 line

ubus 4c4f35cf2230d70b9ddd87638ca911e8a563f2f3 Patching

Applying 0001-fixed-json-c-dependency-Werror-off-build-examples-of.patch using patch:
patching file CMakeLists.txt

Applying ubus-01-json-definition-fix.patch using patch:
patching file CMakeLists.txt
Hunk #1 FAILED at 25.
1 out of 1 hunk FAILED -- saving rejects to file CMakeLists.txt.rej
Patch failed! Please fix ubus-01-json-definition-fix.patch!
make: *** [/home/thomas/projets/buildroot/output/build/ubus-4c4f35cf2230d70b9ddd87638ca911e8a563f2f3/.stamp_patched] Erreur 1

The two patches aren't identical, and I don't know which one to choose.

Quoted 20 lines
package/ubus/0001-fixed-json-c-dependency-Werror-off-build-examples-of.patch new file +14 -0
new file mode 100644
index 0000000..9c46a63
@@ -0,0 +1,49 @@
+From ea67d1fc6621abee5451e343e2d1a2303b4176f9 Mon Sep 17 00:00:00 2001
+From: Alexey Mednyy <[email protected]>
+Date: Wed, 15 Oct 2014 03:58:17 +0400
+Subject: [PATCH 1/1] fixed json-c dependency, Werror-off, build examples-off
+
+Signed-off-by: Alexey Mednyy <[email protected]>
+---
+ CMakeLists.txt | 14 ++++++++++----
+ 1 file changed, 10 insertions(+), 4 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index cb2f420..bd47c37 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt

package/ubus/0001-fixed-json-c-dependency-Werror-off-build-examples-of.patch line 24

Quoted 10 lines
package/ubus/0001-fixed-json-c-dependency-Werror-off-build-examples-of.patch new file +10 -0
+@@ -1,10 +1,10 @@
+ cmake_minimum_required(VERSION 2.6)
+ 
+ PROJECT(ubus C)
+-ADD_DEFINITIONS(-Os -Wall -Werror --std=gnu99 -g3 -Wmissing-declarations)
++ADD_DEFINITIONS(-Os -Wall --std=gnu99 -g3 -Wmissing-declarations)
+ 
+ OPTION(BUILD_LUA "build Lua plugin" ON)
+-OPTION(BUILD_EXAMPLES "build examples" ON)
++OPTION(BUILD_EXAMPLES "build examples" OFF)

This part is not needed, as the cmake-package infrastructure now passes -DBUILD_EXAMPLES=OFF (this is a recent change).

package/ubus/ubus.mk line 3

Quoted 9 lines
package/ubus/ubus.mk new file +3 -0
new file mode 100644
index 0000000..7728a0c
@@ -0,0 +1,28 @@
+################################################################################
+#
+# UBUS

ubus, in small letters.

Quoted 15 lines
package/ubus/ubus.mk new file +15 -0
+#
+################################################################################
+
+UBUS_VERSION = 4c4f35cf2230d70b9ddd87638ca911e8a563f2f3
+UBUS_SITE = git://nbd.name/luci2/ubus.git
+UBUS_LICENSE = LGPLv2.1
+UBUS_DEPENDENCIES = json-c libubox
+
+ifeq ($(BR2_PACKAGE_LUA_5_1),y)
+UBUS_DEPENDENCIES += lua
+UBUS_CONF_OPTS += -DLUAPATH=$(STAGING_DIR)/usr/lib/lua/5.1 \
+	-DLUA_CFLAGS=-I$(STAGING_DIR)/usr/include \
+	-DBUILD_LUA=ON
+else
+UBUS_CONF_OPTS += -DBUILD_LUA=OFF

package/ubus/ubus.mk line 28

Quoted 10 lines
package/ubus/ubus.mk new file +10 -0
+endif
+
+ifeq ($(BR2_PACKAGE_SYSTEMD),y)
+UBUS_DEPENDENCIES += systemd
+UBUS_CONF_OPTS += -DENABLE_SYSTEMD=ON
+else
+UBUS_CONF_OPTS += -DENABLE_SYSTEMD=OFF
+endif
+
+$(eval $(cmake-package))

Other than that, looks good to me. Can you resubmit an updated version that takes into account those comments?

In the mean time, I'll mark your patch as "Changes Requested" in our patch tracking system.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com