Browse Source

update opkg

RISCi_ATOM 2 years ago
parent
commit
328064ba15
35 changed files with 0 additions and 3841 deletions
  1. 0 130
      package/network/services/dnsmasq/patches/000-fix-servfail-handling.patch
  2. 0 47
      package/network/services/dnsmasq/patches/100-fix-dhcp-no-address-warning.patch
  3. 0 149
      package/network/services/dnsmasq/patches/120-dnsmasq-compile-time-option-NO_ID.patch
  4. 0 168
      package/system/opkg/patches/001-ship-pkg-m4.patch
  5. 0 37
      package/system/opkg/patches/002-no-shave.patch
  6. 0 20
      package/system/opkg/patches/004-host_cpu.patch
  7. 0 71
      package/system/opkg/patches/007-force_static.patch
  8. 0 41
      package/system/opkg/patches/009-remove-upgrade-all.patch
  9. 0 12
      package/system/opkg/patches/011-old-config-location.patch
  10. 0 23
      package/system/opkg/patches/012-strip-trailing-conffiles-whitespace.patch
  11. 0 15
      package/system/opkg/patches/014-errors-to-stderr.patch
  12. 0 317
      package/system/opkg/patches/020-avoid_getline.patch
  13. 0 10
      package/system/opkg/patches/030-fix-double-free.patch
  14. 0 31
      package/system/opkg/patches/040-wrap-descriptions-only-on-ttys.patch
  15. 0 169
      package/system/opkg/patches/050-add-case-insensitive-flag.patch
  16. 0 58
      package/system/opkg/patches/060-add-find-command.patch
  17. 0 719
      package/system/opkg/patches/070-use_external_gzip.patch
  18. 0 124
      package/system/opkg/patches/071-use_gzipped_pkg_list.patch
  19. 0 16
      package/system/opkg/patches/080-suppress-blank-package-fields.patch
  20. 0 11
      package/system/opkg/patches/090-suppress-blank-provides-field.patch
  21. 0 85
      package/system/opkg/patches/100-add-force-checksum.patch
  22. 0 50
      package/system/opkg/patches/110-upgrade.patch
  23. 0 91
      package/system/opkg/patches/200-usign_support.patch
  24. 0 70
      package/system/opkg/patches/210-add-force-signature.patch
  25. 0 812
      package/system/opkg/patches/220-drop-release-support.patch
  26. 0 192
      package/system/opkg/patches/230-drop_md5_support.patch
  27. 0 31
      package/system/opkg/patches/240-fix-force-checksum-for-sha256.patch
  28. 0 39
      package/system/opkg/patches/250-add-lists-dir-switch.patch
  29. 0 74
      package/system/opkg/patches/260-add-print-package-size.patch
  30. 0 11
      package/system/opkg/patches/270-fix-use-after-free.patch
  31. 0 73
      package/system/opkg/patches/280-call-prerm-and-postrm-scripts-on-upgrade.patch
  32. 0 61
      package/system/opkg/patches/290-clarify-download-errors.patch
  33. 0 19
      package/utils/f2fs-tools/patches/001-compile.patch
  34. 0 10
      package/utils/f2fs-tools/patches/010-include-byteswap-h.patch
  35. 0 55
      package/utils/f2fs-tools/patches/020-no_selinux.patch

+ 0 - 130
package/network/services/dnsmasq/patches/000-fix-servfail-handling.patch

@@ -1,130 +0,0 @@
-From 68f6312d4bae30b78daafcd6f51dc441b8685b1e Mon Sep 17 00:00:00 2001
-From: Baptiste Jonglez <git@bitsofnetworks.org>
-Date: Mon, 6 Feb 2017 21:09:11 +0000
-Subject: [PATCH] Stop treating SERVFAIL as a successful response from upstream
- servers.
-
-This effectively reverts most of 51967f9807 ("SERVFAIL is an expected
-error return, don't try all servers.") and 4ace25c5d6 ("Treat REFUSED (not
-SERVFAIL) as an unsuccessful upstream response").
-
-With the current behaviour, as soon as dnsmasq receives a SERVFAIL from an
-upstream server, it stops trying to resolve the query and simply returns
-SERVFAIL to the client.  With this commit, dnsmasq will instead try to
-query other upstream servers upon receiving a SERVFAIL response.
-
-According to RFC 1034 and 1035, the semantic of SERVFAIL is that of a
-temporary error condition.  Recursive resolvers are expected to encounter
-network or resources issues from time to time, and will respond with
-SERVFAIL in this case.  Similarly, if a validating DNSSEC resolver [RFC
-4033] encounters issues when checking signatures (unknown signing
-algorithm, missing signatures, expired signatures because of a wrong
-system clock, etc), it will respond with SERVFAIL.
-
-Note that all those behaviours are entirely different from a negative
-response, which would provide a definite indication that the requested
-name does not exist.  In our case, if an upstream server responds with
-SERVFAIL, another upstream server may well provide a positive answer for
-the same query.
-
-Thus, this commit will increase robustness whenever some upstream servers
-encounter temporary issues or are misconfigured.
-
-Quoting RFC 1034, Section 4.3.1. "Queries and responses":
-
-    If recursive service is requested and available, the recursive response
-    to a query will be one of the following:
-
-       - The answer to the query, possibly preface by one or more CNAME
-         RRs that specify aliases encountered on the way to an answer.
-
-       - A name error indicating that the name does not exist.  This
-         may include CNAME RRs that indicate that the original query
-	  name was an alias for a name which does not exist.
-
-       - A temporary error indication.
-
-Here is Section 5.2.3. of RFC 1034, "Temporary failures":
-
-    In a less than perfect world, all resolvers will occasionally be unable
-    to resolve a particular request.  This condition can be caused by a
-    resolver which becomes separated from the rest of the network due to a
-    link failure or gateway problem, or less often by coincident failure or
-    unavailability of all servers for a particular domain.
-
-And finally, RFC 1035 specifies RRCODE 2 for this usage, which is now more
-widely known as SERVFAIL (RFC 1035, Section 4.1.1. "Header section format"):
-
-    RCODE           Response code - this 4 bit field is set as part of
-                    responses.  The values have the following
-                    interpretation:
-                    (...)
-
-                    2               Server failure - The name server was
-                                    unable to process this query due to a
-                                    problem with the name server.
-
-For the DNSSEC-related usage of SERVFAIL, here is RFC 4033
-Section 5. "Scope of the DNSSEC Document Set and Last Hop Issues":
-
-    A validating resolver can determine the following 4 states:
-    (...)
-
-    Insecure: The validating resolver has a trust anchor, a chain of
-       trust, and, at some delegation point, signed proof of the
-       non-existence of a DS record.  This indicates that subsequent
-       branches in the tree are provably insecure.  A validating resolver
-       may have a local policy to mark parts of the domain space as
-       insecure.
-
-    Bogus: The validating resolver has a trust anchor and a secure
-       delegation indicating that subsidiary data is signed, but the
-       response fails to validate for some reason: missing signatures,
-       expired signatures, signatures with unsupported algorithms, data
-       missing that the relevant NSEC RR says should be present, and so
-       forth.
-    (...)
-
-    This specification only defines how security-aware name servers can
-    signal non-validating stub resolvers that data was found to be bogus
-    (using RCODE=2, "Server Failure"; see [RFC4035]).
-
-Notice the difference between a definite negative answer ("Insecure"
-state), and an indefinite error condition ("Bogus" state).  The second
-type of error may be specific to a recursive resolver, for instance
-because its system clock has been incorrectly set, or because it does not
-implement newer cryptographic primitives.  Another recursive resolver may
-succeed for the same query.
-
-There are other similar situations in which the specified behaviour is
-similar to the one implemented by this commit.
-
-For instance, RFC 2136 specifies the behaviour of a "requestor" that wants
-to update a zone using the DNS UPDATE mechanism.  The requestor tries to
-contact all authoritative name servers for the zone, with the following
-behaviour specified in RFC 2136, Section 4:
-
-    4.6. If a response is received whose RCODE is SERVFAIL or NOTIMP, or
-    if no response is received within an implementation dependent timeout
-    period, or if an ICMP error is received indicating that the server's
-    port is unreachable, then the requestor will delete the unusable
-    server from its internal name server list and try the next one,
-    repeating until the name server list is empty.  If the requestor runs
-    out of servers to try, an appropriate error will be returned to the
-    requestor's caller.
----
- src/forward.c | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
---- a/src/forward.c
-+++ b/src/forward.c
-@@ -853,7 +853,8 @@ void reply_query(int fd, int family, tim
-      we get a good reply from another server. Kill it when we've
-      had replies from all to avoid filling the forwarding table when
-      everything is broken */
--  if (forward->forwardall == 0 || --forward->forwardall == 1 || RCODE(header) != REFUSED)
-+  if (forward->forwardall == 0 || --forward->forwardall == 1 ||
-+      (RCODE(header) != REFUSED && RCODE(header) != SERVFAIL))
-     {
-       int check_rebind = 0, no_cache_dnssec = 0, cache_secure = 0, bogusanswer = 0;
- 

+ 0 - 47
package/network/services/dnsmasq/patches/100-fix-dhcp-no-address-warning.patch

@@ -1,47 +0,0 @@
---- a/src/dhcp.c
-+++ b/src/dhcp.c
-@@ -147,7 +147,7 @@ void dhcp_packet(time_t now, int pxe_fd)
-   ssize_t sz; 
-   int iface_index = 0, unicast_dest = 0, is_inform = 0;
-   int rcvd_iface_index;
--  struct in_addr iface_addr;
-+  struct in_addr iface_addr, *addrp = NULL;
-   struct iface_param parm;
- #ifdef HAVE_LINUX_NETWORK
-   struct arpreq arp_req;
-@@ -277,11 +277,9 @@ void dhcp_packet(time_t now, int pxe_fd)
-     {
-       ifr.ifr_addr.sa_family = AF_INET;
-       if (ioctl(daemon->dhcpfd, SIOCGIFADDR, &ifr) != -1 )
--	iface_addr = ((struct sockaddr_in *) &ifr.ifr_addr)->sin_addr;
--      else
- 	{
--	  my_syslog(MS_DHCP | LOG_WARNING, _("DHCP packet received on %s which has no address"), ifr.ifr_name);
--	  return;
-+	  addrp = &iface_addr;
-+	  iface_addr = ((struct sockaddr_in *) &ifr.ifr_addr)->sin_addr;
- 	}
-       
-       for (tmp = daemon->dhcp_except; tmp; tmp = tmp->next)
-@@ -300,7 +298,7 @@ void dhcp_packet(time_t now, int pxe_fd)
-       parm.relay_local.s_addr = 0;
-       parm.ind = iface_index;
-       
--      if (!iface_check(AF_INET, (struct all_addr *)&iface_addr, ifr.ifr_name, NULL))
-+      if (!iface_check(AF_INET, (struct all_addr *)addrp, ifr.ifr_name, NULL))
- 	{
- 	  /* If we failed to match the primary address of the interface, see if we've got a --listen-address
- 	     for a secondary */
-@@ -320,6 +318,12 @@ void dhcp_packet(time_t now, int pxe_fd)
- 	  complete_context(match.addr, iface_index, NULL, match.netmask, match.broadcast, &parm);
- 	}    
-       
-+      if (!addrp)
-+        {
-+          my_syslog(MS_DHCP | LOG_WARNING, _("DHCP packet received on %s which has no address"), ifr.ifr_name);
-+          return;
-+        }
-+
-       if (!iface_enumerate(AF_INET, &parm, complete_context))
- 	return;
- 

+ 0 - 149
package/network/services/dnsmasq/patches/120-dnsmasq-compile-time-option-NO_ID.patch

@@ -1,149 +0,0 @@
-From f6bea86c78ba9efbd01da3dd2fb18764ec806290 Mon Sep 17 00:00:00 2001
-From: Kevin Darbyshire-Bryant <kevin@darbyshire-bryant.me.uk>
-Date: Wed, 7 Sep 2016 09:35:07 +0100
-Subject: [PATCH] dnsmasq: compile time option NO_ID
-
-Some consider it good practice to obscure software version numbers to
-clients.  Compiling with -DNO_ID removes the *.bind info structure.
-This includes: version, author, copyright, cachesize, cache insertions,
-evictions, misses & hits, auth & servers.
-
-Signed-off-by: Kevin Darbyshire-Bryant <kevin@darbyshire-bryant.me.uk>
----
- src/cache.c   | 2 ++
- src/config.h  | 5 +++++
- src/dnsmasq.h | 4 ++++
- src/option.c  | 8 ++++++--
- src/rfc1035.c | 3 ++-
- 5 files changed, 19 insertions(+), 3 deletions(-)
-
---- a/src/cache.c
-+++ b/src/cache.c
-@@ -1290,6 +1290,7 @@ void cache_add_dhcp_entry(char *host_nam
- }
- #endif
- 
-+#ifndef NO_ID
- int cache_make_stat(struct txt_record *t)
- { 
-   static char *buff = NULL;
-@@ -1385,6 +1386,7 @@ int cache_make_stat(struct txt_record *t
-   *buff = len;
-   return 1;
- }
-+#endif
- 
- /* There can be names in the cache containing control chars, don't 
-    mess up logging or open security holes. */
---- a/src/config.h
-+++ b/src/config.h
-@@ -120,6 +120,8 @@ HAVE_LOOP
- HAVE_INOTIFY
-    use the Linux inotify facility to efficiently re-read configuration files.
- 
-+NO_ID
-+   Don't report *.bind CHAOS info to clients.
- NO_IPV6
- NO_TFTP
- NO_DHCP
-@@ -434,6 +436,9 @@ static char *compile_opts =
- "no-"
- #endif
- "DNSSEC "
-+#ifdef NO_ID
-+"no-ID "
-+#endif
- #ifndef HAVE_LOOP
- "no-"
- #endif
---- a/src/dnsmasq.h
-+++ b/src/dnsmasq.h
-@@ -286,6 +286,7 @@ struct naptr {
-   struct naptr *next;
- };
- 
-+#ifndef NO_ID
- #define TXT_STAT_CACHESIZE     1
- #define TXT_STAT_INSERTS       2
- #define TXT_STAT_EVICTIONS     3
-@@ -293,6 +294,7 @@ struct naptr {
- #define TXT_STAT_HITS          5
- #define TXT_STAT_AUTH          6
- #define TXT_STAT_SERVERS       7
-+#endif
- 
- struct txt_record {
-   char *name;
-@@ -1078,7 +1080,9 @@ void cache_add_dhcp_entry(char *host_nam
- struct in_addr a_record_from_hosts(char *name, time_t now);
- void cache_unhash_dhcp(void);
- void dump_cache(time_t now);
-+#ifndef NO_ID
- int cache_make_stat(struct txt_record *t);
-+#endif
- char *cache_get_name(struct crec *crecp);
- char *cache_get_cname_target(struct crec *crecp);
- struct crec *cache_enumerate(int init);
---- a/src/option.c
-+++ b/src/option.c
-@@ -657,7 +657,8 @@ static int atoi_check8(char *a, int *res
-   return 1;
- }
- #endif
--	
-+
-+#ifndef NO_ID
- static void add_txt(char *name, char *txt, int stat)
- {
-   struct txt_record *r = opt_malloc(sizeof(struct txt_record));
-@@ -670,13 +671,14 @@ static void add_txt(char *name, char *tx
-       *(r->txt) = len;
-       memcpy((r->txt)+1, txt, len);
-     }
--  
-+
-   r->stat = stat;
-   r->name = opt_string_alloc(name);
-   r->next = daemon->txt;
-   daemon->txt = r;
-   r->class = C_CHAOS;
- }
-+#endif
- 
- static void do_usage(void)
- {
-@@ -4515,6 +4517,7 @@ void read_opts(int argc, char **argv, ch
-   daemon->soa_expiry = SOA_EXPIRY;
-   daemon->max_port = MAX_PORT;
- 
-+#ifndef NO_ID
-   add_txt("version.bind", "dnsmasq-" VERSION, 0 );
-   add_txt("authors.bind", "Simon Kelley", 0);
-   add_txt("copyright.bind", COPYRIGHT, 0);
-@@ -4527,6 +4530,7 @@ void read_opts(int argc, char **argv, ch
-   add_txt("auth.bind", NULL, TXT_STAT_AUTH);
- #endif
-   add_txt("servers.bind", NULL, TXT_STAT_SERVERS);
-+#endif
- 
-   while (1) 
-     {
---- a/src/rfc1035.c
-+++ b/src/rfc1035.c
-@@ -1264,6 +1264,7 @@ size_t answer_request(struct dns_header
- 		      unsigned long ttl = daemon->local_ttl;
- 		      int ok = 1;
- 		      log_query(F_CONFIG | F_RRNAME, name, NULL, "<TXT>");
-+#ifndef NO_ID
- 		      /* Dynamically generate stat record */
- 		      if (t->stat != 0)
- 			{
-@@ -1271,7 +1272,7 @@ size_t answer_request(struct dns_header
- 			  if (!cache_make_stat(t))
- 			    ok = 0;
- 			}
--		      
-+#endif
- 		      if (ok && add_resource_record(header, limit, &trunc, nameoffset, &ansp, 
- 						    ttl, NULL,
- 						    T_TXT, t->class, "t", t->len, t->txt))

+ 0 - 168
package/system/opkg/patches/001-ship-pkg-m4.patch

@@ -1,168 +0,0 @@
---- /dev/null
-+++ b/m4/pkg.m4
-@@ -0,0 +1,157 @@
-+# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
-+# 
-+# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
-+#
-+# This program is free software; you can redistribute it and/or modify
-+# it under the terms of the GNU General Public License as published by
-+# the Free Software Foundation; either version 2 of the License, or
-+# (at your option) any later version.
-+#
-+# This program is distributed in the hope that it will be useful, but
-+# WITHOUT ANY WARRANTY; without even the implied warranty of
-+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-+# General Public License for more details.
-+#
-+# You should have received a copy of the GNU General Public License
-+# along with this program; if not, write to the Free Software
-+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-+#
-+# As a special exception to the GNU General Public License, if you
-+# distribute this file as part of a program that contains a
-+# configuration script generated by Autoconf, you may include it under
-+# the same distribution terms that you use for the rest of that program.
-+
-+# PKG_PROG_PKG_CONFIG([MIN-VERSION])
-+# ----------------------------------
-+AC_DEFUN([PKG_PROG_PKG_CONFIG],
-+[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
-+m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
-+AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
-+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
-+	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
-+fi
-+if test -n "$PKG_CONFIG"; then
-+	_pkg_min_version=m4_default([$1], [0.9.0])
-+	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
-+	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
-+		AC_MSG_RESULT([yes])
-+	else
-+		AC_MSG_RESULT([no])
-+		PKG_CONFIG=""
-+	fi
-+		
-+fi[]dnl
-+])# PKG_PROG_PKG_CONFIG
-+
-+# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
-+#
-+# Check to see whether a particular set of modules exists.  Similar
-+# to PKG_CHECK_MODULES(), but does not set variables or print errors.
-+#
-+#
-+# Similar to PKG_CHECK_MODULES, make sure that the first instance of
-+# this or PKG_CHECK_MODULES is called, or make sure to call
-+# PKG_CHECK_EXISTS manually
-+# --------------------------------------------------------------
-+AC_DEFUN([PKG_CHECK_EXISTS],
-+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
-+if test -n "$PKG_CONFIG" && \
-+    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
-+  m4_ifval([$2], [$2], [:])
-+m4_ifvaln([$3], [else
-+  $3])dnl
-+fi])
-+
-+
-+# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
-+# ---------------------------------------------
-+m4_define([_PKG_CONFIG],
-+[if test -n "$PKG_CONFIG"; then
-+    if test -n "$$1"; then
-+        pkg_cv_[]$1="$$1"
-+    else
-+        PKG_CHECK_EXISTS([$3],
-+                         [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
-+			 [pkg_failed=yes])
-+    fi
-+else
-+	pkg_failed=untried
-+fi[]dnl
-+])# _PKG_CONFIG
-+
-+# _PKG_SHORT_ERRORS_SUPPORTED
-+# -----------------------------
-+AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
-+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
-+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
-+        _pkg_short_errors_supported=yes
-+else
-+        _pkg_short_errors_supported=no
-+fi[]dnl
-+])# _PKG_SHORT_ERRORS_SUPPORTED
-+
-+
-+# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
-+# [ACTION-IF-NOT-FOUND])
-+#
-+#
-+# Note that if there is a possibility the first call to
-+# PKG_CHECK_MODULES might not happen, you should be sure to include an
-+# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
-+#
-+#
-+# --------------------------------------------------------------
-+AC_DEFUN([PKG_CHECK_MODULES],
-+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
-+AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
-+AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
-+
-+pkg_failed=no
-+AC_MSG_CHECKING([for $1])
-+
-+_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
-+_PKG_CONFIG([$1][_LIBS], [libs], [$2])
-+
-+m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
-+and $1[]_LIBS to avoid the need to call pkg-config.
-+See the pkg-config man page for more details.])
-+
-+if test $pkg_failed = yes; then
-+        _PKG_SHORT_ERRORS_SUPPORTED
-+        if test $_pkg_short_errors_supported = yes; then
-+	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"`
-+        else 
-+	        $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
-+        fi
-+	# Put the nasty error message in config.log where it belongs
-+	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
-+
-+	ifelse([$4], , [AC_MSG_ERROR(dnl
-+[Package requirements ($2) were not met:
-+
-+$$1_PKG_ERRORS
-+
-+Consider adjusting the PKG_CONFIG_PATH environment variable if you
-+installed software in a non-standard prefix.
-+
-+_PKG_TEXT
-+])],
-+		[AC_MSG_RESULT([no])
-+                $4])
-+elif test $pkg_failed = untried; then
-+	ifelse([$4], , [AC_MSG_FAILURE(dnl
-+[The pkg-config script could not be found or is too old.  Make sure it
-+is in your PATH or set the PKG_CONFIG environment variable to the full
-+path to pkg-config.
-+
-+_PKG_TEXT
-+
-+To get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
-+		[$4])
-+else
-+	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
-+	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
-+        AC_MSG_RESULT([yes])
-+	ifelse([$3], , :, [$3])
-+fi[]dnl
-+])# PKG_CHECK_MODULES
---- a/Makefile.am
-+++ b/Makefile.am
-@@ -1,4 +1,4 @@
--ACLOCAL_AMFLAGS = -I shave
-+ACLOCAL_AMFLAGS = -I shave -I m4
- 
- SUBDIRS = libbb libopkg src tests utils man
- 

+ 0 - 37
package/system/opkg/patches/002-no-shave.patch

@@ -1,37 +0,0 @@
---- a/configure.ac
-+++ b/configure.ac
-@@ -4,7 +4,6 @@ AC_CONFIG_SRCDIR([libopkg/pkg.c])
- 
- AC_CONFIG_AUX_DIR([conf])
- AC_CONFIG_MACRO_DIR([m4])
--AC_CONFIG_MACRO_DIR([shave])
- 
- AM_INIT_AUTOMAKE
- AM_CONFIG_HEADER(libopkg/config.h)
-@@ -277,9 +276,6 @@ AC_SUBST(opkgetcdir)
- AC_SUBST(opkglockfile)
- AC_SUBST([CLEAN_DATE])
- 
--# Setup output beautifier.
--SHAVE_INIT([shave], [enable])
--
- AC_OUTPUT(
-     Makefile
-     libopkg/Makefile
-@@ -289,8 +285,6 @@ AC_OUTPUT(
-     utils/Makefile
-     utils/update-alternatives
-     libopkg.pc
--    shave/shave
--    shave/shave-libtool
-     man/Makefile
-     man/opkg-cl.1
-     man/opkg-key.1
---- a/Makefile.am
-+++ b/Makefile.am
-@@ -1,4 +1,4 @@
--ACLOCAL_AMFLAGS = -I shave -I m4
-+ACLOCAL_AMFLAGS = -I m4
- 
- SUBDIRS = libbb libopkg src tests utils man
- 

+ 0 - 20
package/system/opkg/patches/004-host_cpu.patch

@@ -1,20 +0,0 @@
---- a/libbb/Makefile.am
-+++ b/libbb/Makefile.am
-@@ -1,6 +1,6 @@
- HOST_CPU=@host_cpu@
- BUILD_CPU=@build_cpu@
--ALL_CFLAGS=-g -O -Wall -DHOST_CPU_STR=\"@host_cpu@\" -DBUILD_CPU=@build_cpu@
-+ALL_CFLAGS=-g -O -Wall -DHOST_CPU_STR=\"$(HOST_CPU)\" -DBUILD_CPU=@build_cpu@
- 
- noinst_LTLIBRARIES = libbb.la
- 
---- a/libopkg/Makefile.am
-+++ b/libopkg/Makefile.am
-@@ -1,5 +1,5 @@
--
--AM_CFLAGS=-Wall -DHOST_CPU_STR=\"@host_cpu@\" -DBUILD_CPU=@build_cpu@ -DLIBDIR=\"@libdir@\" -DOPKGLIBDIR=\"@opkglibdir@\" -DOPKGETCDIR=\"@opkgetcdir@\" -DOPKGLOCKFILE=\"@opkglockfile@\" -DDATADIR=\"@datadir@\" -I$(top_srcdir) $(BIGENDIAN_CFLAGS) $(CURL_CFLAGS) $(GPGME_CFLAGS) $(PATHFINDER_CFLAGS)
-+HOST_CPU=@host_cpu@
-+AM_CFLAGS=-Wall -DHOST_CPU_STR=\"$(HOST_CPU)\" -DBUILD_CPU=@build_cpu@ -DLIBDIR=\"@libdir@\" -DOPKGLIBDIR=\"@opkglibdir@\" -DOPKGETCDIR=\"@opkgetcdir@\" -DOPKGLOCKFILE=\"@opkglockfile@\" -DDATADIR=\"@datadir@\" -I$(top_srcdir) $(BIGENDIAN_CFLAGS) $(CURL_CFLAGS) $(GPGME_CFLAGS) $(PATHFINDER_CFLAGS)
- 
- libopkg_includedir=$(includedir)/libopkg
- libopkg_include_HEADERS= *.h

+ 0 - 71
package/system/opkg/patches/007-force_static.patch

@@ -1,71 +0,0 @@
---- a/libopkg/Makefile.am
-+++ b/libopkg/Makefile.am
-@@ -38,16 +38,10 @@ if HAVE_SHA256
- opkg_util_sources += sha256.c sha256.h
- endif
- 
--lib_LTLIBRARIES = libopkg.la
--libopkg_la_SOURCES = \
-+noinst_LIBRARIES = libopkg.a
-+libopkg_a_SOURCES = \
- 	$(opkg_libcore_sources) \
- 	$(opkg_cmd_sources) $(opkg_db_sources) \
- 	$(opkg_util_sources) $(opkg_list_sources)
- 
--libopkg_la_LIBADD = $(top_builddir)/libbb/libbb.la $(CURL_LIBS) $(GPGME_LIBS) $(OPENSSL_LIBS) $(PATHFINDER_LIBS)
--
--# make sure we only export symbols that are for public use
--#libopkg_la_LDFLAGS = -export-symbols-regex "^opkg_.*"
--
--
--
-+libopkg_a_LIBADD = $(top_builddir)/libbb/libbb.a
---- a/libbb/Makefile.am
-+++ b/libbb/Makefile.am
-@@ -2,9 +2,9 @@ HOST_CPU=@host_cpu@
- BUILD_CPU=@build_cpu@
- ALL_CFLAGS=-g -O -Wall -DHOST_CPU_STR=\"$(HOST_CPU)\" -DBUILD_CPU=@build_cpu@
- 
--noinst_LTLIBRARIES = libbb.la
-+noinst_LIBRARIES = libbb.a
- 
--libbb_la_SOURCES = gz_open.c \
-+libbb_a_SOURCES = gz_open.c \
- 	libbb.h \
- 	unzip.c \
- 	wfopen.c \
---- a/tests/Makefile.am
-+++ b/tests/Makefile.am
-@@ -4,11 +4,11 @@ AM_CFLAGS = $(ALL_CFLAGS) -Wall -g -O3 -
- #noinst_PROGRAMS = libopkg_test opkg_active_list_test
- noinst_PROGRAMS = libopkg_test
- 
--#opkg_hash_test_LDADD = $(top_builddir)/libbb/libbb.la $(top_builddir)/libopkg/libopkg.la
-+#opkg_hash_test_LDADD = $(top_builddir)/libbb/libbb.a $(top_builddir)/libopkg/libopkg.a
- #opkg_hash_test_SOURCES = opkg_hash_test.c
- #opkg_hash_test_CFLAGS = $(ALL_CFLAGS) -I$(top_srcdir)
- 
--#opkg_extract_test_LDADD = $(top_builddir)/libbb/libbb.la $(top_builddir)/libopkg/libopkg.la
-+#opkg_extract_test_LDADD = $(top_builddir)/libbb/libbb.a $(top_builddir)/libopkg/libopkg.a
- #opkg_extract_test_SOURCES = opkg_extract_test.c
- #opkg_extract_test_CFLAGS = $(ALL_CFLAGS) -I$(top_srcdir)
- 
-@@ -16,7 +16,7 @@ noinst_PROGRAMS = libopkg_test
- #opkg_active_list_test_SOURCES = opkg_active_list_test.c
- #opkg_active_list_test_CFLAGS = $(ALL_CFLAGS) -I$(top_srcdir)
- 
--libopkg_test_LDADD = $(top_builddir)/libopkg/libopkg.la
-+libopkg_test_LDADD = $(top_builddir)/libopkg/libopkg.a $(top_builddir)/libbb/libbb.a $(CURL_LIBS) $(GPGME_LIBS) $(OPENSSL_LIBS) $(PATHFINDER_LIBS)
- libopkg_test_SOURCE = libopkg_test.c
- libopkg_test_LDFLAGS = -static
- 
---- a/src/Makefile.am
-+++ b/src/Makefile.am
-@@ -2,5 +2,5 @@ AM_CFLAGS = -I${top_srcdir}/libopkg ${AL
- bin_PROGRAMS = opkg-cl
- 
- opkg_cl_SOURCES = opkg-cl.c
--opkg_cl_LDADD = $(top_builddir)/libopkg/libopkg.la \
--                $(top_builddir)/libbb/libbb.la 
-+opkg_cl_LDADD = $(top_builddir)/libopkg/libopkg.a \
-+                $(top_builddir)/libbb/libbb.a $(CURL_LIBS) $(GPGME_LIBS) $(OPENSSL_LIBS) $(PATHFINDER_LIBS)

+ 0 - 41
package/system/opkg/patches/009-remove-upgrade-all.patch

@@ -1,41 +0,0 @@
---- a/libopkg/opkg_cmd.c
-+++ b/libopkg/opkg_cmd.c
-@@ -551,18 +551,6 @@ opkg_upgrade_cmd(int argc, char **argv)
- 			    err = -1;
-                }
- 	  }
--     } else {
--	  pkg_vec_t *installed = pkg_vec_alloc();
--
--	  pkg_info_preinstall_check();
--
--	  pkg_hash_fetch_all_installed(installed);
--	  for (i = 0; i < installed->len; i++) {
--	       pkg = installed->pkgs[i];
--	       if (opkg_upgrade_pkg(pkg))
--		       err = -1;
--	  }
--	  pkg_vec_free(installed);
-      }
- 
-      if (opkg_configure_packages(NULL))
-@@ -1258,7 +1246,7 @@ opkg_print_architecture_cmd(int argc, ch
-    array for easier maintenance */
- static opkg_cmd_t cmds[] = {
-      {"update", 0, (opkg_cmd_fun_t)opkg_update_cmd, PFM_DESCRIPTION|PFM_SOURCE},
--     {"upgrade", 0, (opkg_cmd_fun_t)opkg_upgrade_cmd, PFM_DESCRIPTION|PFM_SOURCE},
-+     {"upgrade", 1, (opkg_cmd_fun_t)opkg_upgrade_cmd, PFM_DESCRIPTION|PFM_SOURCE},
-      {"list", 0, (opkg_cmd_fun_t)opkg_list_cmd, PFM_SOURCE},
-      {"list_installed", 0, (opkg_cmd_fun_t)opkg_list_installed_cmd, PFM_SOURCE},
-      {"list-installed", 0, (opkg_cmd_fun_t)opkg_list_installed_cmd, PFM_SOURCE},
---- a/src/opkg-cl.c
-+++ b/src/opkg-cl.c
-@@ -221,7 +221,7 @@ usage()
- 
- 	printf("\nPackage Manipulation:\n");
- 	printf("\tupdate			Update list of available packages\n");
--	printf("\tupgrade			Upgrade installed packages\n");
-+	printf("\tupgrade <pkgs>		Upgrade packages\n");
- 	printf("\tinstall <pkgs>		Install package(s)\n");
- 	printf("\tconfigure <pkgs>	Configure unpacked package(s)\n");
- 	printf("\tremove <pkgs|regexp>	Remove package(s)\n");

+ 0 - 12
package/system/opkg/patches/011-old-config-location.patch

@@ -1,12 +0,0 @@
---- a/src/opkg-cl.c
-+++ b/src/opkg-cl.c
-@@ -207,6 +207,9 @@ args_parse(int argc, char *argv[])
- 		}
- 	}
- 
-+	if(!conf->conf_file && !conf->offline_root)
-+		conf->conf_file = xstrdup("/etc/opkg.conf");
-+
- 	if (parse_err)
- 		return parse_err;
- 	else

+ 0 - 23
package/system/opkg/patches/012-strip-trailing-conffiles-whitespace.patch

@@ -1,23 +0,0 @@
---- a/libopkg/opkg_install.c
-+++ b/libopkg/opkg_install.c
-@@ -274,6 +274,7 @@ unpack_pkg_control_files(pkg_t *pkg)
-      while (1) {
- 	  char *cf_name;
- 	  char *cf_name_in_dest;
-+	  int i;
- 
- 	  cf_name = file_read_line_alloc(conffiles_file);
- 	  if (cf_name == NULL) {
-@@ -282,6 +283,12 @@ unpack_pkg_control_files(pkg_t *pkg)
- 	  if (cf_name[0] == '\0') {
- 	       continue;
- 	  }
-+	  for (i = strlen(cf_name) - 1;
-+	       (i >= 0) && (cf_name[i] == ' ' || cf_name[i] == '\t');
-+	       i--
-+	  ) {
-+	       cf_name[i] = '\0';
-+	  }
- 
- 	  /* Prepend dest->root_dir to conffile name.
- 	     Take pains to avoid multiple slashes. */

+ 0 - 15
package/system/opkg/patches/014-errors-to-stderr.patch

@@ -1,15 +0,0 @@
---- a/libopkg/opkg_message.c
-+++ b/libopkg/opkg_message.c
-@@ -64,10 +64,10 @@ print_error_list(void)
- 	struct errlist *err = error_list_head;
- 
- 	if (err) {
--		printf("Collected errors:\n");
-+		fprintf(stderr, "Collected errors:\n");
- 		/* Here we print the errors collected and free the list */
- 		while (err != NULL) {
--			printf(" * %s", err->errmsg);
-+			fprintf(stderr, " * %s", err->errmsg);
- 			err = err->next;
- 		}
- 	}

+ 0 - 317
package/system/opkg/patches/020-avoid_getline.patch

@@ -1,317 +0,0 @@
---- a/libopkg/parse_util.c
-+++ b/libopkg/parse_util.c
-@@ -22,6 +22,7 @@
- #include "libbb/libbb.h"
- 
- #include "parse_util.h"
-+#include "pkg_parse.h"
- 
- int
- is_field(const char *type, const char *line)
-@@ -86,3 +87,84 @@ parse_list(const char *raw, unsigned int
- 	*count = line_count;
- 	return depends;
- }
-+
-+int
-+parse_from_stream_nomalloc(parse_line_t parse_line, void *item, FILE *fp, uint mask,
-+						char **buf0, size_t buf0len)
-+{
-+	int ret, lineno;
-+	char *buf, *nl;
-+	size_t buflen;
-+
-+	lineno = 1;
-+	ret = 0;
-+
-+	buflen = buf0len;
-+	buf = *buf0;
-+	buf[0] = '\0';
-+
-+	while (1) {
-+		if (fgets(buf, (int)buflen, fp) == NULL) {
-+			if (ferror(fp)) {
-+				opkg_perror(ERROR, "fgets");
-+				ret = -1;
-+			} else if (strlen(*buf0) == buf0len-1) {
-+				opkg_msg(ERROR, "Missing new line character"
-+						" at end of file!\n");
-+				parse_line(item, *buf0, mask);
-+			}
-+			break;
-+		}
-+
-+		nl = strchr(buf, '\n');
-+		if (nl == NULL) {
-+			if (strlen(buf) < buflen-1) {
-+				/*
-+				 * Line could be exactly buflen-1 long and
-+				 * missing a newline, but we won't know until
-+				 * fgets fails to read more data.
-+				 */
-+				opkg_msg(ERROR, "Missing new line character"
-+						" at end of file!\n");
-+				parse_line(item, *buf0, mask);
-+				break;
-+			}
-+			if (buf0len >= EXCESSIVE_LINE_LEN) {
-+				opkg_msg(ERROR, "Excessively long line at "
-+					"%d. Corrupt file?\n",
-+					lineno);
-+				ret = -1;
-+				break;
-+			}
-+
-+			/*
-+			 * Realloc and point buf past the data already read,
-+			 * at the NULL terminator inserted by fgets.
-+			 * |<--------------- buf0len ----------------->|
-+			 * |                     |<------- buflen ---->|
-+			 * |---------------------|---------------------|
-+			 * buf0                   buf
-+			 */
-+			buflen = buf0len +1;
-+			buf0len *= 2;
-+			*buf0 = xrealloc(*buf0, buf0len);
-+			buf = *buf0 + buflen -2;
-+
-+			continue;
-+		}
-+
-+		*nl = '\0';
-+
-+		lineno++;
-+
-+		if (parse_line(item, *buf0, mask))
-+			break;
-+
-+		buf = *buf0;
-+		buflen = buf0len;
-+		buf[0] = '\0';
-+	}
-+
-+	return ret;
-+}
-+
---- a/libopkg/parse_util.h
-+++ b/libopkg/parse_util.h
-@@ -22,4 +22,8 @@ int is_field(const char *type, const cha
- char *parse_simple(const char *type, const char *line);
- char **parse_list(const char *raw, unsigned int *count, const char sep, int skip_field);
- 
-+typedef int (*parse_line_t)(void *, const char *, uint);
-+int parse_from_stream_nomalloc(parse_line_t parse_line, void *item, FILE *fp, uint mask,
-+						char **buf0, size_t buf0len);
-+
- #endif
---- a/libopkg/pkg_hash.c
-+++ b/libopkg/pkg_hash.c
-@@ -23,6 +23,7 @@
- #include "opkg_message.h"
- #include "pkg_vec.h"
- #include "pkg_hash.h"
-+#include "parse_util.h"
- #include "pkg_parse.h"
- #include "opkg_utils.h"
- #include "sprintf_alloc.h"
-@@ -119,8 +120,14 @@ pkg_hash_add_from_file(const char *file_
- 		pkg->src = src;
- 		pkg->dest = dest;
- 
--		ret = pkg_parse_from_stream_nomalloc(pkg, fp, 0,
-+		ret = parse_from_stream_nomalloc(pkg_parse_line, pkg, fp, 0,
- 				&buf, len);
-+
-+		if (pkg->name == NULL) {
-+			/* probably just a blank line */
-+			ret = 1;
-+		}
-+
- 		if (ret) {
- 			pkg_deinit (pkg);
- 			free(pkg);
---- a/libopkg/pkg_parse.c
-+++ b/libopkg/pkg_parse.c
-@@ -104,9 +104,11 @@ get_arch_priority(const char *arch)
- 	return 0;
- }
- 
--static int
--pkg_parse_line(pkg_t *pkg, const char *line, uint mask)
-+int
-+pkg_parse_line(void *ptr, const char *line, uint mask)
- {
-+	pkg_t *pkg = (pkg_t *) ptr;
-+
- 	/* these flags are a bit hackish... */
- 	static int reading_conffiles = 0, reading_description = 0;
- 	int ret = 0;
-@@ -266,91 +268,6 @@ dont_reset_flags:
- }
- 
- int
--pkg_parse_from_stream_nomalloc(pkg_t *pkg, FILE *fp, uint mask,
--						char **buf0, size_t buf0len)
--{
--	int ret, lineno;
--	char *buf, *nl;
--	size_t buflen;
--
--	lineno = 1;
--	ret = 0;
--
--	buflen = buf0len;
--	buf = *buf0;
--	buf[0] = '\0';
--
--	while (1) {
--		if (fgets(buf, (int)buflen, fp) == NULL) {
--			if (ferror(fp)) {
--				opkg_perror(ERROR, "fgets");
--				ret = -1;
--			} else if (strlen(*buf0) == buf0len-1) {
--				opkg_msg(ERROR, "Missing new line character"
--						" at end of file!\n");
--				pkg_parse_line(pkg, *buf0, mask);
--			}
--			break;
--		}
--
--		nl = strchr(buf, '\n');
--		if (nl == NULL) {
--			if (strlen(buf) < buflen-1) {
--				/*
--				 * Line could be exactly buflen-1 long and
--				 * missing a newline, but we won't know until
--				 * fgets fails to read more data.
--				 */
--				opkg_msg(ERROR, "Missing new line character"
--						" at end of file!\n");
--				pkg_parse_line(pkg, *buf0, mask);
--				break;
--			}
--			if (buf0len >= EXCESSIVE_LINE_LEN) {
--				opkg_msg(ERROR, "Excessively long line at "
--					"%d. Corrupt file?\n",
--					lineno);
--				ret = -1;
--				break;
--			}
--
--			/*
--			 * Realloc and point buf past the data already read,
--			 * at the NULL terminator inserted by fgets.
--			 * |<--------------- buf0len ----------------->|
--			 * |                     |<------- buflen ---->|
--			 * |---------------------|---------------------|
--			 * buf0                   buf
--			 */
--			buflen = buf0len +1;
--			buf0len *= 2;
--			*buf0 = xrealloc(*buf0, buf0len);
--			buf = *buf0 + buflen -2;
--
--			continue;
--		}
--
--		*nl = '\0';
--
--		lineno++;
--
--		if (pkg_parse_line(pkg, *buf0, mask))
--			break;
--
--		buf = *buf0;
--		buflen = buf0len;
--		buf[0] = '\0';
--	}
--
--	if (pkg->name == NULL) {
--		/* probably just a blank line */
--		ret = 1;
--	}
--
--	return ret;
--}
--
--int
- pkg_parse_from_stream(pkg_t *pkg, FILE *fp, uint mask)
- {
- 	int ret;
-@@ -358,8 +275,13 @@ pkg_parse_from_stream(pkg_t *pkg, FILE *
- 	const size_t len = 4096;
- 
- 	buf = xmalloc(len);
--	ret = pkg_parse_from_stream_nomalloc(pkg, fp, mask, &buf, len);
-+	ret = parse_from_stream_nomalloc(pkg_parse_line, pkg, fp, mask, &buf, len);
- 	free(buf);
- 
-+	if (pkg->name == NULL) {
-+		/* probably just a blank line */
-+		ret = 1;
-+	}
-+
- 	return ret;
- }
---- a/libopkg/pkg_parse.h
-+++ b/libopkg/pkg_parse.h
-@@ -18,10 +18,11 @@
- #ifndef PKG_PARSE_H
- #define PKG_PARSE_H
- 
-+#include "pkg.h"
-+
- int parse_version(pkg_t *pkg, const char *raw);
- int pkg_parse_from_stream(pkg_t *pkg, FILE *fp, uint mask);
--int pkg_parse_from_stream_nomalloc(pkg_t *pkg, FILE *fp, uint mask,
--						char **buf0, size_t buf0len);
-+int pkg_parse_line(void *ptr, const char *line, uint mask);
- 
- #define EXCESSIVE_LINE_LEN	(4096 << 8)
- 
---- a/libopkg/release_parse.c
-+++ b/libopkg/release_parse.c
-@@ -23,8 +23,10 @@
- #include "parse_util.h"
- 
- static int
--release_parse_line(release_t *release, const char *line)
-+release_parse_line(void *ptr, const char *line, uint mask)
- {
-+	release_t *release = (release_t *) ptr;
-+
- 	int ret = 0;
- 	unsigned int count = 0;
- 	char **list = 0;
-@@ -111,25 +113,14 @@ dont_reset_flags:
- int
- release_parse_from_stream(release_t *release, FILE *fp)
- {
--	int ret = 0;
--	char *buf = NULL;
--	size_t buflen, nread;
--
--	nread = getline(&buf, &buflen, fp);
--	while ( nread != -1 ) {
--		if (buf[nread-1] == '\n') buf[nread-1] = '\0';
--		if (release_parse_line(release, buf))
--                        opkg_msg(DEBUG, "Failed to parse release line for %s:\n\t%s\n",
--					release->name, buf);
--		nread = getline(&buf, &buflen, fp);
--	}
--
--	if (!feof(fp)) {
--		opkg_perror(ERROR, "Problems reading Release file for %sd\n", release->name);
--		ret = -1;
--	}
-+	int ret;
-+	char *buf;
-+	const size_t len = 4096;
- 
-+	buf = xmalloc(len);
-+	ret = parse_from_stream_nomalloc(release_parse_line, release, fp, 0, &buf, len);
- 	free(buf);
-+
- 	return ret;
- }
- 

+ 0 - 10
package/system/opkg/patches/030-fix-double-free.patch

@@ -1,10 +0,0 @@
---- a/libopkg/opkg_remove.c
-+++ b/libopkg/opkg_remove.c
-@@ -138,7 +138,6 @@ opkg_remove_dependent_pkgs(pkg_t *pkg, a
-     for (i = 0; i < dependent_pkgs->len; i++) {
-         err = opkg_remove_pkg(dependent_pkgs->pkgs[i],0);
-         if (err) {
--            pkg_vec_free(dependent_pkgs);
-             break;
- 	}
-     }

+ 0 - 31
package/system/opkg/patches/040-wrap-descriptions-only-on-ttys.patch

@@ -1,31 +0,0 @@
---- a/libopkg/pkg_parse.c
-+++ b/libopkg/pkg_parse.c
-@@ -20,6 +20,7 @@
- 
- #include <stdio.h>
- #include <ctype.h>
-+#include <unistd.h>
- 
- #include "pkg.h"
- #include "opkg_utils.h"
-@@ -239,10 +240,16 @@ pkg_parse_line(void *ptr, const char *li
- 
- 	case ' ':
- 		if ((mask & PFM_DESCRIPTION) && reading_description) {
--			pkg->description = xrealloc(pkg->description,
--						strlen(pkg->description)
--						+ 1 + strlen(line) + 1);
--			strcat(pkg->description, "\n");
-+			if (isatty(1)) {
-+				pkg->description = xrealloc(pkg->description,
-+							strlen(pkg->description)
-+							+ 1 + strlen(line) + 1);
-+				strcat(pkg->description, "\n");
-+			} else {
-+				pkg->description = xrealloc(pkg->description,
-+							strlen(pkg->description)
-+							+ 1 + strlen(line));
-+			}
- 			strcat(pkg->description, (line));
- 			goto dont_reset_flags;
- 		} else if ((mask & PFM_CONFFILES) && reading_conffiles) {

+ 0 - 169
package/system/opkg/patches/050-add-case-insensitive-flag.patch

@@ -1,169 +0,0 @@
---- a/libopkg/opkg_cmd.c
-+++ b/libopkg/opkg_cmd.c
-@@ -436,7 +436,7 @@ opkg_configure_packages(char *pkg_name)
-      for(i = 0; i < ordered->len; i++) {
- 	  pkg = ordered->pkgs[i];
- 
--	  if (pkg_name && fnmatch(pkg_name, pkg->name, 0))
-+	  if (pkg_name && fnmatch(pkg_name, pkg->name, conf->nocase))
- 	       continue;
- 
- 	  if (pkg->state_status == SS_UNPACKED) {
-@@ -610,7 +610,7 @@ opkg_list_cmd(int argc, char **argv)
-      for (i=0; i < available->len; i++) {
- 	  pkg = available->pkgs[i];
- 	  /* if we have package name or pattern and pkg does not match, then skip it */
--	  if (pkg_name && fnmatch(pkg_name, pkg->name, 0))
-+	  if (pkg_name && fnmatch(pkg_name, pkg->name, conf->nocase))
- 	       continue;
-           print_pkg(pkg);
-      }
-@@ -637,7 +637,7 @@ opkg_list_installed_cmd(int argc, char *
-      for (i=0; i < available->len; i++) {
- 	  pkg = available->pkgs[i];
- 	  /* if we have package name or pattern and pkg does not match, then skip it */
--	  if (pkg_name && fnmatch(pkg_name, pkg->name, 0))
-+	  if (pkg_name && fnmatch(pkg_name, pkg->name, conf->nocase))
- 	       continue;
-           print_pkg(pkg);
-      }
-@@ -666,7 +666,7 @@ opkg_list_changed_conffiles_cmd(int argc
-      for (i=0; i < available->len; i++) {
- 	  pkg = available->pkgs[i];
- 	  /* if we have package name or pattern and pkg does not match, then skip it */
--	  if (pkg_name && fnmatch(pkg_name, pkg->name, 0))
-+	  if (pkg_name && fnmatch(pkg_name, pkg->name, conf->nocase))
- 	    continue;
- 	  if (nv_pair_list_empty(&pkg->conffiles))
- 	    continue;
-@@ -722,7 +722,7 @@ opkg_info_status_cmd(int argc, char **ar
- 
-      for (i=0; i < available->len; i++) {
- 	  pkg = available->pkgs[i];
--	  if (pkg_name && fnmatch(pkg_name, pkg->name, 0)) {
-+	  if (pkg_name && fnmatch(pkg_name, pkg->name, conf->nocase)) {
- 	       continue;
- 	  }
- 
-@@ -792,7 +792,7 @@ opkg_remove_cmd(int argc, char **argv)
-      for (i=0; i<argc; i++) {
-         for (a=0; a<available->len; a++) {
-             pkg = available->pkgs[a];
--	    if (fnmatch(argv[i], pkg->name, 0)) {
-+	    if (fnmatch(argv[i], pkg->name, conf->nocase)) {
-                continue;
-             }
-             if (conf->restrict_to_default_dest) {
-@@ -926,7 +926,7 @@ opkg_depends_cmd(int argc, char **argv)
- 		for (j=0; j<available_pkgs->len; j++) {
- 			pkg = available_pkgs->pkgs[j];
- 
--			if (fnmatch(argv[i], pkg->name, 0) != 0)
-+			if (fnmatch(argv[i], pkg->name, conf->nocase) != 0)
- 				continue;
- 
- 			depends_count = pkg->depends_count +
-@@ -1147,9 +1147,9 @@ opkg_what_provides_replaces_cmd(enum wha
- 			      ((what_field_type == WHATPROVIDES)
- 			       ? pkg->provides[k]
- 			       : pkg->replaces[k]);
--			 if (fnmatch(target, apkg->name, 0) == 0) {
-+			 if (fnmatch(target, apkg->name, conf->nocase) == 0) {
- 			      opkg_msg(NOTICE, "    %s", pkg->name);
--			      if (strcmp(target, apkg->name) != 0)
-+			      if ((conf->nocase ? strcasecmp(target, apkg->name) : strcmp(target, apkg->name)) != 0)
- 				   opkg_msg(NOTICE, "\t%s %s\n",
- 						   rel_str, apkg->name);
- 			      opkg_message(NOTICE, "\n");
-@@ -1200,7 +1200,7 @@ opkg_search_cmd(int argc, char **argv)
- 
- 	  for (iter = str_list_first(installed_files); iter; iter = str_list_next(installed_files, iter)) {
- 	       installed_file = (char *)iter->data;
--	       if (fnmatch(argv[0], installed_file, 0)==0)
-+	       if (fnmatch(argv[0], installed_file, conf->nocase)==0)
- 	            print_pkg(pkg);
- 	  }
- 
---- a/libopkg/opkg_conf.c
-+++ b/libopkg/opkg_conf.c
-@@ -62,6 +62,7 @@ opkg_option_t options[] = {
- 	  { "noaction", OPKG_OPT_TYPE_BOOL, &_conf.noaction },
- 	  { "download_only", OPKG_OPT_TYPE_BOOL, &_conf.download_only },
- 	  { "nodeps", OPKG_OPT_TYPE_BOOL, &_conf.nodeps },
-+	  { "nocase", OPKG_OPT_TYPE_BOOL, &_conf.nocase },
- 	  { "offline_root", OPKG_OPT_TYPE_STRING, &_conf.offline_root },
- 	  { "overlay_root", OPKG_OPT_TYPE_STRING, &_conf.overlay_root },
- 	  { "proxy_passwd", OPKG_OPT_TYPE_STRING, &_conf.proxy_passwd },
---- a/libopkg/opkg_conf.h
-+++ b/libopkg/opkg_conf.h
-@@ -24,6 +24,7 @@ extern opkg_conf_t *conf;
- #include "config.h"
- 
- #include <stdarg.h>
-+#include <fnmatch.h> /* FNM_CASEFOLD */
- 
- #include "hash_table.h"
- #include "pkg_src_list.h"
-@@ -79,6 +80,7 @@ struct opkg_conf
-      int force_remove;
-      int check_signature;
-      int nodeps; /* do not follow dependencies */
-+     int nocase; /* perform case insensitive matching */
-      char *offline_root;
-      char *overlay_root;
-      int query_all;
---- a/src/opkg-cl.c
-+++ b/src/opkg-cl.c
-@@ -47,6 +47,7 @@ enum {
- 	ARGS_OPT_NOACTION,
- 	ARGS_OPT_DOWNLOAD_ONLY,
- 	ARGS_OPT_NODEPS,
-+	ARGS_OPT_NOCASE,
- 	ARGS_OPT_AUTOREMOVE,
- 	ARGS_OPT_CACHE,
- };
-@@ -86,6 +87,7 @@ static struct option long_options[] = {
- 	{"noaction", 0, 0, ARGS_OPT_NOACTION},
- 	{"download-only", 0, 0, ARGS_OPT_DOWNLOAD_ONLY},
- 	{"nodeps", 0, 0, ARGS_OPT_NODEPS},
-+	{"nocase", 0, 0, ARGS_OPT_NOCASE},
- 	{"offline", 1, 0, 'o'},
- 	{"offline-root", 1, 0, 'o'},
- 	{"add-arch", 1, 0, ARGS_OPT_ADD_ARCH},
-@@ -107,7 +109,7 @@ args_parse(int argc, char *argv[])
- 	char *tuple, *targ;
- 
- 	while (1) {
--		c = getopt_long_only(argc, argv, "Ad:f:no:p:t:vV::",
-+		c = getopt_long_only(argc, argv, "Ad:f:ino:p:t:vV::",
- 				long_options, &option_index);
- 		if (c == -1)
- 			break;
-@@ -122,6 +124,9 @@ args_parse(int argc, char *argv[])
- 		case 'f':
- 			conf->conf_file = xstrdup(optarg);
- 			break;
-+		case 'i':
-+			conf->nocase = FNM_CASEFOLD;
-+			break;
- 		case 'o':
- 			conf->offline_root = xstrdup(optarg);
- 			break;
-@@ -176,6 +181,9 @@ args_parse(int argc, char *argv[])
- 		case ARGS_OPT_NODEPS:
- 			conf->nodeps = 1;
- 			break;
-+		case ARGS_OPT_NOCASE:
-+			conf->nocase = FNM_CASEFOLD;
-+			break;
- 		case ARGS_OPT_ADD_ARCH:
- 		case ARGS_OPT_ADD_DEST:
- 			tuple = xstrdup(optarg);
-@@ -287,6 +295,7 @@ usage()
- 	printf("\t--noaction		No action -- test only\n");
- 	printf("\t--download-only	No action -- download only\n");
- 	printf("\t--nodeps		Do not follow dependencies\n");
-+	printf("\t--nocase		Perform case insensitive pattern matching\n");
- 	printf("\t--force-removal-of-dependent-packages\n");
- 	printf("\t			Remove package and all dependencies\n");
- 	printf("\t--autoremove		Remove packages that were installed\n");

+ 0 - 58
package/system/opkg/patches/060-add-find-command.patch

@@ -1,58 +0,0 @@
---- a/libopkg/opkg_cmd.c
-+++ b/libopkg/opkg_cmd.c
-@@ -594,7 +594,7 @@ opkg_download_cmd(int argc, char **argv)
- 
- 
- static int
--opkg_list_cmd(int argc, char **argv)
-+opkg_list_find_cmd(int argc, char **argv, int use_desc)
- {
-      int i;
-      pkg_vec_t *available;
-@@ -610,7 +610,8 @@ opkg_list_cmd(int argc, char **argv)
-      for (i=0; i < available->len; i++) {
- 	  pkg = available->pkgs[i];
- 	  /* if we have package name or pattern and pkg does not match, then skip it */
--	  if (pkg_name && fnmatch(pkg_name, pkg->name, conf->nocase))
-+	  if (pkg_name && fnmatch(pkg_name, pkg->name, conf->nocase) &&
-+	      (!use_desc || !pkg->description || fnmatch(pkg_name, pkg->description, conf->nocase)))
- 	       continue;
-           print_pkg(pkg);
-      }
-@@ -619,6 +620,18 @@ opkg_list_cmd(int argc, char **argv)
-      return 0;
- }
- 
-+static int
-+opkg_list_cmd(int argc, char **argv)
-+{
-+	return opkg_list_find_cmd(argc, argv, 0);
-+}
-+
-+static int
-+opkg_find_cmd(int argc, char **argv)
-+{
-+	return opkg_list_find_cmd(argc, argv, 1);
-+}
-+
- 
- static int
- opkg_list_installed_cmd(int argc, char **argv)
-@@ -1262,6 +1275,7 @@ static opkg_cmd_t cmds[] = {
-      {"configure", 0, (opkg_cmd_fun_t)opkg_configure_cmd, PFM_DESCRIPTION|PFM_SOURCE},
-      {"files", 1, (opkg_cmd_fun_t)opkg_files_cmd, PFM_DESCRIPTION|PFM_SOURCE},
-      {"search", 1, (opkg_cmd_fun_t)opkg_search_cmd, PFM_DESCRIPTION|PFM_SOURCE},
-+     {"find", 1, (opkg_cmd_fun_t)opkg_find_cmd, PFM_SOURCE},
-      {"download", 1, (opkg_cmd_fun_t)opkg_download_cmd, PFM_DESCRIPTION|PFM_SOURCE},
-      {"compare_versions", 1, (opkg_cmd_fun_t)opkg_compare_versions_cmd, PFM_DESCRIPTION|PFM_SOURCE},
-      {"compare-versions", 1, (opkg_cmd_fun_t)opkg_compare_versions_cmd, PFM_DESCRIPTION|PFM_SOURCE},
---- a/src/opkg-cl.c
-+++ b/src/opkg-cl.c
-@@ -246,6 +246,7 @@ usage()
- 	printf("\tlist-changed-conffiles	List user modified configuration files\n");
- 	printf("\tfiles <pkg>		List files belonging to <pkg>\n");
- 	printf("\tsearch <file|regexp>	List package providing <file>\n");
-+	printf("\tfind <regexp>		List packages whose name or description matches <regexp>\n");
- 	printf("\tinfo [pkg|regexp]	Display all info for <pkg>\n");
- 	printf("\tstatus [pkg|regexp]	Display all status for <pkg>\n");
- 	printf("\tdownload <pkg>		Download <pkg> to current directory\n");

+ 0 - 719
package/system/opkg/patches/070-use_external_gzip.patch

@@ -1,719 +0,0 @@
---- a/libbb/unarchive.c
-+++ b/libbb/unarchive.c
-@@ -28,6 +28,7 @@
- #include <libgen.h>
- 
- #include "libbb.h"
-+#include "gzip.h"
- 
- #define CONFIG_FEATURE_TAR_OLDGNU_COMPATABILITY 1
- #define CONFIG_FEATURE_TAR_GNU_EXTENSIONS
-@@ -39,38 +40,15 @@ static char *linkname = NULL;
- 
- off_t archive_offset;
- 
--#define SEEK_BUF 4096
- static ssize_t
--seek_by_read(FILE* fd, size_t len)
--{
--        ssize_t cc, total = 0;
--        char buf[SEEK_BUF];
--
--        while (len) {
--                cc = fread(buf, sizeof(buf[0]),
--                                len > SEEK_BUF ? SEEK_BUF : len,
--                                fd);
--
--                total += cc;
--                len -= cc;
--
--                if(feof(fd) || ferror(fd))
--                        break;
--        }
--        return total;
--}
--
--static void
--seek_sub_file(FILE *fd, const int count)
-+seek_forward(struct gzip_handle *zh, ssize_t len)
- {
--	archive_offset += count;
-+	ssize_t slen = gzip_seek(zh, len);
- 
--	/* Do not use fseek() on a pipe. It may fail with ESPIPE, leaving the
--	 * stream at an undefined location.
--	 */
--        seek_by_read(fd, count);
-+	if (slen == len)
-+		archive_offset += len;
- 
--	return;
-+	return slen;
- }
- 
- 
-@@ -87,7 +65,7 @@ seek_sub_file(FILE *fd, const int count)
-  * trailing '/' or else the last dir will be assumed to be the file prefix
-  */
- static char *
--extract_archive(FILE *src_stream, FILE *out_stream,
-+extract_archive(struct gzip_handle *src_stream, FILE *out_stream,
- 		const file_header_t *file_entry, const int function,
- 		const char *prefix,
- 		int *err)
-@@ -129,14 +107,14 @@ extract_archive(FILE *src_stream, FILE *
- 
- 	if (function & extract_to_stream) {
- 		if (S_ISREG(file_entry->mode)) {
--			*err = copy_file_chunk(src_stream, out_stream, file_entry->size);
-+			*err = gzip_copy(src_stream, out_stream, file_entry->size);
- 			archive_offset += file_entry->size;
- 		}
- 	}
- 	else if (function & extract_one_to_buffer) {
- 		if (S_ISREG(file_entry->mode)) {
- 			buffer = (char *) xmalloc(file_entry->size + 1);
--			fread(buffer, 1, file_entry->size, src_stream);
-+			gzip_read(src_stream, buffer, file_entry->size);
- 			buffer[file_entry->size] = '\0';
- 			archive_offset += file_entry->size;
- 			goto cleanup;
-@@ -156,7 +134,7 @@ extract_archive(FILE *src_stream, FILE *
- 					*err = -1;
- 					error_msg("%s not created: newer or same age file exists", file_entry->name);
- 				}
--				seek_sub_file(src_stream, file_entry->size);
-+				seek_forward(src_stream, file_entry->size);
- 				goto cleanup;
- 			}
- 		}
-@@ -185,11 +163,11 @@ extract_archive(FILE *src_stream, FILE *
- 				} else {
- 					if ((dst_stream = wfopen(full_name, "w")) == NULL) {
- 						*err = -1;
--						seek_sub_file(src_stream, file_entry->size);
-+						seek_forward(src_stream, file_entry->size);
- 						goto cleanup;
- 					}
- 					archive_offset += file_entry->size;
--					*err = copy_file_chunk(src_stream, dst_stream, file_entry->size);
-+					*err = gzip_copy(src_stream, dst_stream, file_entry->size);
- 					fclose(dst_stream);
- 				}
- 				break;
-@@ -250,7 +228,7 @@ extract_archive(FILE *src_stream, FILE *
- 		/* If we arent extracting data we have to skip it,
- 		 * if data size is 0 then then just do it anyway
- 		 * (saves testing for it) */
--		seek_sub_file(src_stream, file_entry->size);
-+		seek_forward(src_stream, file_entry->size);
- 	}
- 
- 	/* extract_list and extract_verbose_list can be used in conjunction
-@@ -274,8 +252,8 @@ cleanup:
- }
- 
- static char *
--unarchive(FILE *src_stream, FILE *out_stream,
--		file_header_t *(*get_headers)(FILE *),
-+unarchive(struct gzip_handle *src_stream, FILE *out_stream,
-+		file_header_t *(*get_headers)(struct gzip_handle *),
- 		void (*free_headers)(file_header_t *),
- 		const int extract_function,
- 		const char *prefix,
-@@ -329,7 +307,7 @@ unarchive(FILE *src_stream, FILE *out_st
- 			}
- 		} else {
- 			/* seek past the data entry */
--			seek_sub_file(src_stream, file_entry->size);
-+			seek_forward(src_stream, file_entry->size);
- 		}
- 		free_headers(file_entry);
- 	}
-@@ -337,108 +315,9 @@ unarchive(FILE *src_stream, FILE *out_st
- 	return buffer;
- }
- 
--static file_header_t *
--get_header_ar(FILE *src_stream)
--{
--	file_header_t *typed;
--	union {
--		char raw[60];
--	 	struct {
-- 			char name[16];
-- 			char date[12];
-- 			char uid[6];
-- 			char gid[6];
-- 			char mode[8];
-- 			char size[10];
-- 			char magic[2];
-- 		} formated;
--	} ar;
--	static char *ar_long_names;
--
--	if (fread(ar.raw, 1, 60, src_stream) != 60) {
--		return(NULL);
--	}
--	archive_offset += 60;
--	/* align the headers based on the header magic */
--	if ((ar.formated.magic[0] != '`') || (ar.formated.magic[1] != '\n')) {
--		/* some version of ar, have an extra '\n' after each data entry,
--		 * this puts the next header out by 1 */
--		if (ar.formated.magic[1] != '`') {
--			error_msg("Invalid magic");
--			return(NULL);
--		}
--		/* read the next char out of what would be the data section,
--		 * if its a '\n' then it is a valid header offset by 1*/
--		archive_offset++;
--		if (fgetc(src_stream) != '\n') {
--			error_msg("Invalid magic");
--			return(NULL);
--		}
--		/* fix up the header, we started reading 1 byte too early */
--		/* raw_header[60] wont be '\n' as it should, but it doesnt matter */
--		memmove(ar.raw, &ar.raw[1], 59);
--	}
--
--	typed = (file_header_t *) xcalloc(1, sizeof(file_header_t));
--
--	typed->size = (size_t) atoi(ar.formated.size);
--	/* long filenames have '/' as the first character */
--	if (ar.formated.name[0] == '/') {
--		if (ar.formated.name[1] == '/') {
--			/* If the second char is a '/' then this entries data section
--			 * stores long filename for multiple entries, they are stored
--			 * in static variable long_names for use in future entries */
--			ar_long_names = (char *) xrealloc(ar_long_names, typed->size);
--			fread(ar_long_names, 1, typed->size, src_stream);
--			archive_offset += typed->size;
--			/* This ar entries data section only contained filenames for other records
--			 * they are stored in the static ar_long_names for future reference */
--			return (get_header_ar(src_stream)); /* Return next header */
--		} else if (ar.formated.name[1] == ' ') {
--			/* This is the index of symbols in the file for compilers */
--			seek_sub_file(src_stream, typed->size);
--			return (get_header_ar(src_stream)); /* Return next header */
--		} else {
--			/* The number after the '/' indicates the offset in the ar data section
--			(saved in variable long_name) that conatains the real filename */
--			if (!ar_long_names) {
--				error_msg("Cannot resolve long file name");
--				return (NULL);
--			}
--			typed->name = xstrdup(ar_long_names + atoi(&ar.formated.name[1]));
--		}
--	} else {
--		/* short filenames */
--		typed->name = xcalloc(1, 16);
--		strncpy(typed->name, ar.formated.name, 16);
--	}
--	typed->name[strcspn(typed->name, " /")]='\0';
--
--	/* convert the rest of the now valid char header to its typed struct */
--	parse_mode(ar.formated.mode, &typed->mode);
--	typed->mtime = atoi(ar.formated.date);
--	typed->uid = atoi(ar.formated.uid);
--	typed->gid = atoi(ar.formated.gid);
--
--	return(typed);
--}
--
--static void
--free_header_ar(file_header_t *ar_entry)
--{
--	if (ar_entry == NULL)
--		return;
--
--	free(ar_entry->name);
--	if (ar_entry->link_name)
--		free(ar_entry->link_name);
--
--	free(ar_entry);
--}
--
- 
- static file_header_t *
--get_header_tar(FILE *tar_stream)
-+get_header_tar(struct gzip_handle *tar_stream)
- {
- 	union {
- 		unsigned char raw[512];
-@@ -467,10 +346,10 @@ get_header_tar(FILE *tar_stream)
- 	long sum = 0;
- 
- 	if (archive_offset % 512 != 0) {
--		seek_sub_file(tar_stream, 512 - (archive_offset % 512));
-+		seek_forward(tar_stream, 512 - (archive_offset % 512));
- 	}
- 
--	if (fread(tar.raw, 1, 512, tar_stream) != 512) {
-+	if (gzip_read(tar_stream, tar.raw, 512) != 512) {
- 		/* Unfortunately its common for tar files to have all sorts of
- 		 * trailing garbage, fail silently */
- //		error_msg("Couldnt read header");
-@@ -557,7 +436,7 @@ get_header_tar(FILE *tar_stream)
- # ifdef CONFIG_FEATURE_TAR_GNU_EXTENSIONS
- 	case 'L': {
- 			longname = xmalloc(tar_entry->size + 1);
--                        if(fread(longname, tar_entry->size, 1, tar_stream) != 1)
-+                        if(gzip_read(tar_stream, longname, tar_entry->size) != tar_entry->size)
-                                 return NULL;
- 			longname[tar_entry->size] = '\0';
- 			archive_offset += tar_entry->size;
-@@ -566,7 +445,7 @@ get_header_tar(FILE *tar_stream)
- 		}
- 	case 'K': {
- 			linkname = xmalloc(tar_entry->size + 1);
--                        if(fread(linkname, tar_entry->size, 1, tar_stream) != 1)
-+                        if(gzip_read(tar_stream, linkname, tar_entry->size) != tar_entry->size)
-                                 return NULL;
- 			linkname[tar_entry->size] = '\0';
- 			archive_offset += tar_entry->size;
-@@ -642,6 +521,9 @@ deb_extract(const char *package_filename
- 	char *ared_file = NULL;
- 	char ar_magic[8];
- 	int gz_err;
-+	struct gzip_handle tar_outer, tar_inner;
-+	file_header_t *tar_header;
-+	ssize_t len;
- 
- 	*err = 0;
- 
-@@ -672,111 +554,44 @@ deb_extract(const char *package_filename
- 	/* set the buffer size */
- 	setvbuf(deb_stream, NULL, _IOFBF, 0x8000);
- 
--	/* check ar magic */
--	fread(ar_magic, 1, 8, deb_stream);
--
--	if (strncmp(ar_magic,"!<arch>",7) == 0) {
--		archive_offset = 8;
-+	memset(&tar_outer, 0, sizeof(tar_outer));
-+	tar_outer.file = deb_stream;
-+	gzip_exec(&tar_outer, NULL);
- 
--		while ((ar_header = get_header_ar(deb_stream)) != NULL) {
--			if (strcmp(ared_file, ar_header->name) == 0) {
--				int gunzip_pid = 0;
--				FILE *uncompressed_stream;
--				/* open a stream of decompressed data */
--				uncompressed_stream = gz_open(deb_stream, &gunzip_pid);
--				if (uncompressed_stream == NULL) {
--					*err = -1;
--					goto cleanup;
--				}
-+	/* walk through outer tar file to find ared_file */
-+	while ((tar_header = get_header_tar(&tar_outer)) != NULL) {
-+                    int name_offset = 0;
-+                    if (strncmp(tar_header->name, "./", 2) == 0)
-+                            name_offset = 2;
- 
--				archive_offset = 0;
--				output_buffer = unarchive(uncompressed_stream,
--						out_stream, get_header_tar,
--						free_header_tar,
--						extract_function, prefix,
--						file_list, err);
--				fclose(uncompressed_stream);
--				gz_err = gz_close(gunzip_pid);
--				if (gz_err)
--					*err = -1;
--				free_header_ar(ar_header);
--				break;
--			}
--			if (fseek(deb_stream, ar_header->size, SEEK_CUR) == -1) {
--				opkg_perror(ERROR, "Couldn't fseek into %s", package_filename);
--				*err = -1;
--				free_header_ar(ar_header);
--				goto cleanup;
--			}
--			free_header_ar(ar_header);
--		}
--		goto cleanup;
--	} else if (strncmp(ar_magic, "\037\213", 2) == 0) {
--		/* it's a gz file, let's assume it's an opkg */
--		int unzipped_opkg_pid;
--		FILE *unzipped_opkg_stream;
--		file_header_t *tar_header;
--		archive_offset = 0;
--		if (fseek(deb_stream, 0, SEEK_SET) == -1) {
--			opkg_perror(ERROR, "Couldn't fseek into %s", package_filename);
--			*err = -1;
--			goto cleanup;
--		}
--		unzipped_opkg_stream = gz_open(deb_stream, &unzipped_opkg_pid);
--		if (unzipped_opkg_stream == NULL) {
--			*err = -1;
--			goto cleanup;
--		}
-+		if (strcmp(ared_file, tar_header->name+name_offset) == 0) {
-+			memset(&tar_inner, 0, sizeof(tar_inner));
-+			tar_inner.gzip = &tar_outer;
-+			gzip_exec(&tar_inner, NULL);
- 
--		/* walk through outer tar file to find ared_file */
--		while ((tar_header = get_header_tar(unzipped_opkg_stream)) != NULL) {
--                        int name_offset = 0;
--                        if (strncmp(tar_header->name, "./", 2) == 0)
--                                name_offset = 2;
--			if (strcmp(ared_file, tar_header->name+name_offset) == 0) {
--				int gunzip_pid = 0;
--				FILE *uncompressed_stream;
--				/* open a stream of decompressed data */
--				uncompressed_stream = gz_open(unzipped_opkg_stream, &gunzip_pid);
--				if (uncompressed_stream == NULL) {
--					*err = -1;
--					goto cleanup;
--				}
--				archive_offset = 0;
-+			archive_offset = 0;
- 
--				output_buffer = unarchive(uncompressed_stream,
--							  out_stream,
--							  get_header_tar,
--							  free_header_tar,
--							  extract_function,
--							  prefix,
--							  file_list,
--							  err);
-+			output_buffer = unarchive(&tar_inner,
-+						  out_stream,
-+						  get_header_tar,
-+						  free_header_tar,
-+						  extract_function,
-+						  prefix,
-+						  file_list,
-+						  err);
- 
--				free_header_tar(tar_header);
--				fclose(uncompressed_stream);
--				gz_err = gz_close(gunzip_pid);
--				if (gz_err)
--					*err = -1;
--				break;
--			}
--			seek_sub_file(unzipped_opkg_stream, tar_header->size);
- 			free_header_tar(tar_header);
-+			gzip_close(&tar_inner);
-+			break;
- 		}
--		fclose(unzipped_opkg_stream);
--		gz_err = gz_close(unzipped_opkg_pid);
--		if (gz_err)
--			*err = -1;
- 
--		goto cleanup;
--	} else {
--		*err = -1;
--		error_msg("%s: invalid magic", package_filename);
-+		seek_forward(&tar_outer, tar_header->size);
-+		free_header_tar(tar_header);
- 	}
- 
- cleanup:
--	if (deb_stream)
--		fclose(deb_stream);
-+	gzip_close(&tar_outer);
-+
- 	if (file_list)
- 		free(file_list);
- 
---- /dev/null
-+++ b/libbb/gzip.h
-@@ -0,0 +1,41 @@
-+/*
-+ *  Copyright (C) 2016 Jo-Philipp Wich <jo@mein.io>
-+ *
-+ *  Zlib decrompression utility routines.
-+ *
-+ *  This program is free software; you can redistribute it and/or modify
-+ *  it under the terms of the GNU General Public License as published by
-+ *  the Free Software Foundation; either version 2 of the License, or
-+ *  (at your option) any later version.
-+ *
-+ *  This program is distributed in the hope that it will be useful,
-+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+ *  GNU Library General Public License for more details.
-+ *
-+ *  You should have received a copy of the GNU General Public License
-+ *  along with this program; if not, write to the Free Software
-+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-+ */
-+
-+#include <stdio.h>
-+#include <signal.h>
-+#include <pthread.h>
-+
-+struct gzip_handle {
-+	FILE *file;
-+	struct gzip_handle *gzip;
-+
-+	pid_t pid;
-+	int rfd, wfd;
-+	struct sigaction pipe_sa;
-+	pthread_t thread;
-+};
-+
-+int gzip_exec(struct gzip_handle *zh, const char *filename);
-+ssize_t gzip_read(struct gzip_handle *zh, char *buf, ssize_t len);
-+ssize_t gzip_copy(struct gzip_handle *zh, FILE *out, ssize_t len);
-+int gzip_close(struct gzip_handle *zh);
-+FILE *gzip_fdopen(struct gzip_handle *zh, const char *filename);
-+
-+#define gzip_seek(zh, len) gzip_copy(zh, NULL, len)
---- a/libbb/Makefile.am
-+++ b/libbb/Makefile.am
-@@ -4,9 +4,8 @@ ALL_CFLAGS=-g -O -Wall -DHOST_CPU_STR=\"
- 
- noinst_LIBRARIES = libbb.a
- 
--libbb_a_SOURCES = gz_open.c \
-+libbb_a_SOURCES = \
- 	libbb.h \
--	unzip.c \
- 	wfopen.c \
- 	unarchive.c \
- 	copy_file.c \
-@@ -20,7 +19,8 @@ libbb_a_SOURCES = gz_open.c \
- 	parse_mode.c \
- 	time_string.c \
- 	all_read.c \
--	mode_string.c
-+	mode_string.c \
-+	gzip.c
- 
- libbb_la_CFLAGS = $(ALL_CFLAGS)
- #libbb_la_LDFLAGS = -static
---- /dev/null
-+++ b/libbb/gzip.c
-@@ -0,0 +1,208 @@
-+/*
-+ *  Copyright (C) 2016 Jo-Philipp Wich <jo@mein.io>
-+ *  Copyright (C) 2016 Felix Fietkau <nbd@nbd.name>
-+ *
-+ *  Zlib decrompression utility routines.
-+ *
-+ *  This program is free software; you can redistribute it and/or modify
-+ *  it under the terms of the GNU General Public License as published by
-+ *  the Free Software Foundation; either version 2 of the License, or
-+ *  (at your option) any later version.
-+ *
-+ *  This program is distributed in the hope that it will be useful,
-+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+ *  GNU Library General Public License for more details.
-+ *
-+ *  You should have received a copy of the GNU General Public License
-+ *  along with this program; if not, write to the Free Software
-+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-+ */
-+
-+#include <string.h>
-+#include <errno.h>
-+#include <fcntl.h>
-+#include <unistd.h>
-+#include <poll.h>
-+#include <stdlib.h>
-+#include <sys/stat.h>
-+#include <sys/wait.h>
-+
-+#include "gzip.h"
-+
-+static void
-+to_devnull(int fd)
-+{
-+	int devnull = open("/dev/null", fd ? O_WRONLY : O_RDONLY);
-+
-+	if (devnull >= 0)
-+		dup2(devnull, fd);
-+
-+	if (devnull > STDERR_FILENO)
-+		close(devnull);
-+}
-+
-+void *
-+gzip_thread(void *ptr)
-+{
-+	struct gzip_handle *zh = ptr;
-+	char buf[4096];
-+	int len, ret;
-+
-+	while (1) {
-+		if (zh->file)
-+			len = fread(buf, 1, sizeof(buf), zh->file);
-+		else if (zh->gzip)
-+			len = gzip_read(zh->gzip, buf, sizeof(buf));
-+
-+		if (len <= 0)
-+			break;
-+
-+		do {
-+			ret = write(zh->wfd, buf, len);
-+		} while (ret == -1 && errno == EINTR);
-+	}
-+
-+	close(zh->wfd);
-+	zh->wfd = -1;
-+}
-+
-+int
-+gzip_exec(struct gzip_handle *zh, const char *filename)
-+{
-+	int rpipe[2] = { -1, -1 }, wpipe[2] = { -1, -1 };
-+	struct sigaction pipe_sa = { .sa_handler = SIG_IGN };
-+
-+	zh->rfd = -1;
-+	zh->wfd = -1;
-+
-+	if (sigaction(SIGPIPE, &pipe_sa, &zh->pipe_sa) < 0)
-+		return -1;
-+
-+	if (pipe(rpipe) < 0)
-+		return -1;
-+
-+	if (!filename && pipe(wpipe) < 0) {
-+		close(rpipe[0]);
-+		close(rpipe[1]);
-+		return -1;
-+	}
-+
-+	zh->pid = vfork();
-+
-+	switch (zh->pid) {
-+		case -1:
-+			return -1;
-+
-+		case 0:
-+			to_devnull(STDERR_FILENO);
-+
-+			if (filename) {
-+				to_devnull(STDIN_FILENO);
-+			}
-+			else {
-+				dup2(wpipe[0], STDIN_FILENO);
-+				close(wpipe[0]);
-+				close(wpipe[1]);
-+			}
-+
-+			dup2(rpipe[1], STDOUT_FILENO);
-+			close(rpipe[0]);
-+			close(rpipe[1]);
-+
-+			execlp("gzip", "gzip", "-d",  "-c", filename, NULL);
-+			exit(-1);
-+
-+		default:
-+			zh->rfd = rpipe[0];
-+			zh->wfd = wpipe[1];
-+
-+			fcntl(zh->rfd, F_SETFD, fcntl(zh->rfd, F_GETFD) | FD_CLOEXEC);
-+			close(rpipe[1]);
-+
-+			if (zh->wfd >= 0) {
-+				fcntl(zh->wfd, F_SETFD, fcntl(zh->wfd, F_GETFD) | FD_CLOEXEC);
-+				close(wpipe[0]);
-+				pthread_create(&zh->thread, NULL, gzip_thread, zh);
-+			}
-+	}
-+
-+	return 0;
-+}
-+
-+ssize_t
-+gzip_read(struct gzip_handle *zh, char *buf, ssize_t len)
-+{
-+	ssize_t ret;
-+
-+	do {
-+		ret = read(zh->rfd, buf, len);
-+	} while (ret == -1 && errno != EINTR);
-+
-+	return ret;
-+}
-+
-+ssize_t
-+gzip_copy(struct gzip_handle *zh, FILE *out, ssize_t len)
-+{
-+	char buf[4096];
-+	ssize_t rlen, total = 0;
-+
-+	while (len > 0) {
-+		rlen = gzip_read(zh, buf,
-+				    (len > sizeof(buf)) ? sizeof(buf) : len);
-+
-+		if (rlen <= 0)
-+			break;
-+
-+		if (out != NULL) {
-+			if (fwrite(buf, 1, rlen, out) != rlen)
-+				break;
-+		}
-+
-+		len -= rlen;
-+		total += rlen;
-+	}
-+
-+	return total;
-+}
-+
-+FILE *
-+gzip_fdopen(struct gzip_handle *zh, const char *filename)
-+{
-+	memset(zh, 0, sizeof(*zh));
-+
-+	if (!filename || gzip_exec(zh, filename) < 0)
-+		return NULL;
-+
-+	fcntl(zh->rfd, F_SETFL, fcntl(zh->rfd, F_GETFL) & ~O_NONBLOCK);
-+
-+	return fdopen(zh->rfd, "r");
-+}
-+
-+int
-+gzip_close(struct gzip_handle *zh)
-+{
-+	int code = -1;
-+
-+	if (zh->rfd >= 0)
-+		close(zh->rfd);
-+
-+	if (zh->wfd >= 0)
-+		close(zh->wfd);
-+
-+	if (zh->pid > 0) {
-+		kill(zh->pid, SIGKILL);
-+		waitpid(zh->pid, &code, 0);
-+	}
-+
-+	if (zh->file)
-+		fclose(zh->file);
-+
-+	if (zh->thread)
-+		pthread_join(zh->thread, NULL);
-+
-+	sigaction(SIGPIPE, &zh->pipe_sa, NULL);
-+
-+	return WIFEXITED(code) ? WEXITSTATUS(code) : -1;
-+}
---- a/src/Makefile.am
-+++ b/src/Makefile.am
-@@ -3,4 +3,4 @@ bin_PROGRAMS = opkg-cl
- 
- opkg_cl_SOURCES = opkg-cl.c
- opkg_cl_LDADD = $(top_builddir)/libopkg/libopkg.a \
--                $(top_builddir)/libbb/libbb.a $(CURL_LIBS) $(GPGME_LIBS) $(OPENSSL_LIBS) $(PATHFINDER_LIBS)
-+                $(top_builddir)/libbb/libbb.a $(CURL_LIBS) $(GPGME_LIBS) $(OPENSSL_LIBS) $(PATHFINDER_LIBS) -lpthread
---- a/tests/Makefile.am
-+++ b/tests/Makefile.am
-@@ -16,7 +16,7 @@ noinst_PROGRAMS = libopkg_test
- #opkg_active_list_test_SOURCES = opkg_active_list_test.c
- #opkg_active_list_test_CFLAGS = $(ALL_CFLAGS) -I$(top_srcdir)
- 
--libopkg_test_LDADD = $(top_builddir)/libopkg/libopkg.a $(top_builddir)/libbb/libbb.a $(CURL_LIBS) $(GPGME_LIBS) $(OPENSSL_LIBS) $(PATHFINDER_LIBS)
-+libopkg_test_LDADD = $(top_builddir)/libopkg/libopkg.a $(top_builddir)/libbb/libbb.a $(CURL_LIBS) $(GPGME_LIBS) $(OPENSSL_LIBS) $(PATHFINDER_LIBS) -lpthread
- libopkg_test_SOURCE = libopkg_test.c
- libopkg_test_LDFLAGS = -static
- 

+ 0 - 124
package/system/opkg/patches/071-use_gzipped_pkg_list.patch

@@ -1,124 +0,0 @@
---- a/libopkg/opkg.c
-+++ b/libopkg/opkg.c
-@@ -592,49 +592,8 @@ opkg_update_package_lists(opkg_progress_
- 				      src->gzip ? "Packages.gz" : "Packages");
- 
- 		sprintf_alloc(&list_file_name, "%s/%s", lists_dir, src->name);
--		if (src->gzip) {
--			FILE *in, *out;
--			struct _curl_cb_data cb_data;
--			char *tmp_file_name = NULL;
--
--			sprintf_alloc(&tmp_file_name, "%s/%s.gz", tmp,
--				      src->name);
--
--			opkg_msg(INFO, "Downloading %s to %s...\n", url,
--					tmp_file_name);
--
--			cb_data.cb = progress_callback;
--			cb_data.progress_data = &pdata;
--			cb_data.user_data = user_data;
--			cb_data.start_range =
--			    100 * sources_done / sources_list_count;
--			cb_data.finish_range =
--			    100 * (sources_done + 1) / sources_list_count;
--
--			err = opkg_download(url, tmp_file_name,
--					  (curl_progress_func) curl_progress_cb,
--					  &cb_data, 0);
- 
--			if (err == 0) {
--				opkg_msg(INFO, "Inflating %s...\n",
--						tmp_file_name);
--				in = fopen(tmp_file_name, "r");
--				out = fopen(list_file_name, "w");
--				if (in && out)
--					unzip(in, out);
--				else
--					err = 1;
--				if (in)
--					fclose(in);
--				if (out)
--					fclose(out);
--				unlink(tmp_file_name);
--			}
--			free(tmp_file_name);
--		} else
--			err = opkg_download(url, list_file_name, NULL, NULL, 0);
--
--		if (err) {
-+		if (opkg_download(url, list_file_name, NULL, NULL, 0)) {
- 			opkg_msg(ERROR, "Couldn't retrieve %s\n", url);
- 			result = -1;
- 		}
---- a/libopkg/opkg_cmd.c
-+++ b/libopkg/opkg_cmd.c
-@@ -162,30 +162,7 @@ opkg_update_cmd(int argc, char **argv)
- 	      sprintf_alloc(&url, "%s/%s", src->value, src->gzip ? "Packages.gz" : "Packages");
- 
- 	  sprintf_alloc(&list_file_name, "%s/%s", lists_dir, src->name);
--	  if (src->gzip) {
--	      char *tmp_file_name;
--	      FILE *in, *out;
--
--	      sprintf_alloc (&tmp_file_name, "%s/%s.gz", tmp, src->name);
--	      err = opkg_download(url, tmp_file_name, NULL, NULL, 0);
--	      if (err == 0) {
--		   opkg_msg(NOTICE, "Inflating %s.\n", url);
--		   in = fopen (tmp_file_name, "r");
--		   out = fopen (list_file_name, "w");
--		   if (in && out)
--			unzip (in, out);
--		   else
--			err = 1;
--		   if (in)
--			fclose (in);
--		   if (out)
--			fclose (out);
--		   unlink (tmp_file_name);
--	      }
--	      free(tmp_file_name);
--	  } else
--	      err = opkg_download(url, list_file_name, NULL, NULL, 0);
--	  if (err) {
-+	  if (opkg_download(url, list_file_name, NULL, NULL, 0)) {
- 	       failures++;
- 	  } else {
- 	       opkg_msg(NOTICE, "Updated list of available packages in %s.\n",
---- a/libopkg/pkg_hash.c
-+++ b/libopkg/pkg_hash.c
-@@ -29,6 +29,7 @@
- #include "sprintf_alloc.h"
- #include "file_util.h"
- #include "libbb/libbb.h"
-+#include "libbb/gzip.h"
- 
- void
- pkg_hash_init(void)
-@@ -106,8 +107,15 @@ pkg_hash_add_from_file(const char *file_
- 	char *buf;
- 	const size_t len = 4096;
- 	int ret = 0;
-+	struct gzip_handle zh;
-+
-+	if (src && src->gzip) {
-+		fp = gzip_fdopen(&zh, file_name);
-+	}
-+	else {
-+		fp = fopen(file_name, "r");
-+ 	}
- 
--	fp = fopen(file_name, "r");
- 	if (fp == NULL) {
- 		opkg_perror(ERROR, "Failed to open %s", file_name);
- 		return -1;
-@@ -155,6 +163,9 @@ pkg_hash_add_from_file(const char *file_
- 	free(buf);
- 	fclose(fp);
- 
-+	if (src && src->gzip)
-+		gzip_close(&zh);
-+
- 	return ret;
- }
- 

+ 0 - 16
package/system/opkg/patches/080-suppress-blank-package-fields.patch

@@ -1,16 +0,0 @@
---- 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;
- }
- 
- /*

+ 0 - 11
package/system/opkg/patches/090-suppress-blank-provides-field.patch

@@ -1,11 +0,0 @@
---- a/libopkg/pkg.c
-+++ b/libopkg/pkg.c
-@@ -731,7 +731,7 @@ pkg_formatted_field(FILE *fp, pkg_t *pkg
- 	  } else if (strcasecmp(field, "Priority") == 0) {
-                fprintf(fp, "Priority: %s\n", pkg->priority);
- 	  } else if (strcasecmp(field, "Provides") == 0) {
--	       if (pkg->provides_count) {
-+	       if (pkg->provides_count > 1) {
-                   fprintf(fp, "Provides:");
- 		  for(i = 1; i < pkg->provides_count; i++) {
-                       fprintf(fp, "%s %s", i == 1 ? "" : ",",

+ 0 - 85
package/system/opkg/patches/100-add-force-checksum.patch

@@ -1,85 +0,0 @@
---- a/libopkg/opkg_conf.c
-+++ b/libopkg/opkg_conf.c
-@@ -54,6 +54,7 @@ opkg_option_t options[] = {
- 	  { "force_reinstall", OPKG_OPT_TYPE_BOOL, &_conf.force_reinstall },
- 	  { "force_space", OPKG_OPT_TYPE_BOOL, &_conf.force_space },
- 	  { "force_postinstall", OPKG_OPT_TYPE_BOOL, &_conf.force_postinstall },
-+	  { "force_checksum", OPKG_OPT_TYPE_BOOL, &_conf.force_checksum },
-           { "check_signature", OPKG_OPT_TYPE_BOOL, &_conf.check_signature },
- 	  { "ftp_proxy", OPKG_OPT_TYPE_STRING, &_conf.ftp_proxy },
- 	  { "http_proxy", OPKG_OPT_TYPE_STRING, &_conf.http_proxy },
---- a/libopkg/opkg_conf.h
-+++ b/libopkg/opkg_conf.h
-@@ -78,6 +78,7 @@ struct opkg_conf
-      int force_removal_of_essential_packages;
-      int force_postinstall;
-      int force_remove;
-+     int force_checksum;
-      int check_signature;
-      int nodeps; /* do not follow dependencies */
-      int nocase; /* perform case insensitive matching */
---- a/libopkg/opkg_install.c
-+++ b/libopkg/opkg_install.c
-@@ -1327,12 +1327,19 @@ opkg_install_pkg(pkg_t *pkg, int from_up
-          file_md5 = file_md5sum_alloc(pkg->local_filename);
-          if (file_md5 && strcmp(file_md5, pkg->md5sum))
-          {
--              opkg_msg(ERROR, "Package %s md5sum mismatch. "
--			"Either the opkg or the package index are corrupt. "
--			"Try 'opkg update'.\n",
--			pkg->name);
--              free(file_md5);
--              return -1;
-+              if (!conf->force_checksum)
-+              {
-+                  opkg_msg(ERROR, "Package %s md5sum mismatch. "
-+			    "Either the opkg or the package index are corrupt. "
-+			    "Try 'opkg update'.\n",
-+			    pkg->name);
-+                  free(file_md5);
-+                  return -1;
-+              }
-+              else
-+              {
-+                  opkg_msg(NOTICE, "Ignored %s md5sum mismatch.\n", pkg->name);
-+              }
-          }
- 	 if (file_md5)
-               free(file_md5);
---- a/src/opkg-cl.c
-+++ b/src/opkg-cl.c
-@@ -42,6 +42,7 @@ enum {
- 	ARGS_OPT_FORCE_SPACE,
- 	ARGS_OPT_FORCE_POSTINSTALL,
- 	ARGS_OPT_FORCE_REMOVE,
-+	ARGS_OPT_FORCE_CHECKSUM,
- 	ARGS_OPT_ADD_ARCH,
- 	ARGS_OPT_ADD_DEST,
- 	ARGS_OPT_NOACTION,
-@@ -84,6 +85,8 @@ static struct option long_options[] = {
- 	{"force_postinstall", 0, 0, ARGS_OPT_FORCE_POSTINSTALL},
- 	{"force-remove", 0, 0, ARGS_OPT_FORCE_REMOVE},
- 	{"force_remove", 0, 0, ARGS_OPT_FORCE_REMOVE},
-+	{"force-checksum", 0, 0, ARGS_OPT_FORCE_CHECKSUM},
-+	{"force_checksum", 0, 0, ARGS_OPT_FORCE_CHECKSUM},
- 	{"noaction", 0, 0, ARGS_OPT_NOACTION},
- 	{"download-only", 0, 0, ARGS_OPT_DOWNLOAD_ONLY},
- 	{"nodeps", 0, 0, ARGS_OPT_NODEPS},
-@@ -178,6 +181,9 @@ args_parse(int argc, char *argv[])
- 		case ARGS_OPT_FORCE_REMOVE:
- 			conf->force_remove = 1;
- 			break;
-+		case ARGS_OPT_FORCE_CHECKSUM:
-+			conf->force_checksum = 1;
-+			break;
- 		case ARGS_OPT_NODEPS:
- 			conf->nodeps = 1;
- 			break;
-@@ -293,6 +299,7 @@ usage()
- 	printf("\t--force-space		Disable free space checks\n");
- 	printf("\t--force-postinstall	Run postinstall scripts even in offline mode\n");
- 	printf("\t--force-remove	Remove package even if prerm script fails\n");
-+	printf("\t--force-checksum	Don't fail on checksum mismatches\n");
- 	printf("\t--noaction		No action -- test only\n");
- 	printf("\t--download-only	No action -- download only\n");
- 	printf("\t--nodeps		Do not follow dependencies\n");

+ 0 - 50
package/system/opkg/patches/110-upgrade.patch

@@ -1,50 +0,0 @@
---- a/libopkg/opkg_install.c
-+++ b/libopkg/opkg_install.c
-@@ -1405,9 +1405,11 @@ opkg_install_pkg(pkg_t *pkg, int from_up
- 	  opkg_state_changed++;
- 	  pkg->state_flag |= SF_FILELIST_CHANGED;
- 
--	  if (old_pkg)
-+	  if (old_pkg) {
-                pkg_remove_orphan_dependent(pkg, old_pkg);
--
-+	       old_pkg->is_upgrade = 1;
-+	       pkg->is_upgrade = 1;
-+	  }
- 	  /* XXX: BUG: we really should treat replacement more like an upgrade
- 	   *      Instead, we're going to remove the replacees
- 	   */
-@@ -1466,7 +1468,7 @@ opkg_install_pkg(pkg_t *pkg, int from_up
- 	  }
- 
- 
--	  opkg_msg(INFO, "Installing maintainer scripts.\n");
-+	  opkg_msg(INFO, "%s maintainer scripts.\n", (pkg->is_upgrade) ? ("Upgrading") : ("Installing"));
- 	  if (install_maintainer_scripts(pkg, old_pkg)) {
- 		opkg_msg(ERROR, "Failed to extract maintainer scripts for %s."
- 			       " Package debris may remain!\n",
---- a/libopkg/pkg.c
-+++ b/libopkg/pkg.c
-@@ -1285,6 +1285,12 @@ pkg_run_script(pkg_t *pkg, const char *s
-      setenv("PKG_ROOT",
- 	    pkg->dest ? pkg->dest->root_dir : conf->default_dest->root_dir, 1);
- 
-+	if (pkg->is_upgrade)
-+		setenv("PKG_UPGRADE", "1", 1);
-+	else
-+		setenv("PKG_UPGRADE", "0", 1);
-+
-+
-      if (! file_exists(path)) {
- 	  free(path);
- 	  return 0;
---- a/libopkg/pkg.h
-+++ b/libopkg/pkg.h
-@@ -184,6 +184,7 @@ struct pkg
-      /* this flag specifies whether the package was installed to satisfy another
-       * package's dependancies */
-      int auto_installed;
-+     int is_upgrade;
- };
- 
- pkg_t *pkg_new(void);

+ 0 - 91
package/system/opkg/patches/200-usign_support.patch

@@ -1,91 +0,0 @@
---- a/configure.ac
-+++ b/configure.ac
-@@ -169,6 +169,15 @@ if test "x$want_gpgme" = "xyes"; then
-   fi
- fi
- 
-+AC_ARG_ENABLE(usign,
-+    AC_HELP_STRING([--enable-usign], [Enable signature checking with usign
-+      [[default=yes]] ]),
-+    [want_usign="$enableval"], [want_usign="yes"])
-+
-+if test "x$want_usign" = "xyes"; then
-+  AC_DEFINE(HAVE_USIGN, 1, [Define if you want usign support])
-+fi
-+
- AC_SUBST(GPGME_CFLAGS)
- AC_SUBST(GPGME_LIBS)
- 
---- a/libopkg/opkg.c
-+++ b/libopkg/opkg.c
-@@ -599,7 +599,7 @@ opkg_update_package_lists(opkg_progress_
- 		}
- 		free(url);
- 
--#if defined(HAVE_GPGME) || defined(HAVE_OPENSSL)
-+#if defined(HAVE_GPGME) || defined(HAVE_OPENSSL) || defined(HAVE_USIGN)
- 		if (conf->check_signature) {
- 			char *sig_file_name;
- 			/* download detached signitures to verify the package lists */
---- a/libopkg/opkg_cmd.c
-+++ b/libopkg/opkg_cmd.c
-@@ -169,7 +169,7 @@ opkg_update_cmd(int argc, char **argv)
- 			    list_file_name);
- 	  }
- 	  free(url);
--#if defined(HAVE_GPGME) || defined(HAVE_OPENSSL)
-+#if defined(HAVE_GPGME) || defined(HAVE_OPENSSL) || defined(HAVE_USIGN)
-           if (conf->check_signature) {
-               /* download detached signitures to verify the package lists */
-               /* get the url for the sig file */
---- a/libopkg/opkg_install.c
-+++ b/libopkg/opkg_install.c
-@@ -1288,7 +1288,7 @@ opkg_install_pkg(pkg_t *pkg, int from_up
-      }
- 
-      /* check that the repository is valid */
--     #if defined(HAVE_GPGME) || defined(HAVE_OPENSSL)
-+     #if defined(HAVE_GPGME) || defined(HAVE_OPENSSL) || defined(HAVE_USIGN)
-      char *list_file_name, *sig_file_name, *lists_dir;
- 
-      /* check to ensure the package has come from a repository */
---- a/libopkg/opkg_download.c
-+++ b/libopkg/opkg_download.c
-@@ -19,6 +19,7 @@
- 
- #include "config.h"
- 
-+#include <sys/wait.h>
- #include <stdio.h>
- #include <unistd.h>
- #include <libgen.h>
-@@ -342,7 +343,28 @@ opkg_prepare_url_for_install(const char
- int
- opkg_verify_file (char *text_file, char *sig_file)
- {
--#if defined HAVE_GPGME
-+#if defined HAVE_USIGN
-+	int status = -1;
-+	int pid;
-+
-+    if (conf->check_signature == 0 )
-+        return 0;
-+
-+	pid = fork();
-+	if (pid < 0)
-+		return -1;
-+
-+	if (!pid) {
-+		execl("/usr/sbin/opkg-key", "opkg-key", "verify", sig_file, text_file, NULL);
-+		exit(255);
-+	}
-+
-+	waitpid(pid, &status, 0);
-+	if (!WIFEXITED(status) || WEXITSTATUS(status))
-+		return -1;
-+
-+	return 0;
-+#elif defined HAVE_GPGME
-     if (conf->check_signature == 0 )
-         return 0;
-     int status = -1;

+ 0 - 70
package/system/opkg/patches/210-add-force-signature.patch

@@ -1,70 +0,0 @@
---- a/libopkg/opkg_conf.h
-+++ b/libopkg/opkg_conf.h
-@@ -80,6 +80,7 @@ struct opkg_conf
-      int force_remove;
-      int force_checksum;
-      int check_signature;
-+     int force_signature;
-      int nodeps; /* do not follow dependencies */
-      int nocase; /* perform case insensitive matching */
-      char *offline_root;
---- a/src/opkg-cl.c
-+++ b/src/opkg-cl.c
-@@ -51,6 +51,7 @@ enum {
- 	ARGS_OPT_NOCASE,
- 	ARGS_OPT_AUTOREMOVE,
- 	ARGS_OPT_CACHE,
-+	ARGS_OPT_FORCE_SIGNATURE,
- };
- 
- static struct option long_options[] = {
-@@ -87,6 +88,8 @@ static struct option long_options[] = {
- 	{"force_remove", 0, 0, ARGS_OPT_FORCE_REMOVE},
- 	{"force-checksum", 0, 0, ARGS_OPT_FORCE_CHECKSUM},
- 	{"force_checksum", 0, 0, ARGS_OPT_FORCE_CHECKSUM},
-+	{"force-signature", 0, 0, ARGS_OPT_FORCE_SIGNATURE},
-+	{"force_signature", 0, 0, ARGS_OPT_FORCE_SIGNATURE},
- 	{"noaction", 0, 0, ARGS_OPT_NOACTION},
- 	{"download-only", 0, 0, ARGS_OPT_DOWNLOAD_ONLY},
- 	{"nodeps", 0, 0, ARGS_OPT_NODEPS},
-@@ -210,6 +213,9 @@ args_parse(int argc, char *argv[])
-         case ARGS_OPT_DOWNLOAD_ONLY:
- 			conf->download_only = 1;
- 			break;
-+		case ARGS_OPT_FORCE_SIGNATURE:
-+			conf->force_signature = 1;
-+			break;
- 		case ':':
- 			parse_err = -1;
- 			break;
---- a/libopkg/opkg_install.c
-+++ b/libopkg/opkg_install.c
-@@ -1306,13 +1306,15 @@ opkg_install_pkg(pkg_t *pkg, int from_up
-          if (opkg_verify_file (list_file_name, sig_file_name)){
-            opkg_msg(ERROR, "Failed to verify the signature of %s.\n",
-                            list_file_name);
--           return -1;
-+           if (!conf->force_signature)
-+             return -1;
-          }
-        }else{
-          opkg_msg(ERROR, "Signature file is missing for %s. "
-                          "Perhaps you need to run 'opkg update'?\n",
- 			 pkg->name);
--         return -1;
-+         if (!conf->force_signature)
-+           return -1;
-        }
- 
-        free (lists_dir);
---- a/libopkg/opkg_cmd.c
-+++ b/libopkg/opkg_cmd.c
-@@ -196,7 +196,7 @@ opkg_update_cmd(int argc, char **argv)
-                   else
-                       opkg_msg(NOTICE, "Signature check failed.\n");
-               }
--              if (err) {
-+              if (err && !conf->force_signature) {
-                   /* The signature was wrong so delete it */
-                   opkg_msg(NOTICE, "Remove wrong Signature file.\n");
-                   unlink (tmp_file_name);

+ 0 - 812
package/system/opkg/patches/220-drop-release-support.patch

@@ -1,812 +0,0 @@
---- a/libopkg/Makefile.am
-+++ b/libopkg/Makefile.am
-@@ -15,7 +15,6 @@ opkg_cmd_sources = opkg_cmd.c opkg_cmd.h
- 		   opkg_upgrade.c opkg_upgrade.h \
- 		   opkg_remove.c opkg_remove.h
- opkg_db_sources = opkg_conf.c opkg_conf.h \
--		  release.c release.h release_parse.c release_parse.h \
- 		  opkg_utils.c opkg_utils.h pkg.c pkg.h hash_table.h \
- 		  pkg_depends.c pkg_depends.h pkg_extract.c pkg_extract.h \
- 		  hash_table.c pkg_hash.c pkg_hash.h pkg_parse.c pkg_parse.h \
-@@ -28,7 +27,6 @@ opkg_list_sources = conffile.c conffile.
- 		    active_list.c active_list.h list.h 
- opkg_util_sources = file_util.c file_util.h opkg_message.h opkg_message.c md5.c md5.h \
- 		    parse_util.c parse_util.h \
--		    cksum_list.c cksum_list.h \
- 		    sprintf_alloc.c sprintf_alloc.h \
- 		    xregex.c xregex.h xsystem.c xsystem.h
- if HAVE_PATHFINDER
---- a/libopkg/cksum_list.c
-+++ /dev/null
-@@ -1,87 +0,0 @@
--/* cksum_lis.c - the opkg package management system
--
--   Copyright (C) 2010,2011 Javier Palacios
--
--   This program is free software; you can redistribute it and/or
--   modify it under the terms of the GNU General Public License as
--   published by the Free Software Foundation; either version 2, or (at
--   your option) any later version.
--
--   This program is distributed in the hope that it will be useful, but
--   WITHOUT ANY WARRANTY; without even the implied warranty of
--   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
--   General Public License for more details.
--*/
--
--#include "config.h"
--
--#include <stdio.h>
--
--#include "cksum_list.h"
--#include "libbb/libbb.h"
--
--
--int cksum_init(cksum_t *cksum, char **itemlist)
--{
--    cksum->value = xstrdup(*itemlist++);
--    cksum->size = atoi(*itemlist++);
--    cksum->name = xstrdup(*itemlist++);
--
--    return 0;
--}
--
--void cksum_deinit(cksum_t *cksum)
--{
--    free (cksum->name);
--    cksum->name = NULL;
--
--    free (cksum->value);
--    cksum->value = NULL;
--}
--
--void cksum_list_init(cksum_list_t *list)
--{
--    void_list_init((void_list_t *) list);
--}
--
--void cksum_list_deinit(cksum_list_t *list)
--{
--    cksum_list_elt_t *iter, *n;
--    cksum_t *cksum;
--
--    list_for_each_entry_safe(iter, n, &list->head, node) {
--      cksum = (cksum_t *)iter->data;
--      cksum_deinit(cksum);
--
--      /* malloced in cksum_list_append */
--      free(cksum);
--      iter->data = NULL;
--    }
--    void_list_deinit((void_list_t *) list);
--}
--
--cksum_t *cksum_list_append(cksum_list_t *list, char **itemlist)
--{
--    /* freed in cksum_list_deinit */
--    cksum_t *cksum = xcalloc(1, sizeof(cksum_t));
--    cksum_init(cksum, itemlist);
--
--    void_list_append((void_list_t *) list, cksum);
--
--    return cksum;
--}
--
--const cksum_t *cksum_list_find(cksum_list_t *list, const char *name)
--{
--     cksum_list_elt_t *iter;
--     cksum_t *cksum;
--
--     list_for_each_entry(iter, &list->head, node) {
--	  cksum = (cksum_t *)iter->data;
--	  if (strcmp(cksum->name, name) == 0) {
--	       return cksum;
--	  }
--     }    
--     return NULL;
--}
--
---- a/libopkg/cksum_list.h
-+++ /dev/null
-@@ -1,46 +0,0 @@
--/* cksum_list.h - the opkg package management system
--
--   Copyright (C) 2010,2011 Javier Palacios
--
--   This program is free software; you can redistribute it and/or
--   modify it under the terms of the GNU General Public License as
--   published by the Free Software Foundation; either version 2, or (at
--   your option) any later version.
--
--   This program is distributed in the hope that it will be useful, but
--   WITHOUT ANY WARRANTY; without even the implied warranty of
--   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
--   General Public License for more details.
--*/
--
--#ifndef CKSUM_LIST_H
--#define CKSUM_LIST_H
--
--typedef struct 
--{
--  char *name;
--  char *value;
--  int size;
--} cksum_t;
--
--int cksum_init(cksum_t *cksum, char **itemlist);
--void cksum_deinit(cksum_t *cksum);
--
--#include "void_list.h"
--
--typedef struct void_list_elt cksum_list_elt_t;
--
--typedef struct void_list cksum_list_t;
--
--static inline int cksum_list_empty(cksum_list_t *list)
--{
--    return void_list_empty ((void_list_t *)list);
--}
--
--void cksum_list_init(cksum_list_t *list);
--void cksum_list_deinit(cksum_list_t *list);
--
--cksum_t *cksum_list_append(cksum_list_t *list, char **itemlist);
--const cksum_t *cksum_list_find(cksum_list_t *list, const char *name);
--
--#endif
---- a/libopkg/release.c
-+++ /dev/null
-@@ -1,342 +0,0 @@
--/* release.c - the opkg package management system
--
--   Copyright (C) 2010,2011 Javier Palacios
--
--   This program is free software; you can redistribute it and/or
--   modify it under the terms of the GNU General Public License as
--   published by the Free Software Foundation; either version 2, or (at
--   your option) any later version.
--
--   This program is distributed in the hope that it will be useful, but
--   WITHOUT ANY WARRANTY; without even the implied warranty of
--   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
--   General Public License for more details.
--*/
--
--#include <unistd.h>
--#include <ctype.h>
--
--#include "release.h"
--#include "opkg_utils.h"
--#include "libbb/libbb.h"
--
--#include "opkg_download.h"
--#include "sprintf_alloc.h"
--
--#include "release_parse.h"
--
--#include "parse_util.h"
--#include "file_util.h"
--
--static void
--release_init(release_t *release)
--{
--     release->name = NULL;
--     release->datestring = NULL;
--     release->architectures = NULL;
--     release->architectures_count = 0;
--     release->components = NULL;
--     release->components_count = 0;
--     release->complist = NULL;
--     release->complist_count = 0;
--}
--
--release_t *
--release_new(void)
--{
--     release_t *release;
--
--     release = xcalloc(1, sizeof(release_t));
--     release_init(release);
--
--     return release;
--}
--
--void
--release_deinit(release_t *release)
--{
--    int i;
--
--    free(release->name);
--    free(release->datestring);
--
--    for(i = 0; i < release->architectures_count; i++){
--	free(release->architectures[i]);
--    }
--    free(release->architectures);
--
--    for(i = 0; i < release->components_count; i++){
--	free(release->components[i]);
--    }
--    free(release->components);
--
--    for(i = 0; i < release->complist_count; i++){
--	free(release->complist[i]);
--    }
--    free(release->complist);
--
--}
--
--int
--release_init_from_file(release_t *release, const char *filename)
--{
--	int err = 0;
--	FILE *release_file;
--
--	release_file = fopen(filename, "r");
--	if (release_file == NULL) {
--		opkg_perror(ERROR, "Failed to open %s", filename);
--		return -1;
--	}
--
--	err=release_parse_from_stream(release, release_file);
--	if (!err) {
--		if (!release_arch_supported(release)) {
--			opkg_msg(ERROR, "No valid architecture found on Release file.\n");
--			err = -1;
--		}
--	}
--
--	return err;
--}
--
--const char *
--item_in_list(const char *comp, char **complist, const unsigned int count)
--{
--     int i;
--
--     if (!complist)
--	  return comp;
--
--     for(i = 0; i < count; i++){
--	  if (strcmp(comp, complist[i]) == 0)
--		    return complist[i];
--     }
--
--     return NULL;
--}
--
--int
--release_arch_supported(release_t *release)
--{
--     nv_pair_list_elt_t *l;
--
--     list_for_each_entry(l , &conf->arch_list.head, node) {
--	  nv_pair_t *nv = (nv_pair_t *)l->data;
--	  if (item_in_list(nv->name, release->architectures, release->architectures_count)) {
--	       opkg_msg(DEBUG, "Arch %s (priority %s) supported for dist %s.\n",
--			       nv->name, nv->value, release->name);
--	       return 1;
--	  }
--     }
--
--     return 0;
--}
--
--int
--release_comps_supported(release_t *release, const char *complist)
--{
--     int ret = 1;
--     int i;
--
--     if (complist) {
--	  release->complist = parse_list(complist, &release->complist_count, ' ', 1);
--	  for(i = 0; i < release->complist_count; i++){
--	       if (!item_in_list(release->complist[i], release->components, release->components_count)) {
--		    opkg_msg(ERROR, "Component %s not supported for dist %s.\n",
--				    release->complist[i], release->name);
--		    ret = 0;
--	       }
--	  }
--     }
--
--     return ret;
--}
--
--const char **
--release_comps(release_t *release, unsigned int *count)
--{
--     char **comps = release->complist;
--
--     if (!comps) {
--	  comps = release->components;
--	  *count = release->components_count;
--     } else {
--	  *count = release->complist_count;
--     }
--
--     return (const char **)comps;
--}
--
--int
--release_download(release_t *release, pkg_src_t *dist, char *lists_dir, char *tmpdir)
--{
--     int ret = 0;
--     unsigned int ncomp;
--     const char **comps = release_comps(release, &ncomp);
--     nv_pair_list_elt_t *l;
--     int i;
--
--     for(i = 0; i < ncomp; i++){
--	  int err = 0;
--	  char *prefix;
--
--	  sprintf_alloc(&prefix, "%s/dists/%s/%s/binary", dist->value, dist->name,
--			comps[i]);
--
--	  list_for_each_entry(l , &conf->arch_list.head, node) {
--	       char *url;
--	       char *tmp_file_name, *list_file_name;
--	       char *subpath = NULL;
--
--	       nv_pair_t *nv = (nv_pair_t *)l->data;
--
--	       sprintf_alloc(&list_file_name, "%s/%s-%s-%s", lists_dir, dist->name, comps[i], nv->name);
--
--	       sprintf_alloc(&tmp_file_name, "%s/%s-%s-%s%s", tmpdir, dist->name, comps[i], nv->name, ".gz");
--
--	       sprintf_alloc(&subpath, "%s/binary-%s/%s", comps[i], nv->name, dist->gzip ? "Packages.gz" : "Packages");
--
--	       if (dist->gzip) {
--	       sprintf_alloc(&url, "%s-%s/Packages.gz", prefix, nv->name);
--	       err = opkg_download(url, tmp_file_name, NULL, NULL, 1);
--	       if (!err) {
--		    err = release_verify_file(release, tmp_file_name, subpath);
--		    if (err) {
--			 unlink (tmp_file_name);
--			 unlink (list_file_name);
--		    }
--	       }
--	       if (!err) {
--		    FILE *in, *out;
--		    opkg_msg(NOTICE, "Inflating %s.\n", url);
--		    in = fopen (tmp_file_name, "r");
--		    out = fopen (list_file_name, "w");
--		    if (in && out) {
--			 err = unzip (in, out);
--			 if (err)
--			      opkg_msg(INFO, "Corrumpt file at %s.\n", url);
--		    } else
--			 err = 1;
--		    if (in)
--			 fclose (in);
--		    if (out)
--			 fclose (out);
--		    unlink (tmp_file_name);
--	       }
--	       free(url);
--	       }
--
--	       if (err) {
--		    sprintf_alloc(&url, "%s-%s/Packages