summaryrefslogtreecommitdiffhomepage
path: root/contrib
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2008-08-26 23:00:44 +0000
committerSteven Barth <steven@midlink.org>2008-08-26 23:00:44 +0000
commit91ba7c42f5b45614c9f4c803d09399f08a8e27b1 (patch)
tree21d1e1d67b3bee82eb123c0c5dbb274f2fcb6b59 /contrib
parent43b3217e5595acc91ff6d7614a5c21c88696fbcc (diff)
UCI API changes
Diffstat (limited to 'contrib')
-rw-r--r--contrib/package/luci/Makefile6
-rw-r--r--contrib/uci/patches/100-unknown-get.patch22
-rw-r--r--contrib/uci/patches/200-revised-lua-api.patch50
3 files changed, 35 insertions, 43 deletions
diff --git a/contrib/package/luci/Makefile b/contrib/package/luci/Makefile
index e8a1d3698..c26a845c9 100644
--- a/contrib/package/luci/Makefile
+++ b/contrib/package/luci/Makefile
@@ -148,12 +148,14 @@ endef
define Package/luci-uci
$(call Package/luci/libtemplate)
- DEPENDS+=+libuci-lua
+ DEPENDS+=+libuci
TITLE:=High-Level UCI API
endef
define Package/luci-uci/install
$(call Package/luci/install/template,$(1),libs/uci)
+ $(INSTALL_DIR) $(1)/usr/lib/lua
+ $(CP) $(PKG_BUILD_DIR)/contrib/uci/dist/usr/lib/lua/uci.so $(1)/usr/lib/lua
endef
@@ -632,7 +634,7 @@ ifneq ($(CONFIG_PACKAGE_luci-json),)
PKG_SELECTED_MODULES+=libs/json
endif
ifneq ($(CONFIG_PACKAGE_luci-uci),)
- PKG_SELECTED_MODULES+=libs/uci
+ PKG_SELECTED_MODULES+=libs/uci contrib/uci
endif
ifneq ($(CONFIG_PACKAGE_luci-sys),)
PKG_SELECTED_MODULES+=libs/sys
diff --git a/contrib/uci/patches/100-unknown-get.patch b/contrib/uci/patches/100-unknown-get.patch
deleted file mode 100644
index 2ad385a15..000000000
--- a/contrib/uci/patches/100-unknown-get.patch
+++ /dev/null
@@ -1,22 +0,0 @@
-Index: uci.git/list.c
-===================================================================
---- uci.git.orig/list.c 2008-08-26 12:31:34.000000000 +0200
-+++ uci.git/list.c 2008-08-26 21:09:10.000000000 +0200
-@@ -398,7 +398,7 @@
- e = uci_lookup_list(&ptr->p->sections, ptr->section);
-
- if (!e)
-- goto abort;
-+ goto notfound;
-
- ptr->last = e;
- ptr->s = uci_to_section(e);
-@@ -406,7 +406,7 @@
- if (ptr->option) {
- e = uci_lookup_list(&ptr->s->options, ptr->option);
- if (!e)
-- goto abort;
-+ goto notfound;
-
- ptr->o = uci_to_option(e);
- ptr->last = e;
diff --git a/contrib/uci/patches/200-revised-lua-api.patch b/contrib/uci/patches/200-revised-lua-api.patch
index 10894ac45..c31c1454c 100644
--- a/contrib/uci/patches/200-revised-lua-api.patch
+++ b/contrib/uci/patches/200-revised-lua-api.patch
@@ -1,7 +1,7 @@
Index: uci.git/lua/uci.c
===================================================================
--- uci.git.orig/lua/uci.c 2008-08-26 12:31:34.000000000 +0200
-+++ uci.git/lua/uci.c 2008-08-26 21:09:10.000000000 +0200
++++ uci.git/lua/uci.c 2008-08-27 00:30:46.000000000 +0200
@@ -25,6 +25,7 @@
#include <uci.h>
@@ -244,7 +244,19 @@ Index: uci.git/lua/uci.c
goto error;
uci_lookup_ptr(ctx, &ptr, NULL, false);
-@@ -323,7 +372,7 @@
+@@ -297,6 +346,11 @@
+ goto error;
+ }
+
++ if (!(ptr.flags & UCI_LOOKUP_COMPLETE)) {
++ err = UCI_ERR_NOTFOUND;
++ goto error;
++ }
++
+ err = UCI_OK;
+ e = ptr.last;
+ switch(e->type) {
+@@ -323,7 +377,7 @@
switch(err) {
default:
ctx->err = err;
@@ -253,7 +265,7 @@ Index: uci.git/lua/uci.c
/* fall through */
case UCI_ERR_NOTFOUND:
lua_pushnil(L);
-@@ -348,6 +397,7 @@
+@@ -348,6 +402,7 @@
static int
uci_lua_add(lua_State *L)
{
@@ -261,7 +273,7 @@ Index: uci.git/lua/uci.c
struct uci_section *s = NULL;
struct uci_package *p;
const char *package;
-@@ -355,9 +405,9 @@
+@@ -355,9 +410,9 @@
const char *name = NULL;
do {
@@ -274,7 +286,7 @@ Index: uci.git/lua/uci.c
if (!p)
break;
-@@ -374,11 +424,12 @@
+@@ -374,11 +429,12 @@
static int
uci_lua_delete(lua_State *L)
{
@@ -288,7 +300,7 @@ Index: uci.git/lua/uci.c
goto error;
err = uci_delete(ctx, &ptr);
-@@ -387,7 +438,7 @@
+@@ -387,7 +443,7 @@
if (s)
free(s);
if (err)
@@ -297,7 +309,7 @@ Index: uci.git/lua/uci.c
lua_pushboolean(L, (err == 0));
return 1;
}
-@@ -395,6 +446,7 @@
+@@ -395,6 +451,7 @@
static int
uci_lua_set(lua_State *L)
{
@@ -305,7 +317,7 @@ Index: uci.git/lua/uci.c
bool istable = false;
struct uci_ptr ptr;
int err = UCI_ERR_MEM;
-@@ -402,14 +454,14 @@
+@@ -402,14 +459,14 @@
int i, nargs;
nargs = lua_gettop(L);
@@ -323,7 +335,7 @@ Index: uci.git/lua/uci.c
/* Format: uci.set("p", "s", "o", "v") */
if (lua_istable(L, nargs)) {
if (lua_objlen(L, nargs) < 1)
-@@ -422,7 +474,7 @@
+@@ -422,7 +479,7 @@
ptr.value = luaL_checkstring(L, nargs);
}
break;
@@ -332,7 +344,7 @@ Index: uci.git/lua/uci.c
/* Format: uci.set("p", "s", "v") */
ptr.value = ptr.option;
ptr.option = NULL;
-@@ -433,17 +485,23 @@
+@@ -433,17 +490,23 @@
}
err = uci_lookup_ptr(ctx, &ptr, NULL, false);
@@ -359,7 +371,7 @@ Index: uci.git/lua/uci.c
if (istable) {
for (i = 2; i <= lua_objlen(L, nargs); i++) {
-@@ -458,7 +516,7 @@
+@@ -458,7 +521,7 @@
error:
if (err)
@@ -368,7 +380,7 @@ Index: uci.git/lua/uci.c
lua_pushboolean(L, (err == 0));
return 1;
}
-@@ -472,6 +530,7 @@
+@@ -472,6 +535,7 @@
static int
uci_lua_package_cmd(lua_State *L, enum pkg_cmd cmd)
{
@@ -376,7 +388,7 @@ Index: uci.git/lua/uci.c
struct uci_element *e, *tmp;
struct uci_ptr ptr;
char *s = NULL;
-@@ -479,10 +538,10 @@
+@@ -479,10 +543,10 @@
int nargs;
nargs = lua_gettop(L);
@@ -389,7 +401,7 @@ Index: uci.git/lua/uci.c
goto err;
uci_lookup_ptr(ctx, &ptr, NULL, false);
-@@ -562,16 +621,16 @@
+@@ -562,16 +626,16 @@
}
static void
@@ -409,7 +421,7 @@ Index: uci.git/lua/uci.c
if (!p)
return;
}
-@@ -596,6 +655,7 @@
+@@ -596,6 +660,7 @@
static int
uci_lua_changes(lua_State *L)
{
@@ -417,7 +429,7 @@ Index: uci.git/lua/uci.c
const char *package = NULL;
char **config = NULL;
int nargs;
-@@ -603,9 +663,9 @@
+@@ -603,9 +668,9 @@
nargs = lua_gettop(L);
switch(nargs) {
@@ -429,7 +441,7 @@ Index: uci.git/lua/uci.c
break;
default:
luaL_error(L, "invalid argument count");
-@@ -613,13 +673,13 @@
+@@ -613,13 +678,13 @@
lua_newtable(L);
if (package) {
@@ -445,7 +457,7 @@ Index: uci.git/lua/uci.c
}
}
-@@ -628,29 +688,53 @@
+@@ -628,29 +693,53 @@
}
static int
@@ -502,7 +514,7 @@ Index: uci.git/lua/uci.c
{ "load", uci_lua_load },
{ "unload", uci_lua_unload },
{ "get", uci_lua_get },
-@@ -663,25 +747,33 @@
+@@ -663,25 +752,33 @@
{ "revert", uci_lua_revert },
{ "changes", uci_lua_changes },
{ "foreach", uci_lua_foreach },