opkg: ignore empty fields in package lists
authorSteven Barth <cyrus@openwrt.org>
Mon, 14 Oct 2013 08:09:58 +0000 (08:09 +0000)
committerSteven Barth <cyrus@openwrt.org>
Mon, 14 Oct 2013 08:09:58 +0000 (08:09 +0000)
This is to work around issues with package list generators creating
empty fields in some environments.

Based on a patch by Paul Selkrik <pselkrik@isc.org>
Signed-off-by: Steven Barth <steven@midlink.org>
SVN-Revision: 38390

package/system/opkg/Makefile
package/system/opkg/patches/080-suppress-blank-package-fields.patch [new file with mode: 0644]

index 624f2ed..0669ddf 100644 (file)
@@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/version.mk
 PKG_NAME:=opkg
 PKG_REV:=618
 PKG_VERSION:=$(PKG_REV)
-PKG_RELEASE:=5
+PKG_RELEASE:=6
 
 PKG_SOURCE_PROTO:=svn
 PKG_SOURCE_VERSION:=$(PKG_REV)
diff --git a/package/system/opkg/patches/080-suppress-blank-package-fields.patch b/package/system/opkg/patches/080-suppress-blank-package-fields.patch
new file mode 100644 (file)
index 0000000..976b97d
--- /dev/null
@@ -0,0 +1,16 @@
+--- a/libopkg/parse_util.c
++++ b/libopkg/parse_util.c
+@@ -35,7 +35,12 @@ is_field(const char *type, const char *l
+ char *
+ parse_simple(const char *type, const char *line)
+ {
+-      return trim_xstrdup(line + strlen(type) + 1);
++      char *field = trim_xstrdup(line + strlen(type) + 1);
++      if (strlen(field) == 0) {
++              free(field);
++              return NULL;
++      }
++      return field;
+ }
+ /*