opkg: update to r503 - reduces peak memory usage by further 20%, rebased patches...
authorJo-Philipp Wich <jow@openwrt.org>
Sun, 20 Dec 2009 21:21:14 +0000 (21:21 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Sun, 20 Dec 2009 21:21:14 +0000 (21:21 +0000)
SVN-Revision: 18864

package/opkg/Makefile
package/opkg/patches/003-fs_overlay_support.patch
package/opkg/patches/004-host_cpu.patch
package/opkg/patches/005-uninitialized_err.patch [deleted file]
package/opkg/patches/007-force_static.patch
package/opkg/patches/009-remove-upgrade-all.patch
package/opkg/patches/010-remove-flag.patch
package/opkg/patches/011-old-config-location.patch [new file with mode: 0644]

index 9c87e482c9268e227270dddb56d2850aa7c9ef9f..6cabdec30587fc3e1908e62f3fe59c9d7a3ecebe 100644 (file)
@@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
 include $(INCLUDE_DIR)/kernel.mk
 
 PKG_NAME:=opkg
-PKG_REV:=284
+PKG_REV:=503
 PKG_VERSION:=$(PKG_REV)
 PKG_RELEASE:=1
 
index f84060ab1411507f2161084cd9cefdbc5b0d7cda..8d18c28d2cc7f843489786fab7de93ae2c7f1239 100644 (file)
@@ -6,56 +6,37 @@ Signed-off-by: Nicolas Thill <nico@openwrt.org>
 
 --- a/libopkg/opkg_conf.c
 +++ b/libopkg/opkg_conf.c
-@@ -72,6 +72,7 @@
-         { "offline_root_path", OPKG_OPT_TYPE_STRING, &conf->offline_root_path },
-         { "offline_root_post_script_cmd", OPKG_OPT_TYPE_STRING, &conf->offline_root_post_script_cmd },
-         { "offline_root_pre_script_cmd", OPKG_OPT_TYPE_STRING, &conf->offline_root_pre_script_cmd },
-+        { "overlay_root", OPKG_OPT_TYPE_STRING, &conf->overlay_root },
-         { "proxy_passwd", OPKG_OPT_TYPE_STRING, &conf->proxy_passwd },
-         { "proxy_user", OPKG_OPT_TYPE_STRING, &conf->proxy_user },
-         { "query-all", OPKG_OPT_TYPE_BOOL, &conf->query_all },
+@@ -58,6 +58,7 @@
+         { "noaction", OPKG_OPT_TYPE_BOOL, &_conf.noaction },
+         { "nodeps", OPKG_OPT_TYPE_BOOL, &_conf.nodeps },
+         { "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 },
+         { "proxy_user", OPKG_OPT_TYPE_STRING, &_conf.proxy_user },
+         { "query-all", OPKG_OPT_TYPE_BOOL, &_conf.query_all },
 --- a/libopkg/opkg_conf.h
 +++ b/libopkg/opkg_conf.h
-@@ -70,6 +70,7 @@
-      char *offline_root_path;
-      char *offline_root_pre_script_cmd;
-      char *offline_root_post_script_cmd;
+@@ -74,6 +74,7 @@
+      int check_signature;
+      int nodeps; /* do not follow dependences */
+      char *offline_root;
 +     char *overlay_root;
       int query_all;
       int verbosity;
       int noaction;
 --- a/libopkg/opkg_install.c
 +++ b/libopkg/opkg_install.c
-@@ -470,12 +470,15 @@
-      *    my diddling with the .opk file size below isn't going to cut it.
-      * 3) return a proper error code instead of 1
-      */
--     int comp_size, blocks_available;
-+     int comp_size, blocks_available = -1;
-      char *root_dir;
-     
-      if (!conf->force_space && pkg->installed_size != NULL) {
-           root_dir = pkg->dest ? pkg->dest->root_dir : conf->default_dest->root_dir;
--        blocks_available = get_available_blocks(root_dir);
-+        if (conf->overlay_root != NULL)
-+              blocks_available = get_available_blocks(conf->overlay_root);
-+        if (blocks_available < 0)
-+              blocks_available = get_available_blocks(root_dir);
+@@ -194,8 +194,11 @@
+       if (conf->force_space || pkg->installed_size == 0)
+               return 0;
  
-         comp_size = strtoul(pkg->installed_size, NULL, 0);
-         /* round up a blocks count without doing fancy-but-slow casting jazz */ 
---- a/libopkg/opkg_utils.c
-+++ b/libopkg/opkg_utils.c
-@@ -31,10 +31,8 @@
- {
-     struct statfs sfs;
+-      root_dir = pkg->dest ? pkg->dest->root_dir :
+-                                              conf->default_dest->root_dir;
++      root_dir = pkg->dest
++              ? pkg->dest->root_dir
++              : conf->overlay_root
++                      ? conf->overlay_root
++                      : conf->default_dest->root_dir;
+       kbs_available = get_available_kbytes(root_dir);
  
--    if(statfs(filesystem, &sfs)){
--        fprintf(stderr, "bad statfs\n");
--        return 0;
--    }
-+    if(statfs(filesystem, &sfs))
-+        return -1;
-     /*    fprintf(stderr, "reported fs type %x\n", sfs.f_type); */
-     // Actually ((sfs.f_bavail * sfs.f_bsize) / 1024) 
+       pkg_size_kbs = (pkg->installed_size + 1023)/1024;
index ad1c74c580137453f74dd64ae9b9609f555cf519..6c14e03a8fcceafad4e16a6660ea7cfe98714a1f 100644 (file)
@@ -12,9 +12,9 @@
 +++ b/libopkg/Makefile.am
 @@ -1,5 +1,5 @@
 -
--AM_CFLAGS=-Wall -Werror -DHOST_CPU_STR=\"@host_cpu@\" -DBUILD_CPU=@build_cpu@ -DLIBDIR=\"@libdir@\" -DOPKGLIBDIR=\"@opkglibdir@\" -DOPKGETCDIR=\"@opkgetcdir@\" -DDATADIR=\"@datadir@\" -I$(top_srcdir) $(BIGENDIAN_CFLAGS) $(CURL_CFLAGS) $(GPGME_CFLAGS) $(PATHFINDER_CFLAGS)
+-AM_CFLAGS=-Wall -DHOST_CPU_STR=\"@host_cpu@\" -DBUILD_CPU=@build_cpu@ -DLIBDIR=\"@libdir@\" -DOPKGLIBDIR=\"@opkglibdir@\" -DOPKGETCDIR=\"@opkgetcdir@\" -DDATADIR=\"@datadir@\" -I$(top_srcdir) $(BIGENDIAN_CFLAGS) $(CURL_CFLAGS) $(GPGME_CFLAGS) $(PATHFINDER_CFLAGS)
 +HOST_CPU=@host_cpu@
-+AM_CFLAGS=-Wall -Werror -DHOST_CPU_STR=\"$(HOST_CPU)\" -DBUILD_CPU=@build_cpu@ -DLIBDIR=\"@libdir@\" -DOPKGLIBDIR=\"@opkglibdir@\" -DOPKGETCDIR=\"@opkgetcdir@\" -DDATADIR=\"@datadir@\" -I$(top_srcdir) $(BIGENDIAN_CFLAGS) $(CURL_CFLAGS) $(GPGME_CFLAGS) $(PATHFINDER_CFLAGS)
++AM_CFLAGS=-Wall -DHOST_CPU_STR=\"$(HOST_CPU)\" -DBUILD_CPU=@build_cpu@ -DLIBDIR=\"@libdir@\" -DOPKGLIBDIR=\"@opkglibdir@\" -DOPKGETCDIR=\"@opkgetcdir@\" -DDATADIR=\"@datadir@\" -I$(top_srcdir) $(BIGENDIAN_CFLAGS) $(CURL_CFLAGS) $(GPGME_CFLAGS) $(PATHFINDER_CFLAGS)
  
  libopkg_includedir=$(includedir)/libopkg
- libopkg_include_HEADERS= opkg.h
+ libopkg_include_HEADERS= *.h
diff --git a/package/opkg/patches/005-uninitialized_err.patch b/package/opkg/patches/005-uninitialized_err.patch
deleted file mode 100644 (file)
index 0d3b6cf..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
---- a/libopkg/pkg_hash.c
-+++ b/libopkg/pkg_hash.c
-@@ -384,8 +384,11 @@
-      abstract_pkg_t *apkg = NULL;
-      pkg_t *ret;
--     if (!(apkg = abstract_pkg_fetch_by_name(hash, name)))
--        return NULL;
-+     if (!(apkg = abstract_pkg_fetch_by_name(hash, name))) {
-+      if (err)
-+        *err = 0;
-+      return NULL;
-+     }
-      ret = pkg_hash_fetch_best_installation_candidate(conf, apkg, pkg_name_constraint_fcn, apkg->name, 0, err);
index 632250863892df3a36100dd28e36a644f6a7695d..cda8537388281d4abbeb90de06e93c07a0546c0a 100644 (file)
@@ -15,7 +15,7 @@
 -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_la_LDFLAGS = -export-symbols-regex "^opkg_.*"
 -
 -
 -
        libbb.h \
        unzip.c \
        wfopen.c \
---- a/src/Makefile.am
-+++ b/src/Makefile.am
-@@ -2,5 +2,5 @@
- bin_PROGRAMS = opkg-cl
- opkg_cl_SOURCES = opkg-frontend.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
 --- a/tests/Makefile.am
 +++ b/tests/Makefile.am
+@@ -4,11 +4,11 @@
+ #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 @@
  #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
  libopkg_test_SOURCE = libopkg_test.c
+ libopkg_test_LDFLAGS = -static
  
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -2,5 +2,5 @@
+ 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
index d2440e031f74c8254753a3cbc0a7691a69cc08bb..82c231ea194d51b1c620bb320cd2d81b43bb7328 100644 (file)
@@ -1,40 +1,29 @@
---- a/libopkg/args.c
-+++ b/libopkg/args.c
-@@ -259,7 +259,7 @@
-     
-      printf("\nPackage Manipulation:\n");
-      printf("\tupdate                 Update list of available packages\n");
--     printf("\tupgrade                        Upgrade all installed packages to latest version\n");
-+     printf("\tupgrade <pkg>          Upgrade package to latest version\n");
-      printf("\tinstall <pkg>          Download and install <pkg> (and dependencies)\n");
-      printf("\tinstall <file.opk>     Install package <file.opk>\n");
-      printf("\tconfigure [<pkg>]      Configure unpacked packages\n");
 --- a/libopkg/opkg_cmd.c
 +++ b/libopkg/opkg_cmd.c
-@@ -75,7 +75,7 @@
-    array for easier maintenance */
- static opkg_cmd_t cmds[] = {
-      {"update", 0, (opkg_cmd_fun_t)opkg_update_cmd}, 
--     {"upgrade", 0, (opkg_cmd_fun_t)opkg_upgrade_cmd},
-+     {"upgrade", 1, (opkg_cmd_fun_t)opkg_upgrade_cmd},
-      {"list", 0, (opkg_cmd_fun_t)opkg_list_cmd},
-      {"list_installed", 0, (opkg_cmd_fun_t)opkg_list_installed_cmd},
-      {"list_upgradable", 0, (opkg_cmd_fun_t)opkg_list_upgradable_cmd},
-@@ -607,17 +607,6 @@
-                   opkg_install_by_name(conf, arg);
+@@ -495,17 +495,6 @@
+                   opkg_install_by_name(arg);
                 }
          }
 -     } else {
 -        pkg_vec_t *installed = pkg_vec_alloc();
 -
--        pkg_info_preinstall_check(conf);
+-        pkg_info_preinstall_check();
 -
--        pkg_hash_fetch_all_installed(&conf->pkg_hash, installed);
+-        pkg_hash_fetch_all_installed(installed);
 -        for (i = 0; i < installed->len; i++) {
 -             pkg = installed->pkgs[i];
--             opkg_upgrade_pkg(conf, pkg);
+-             opkg_upgrade_pkg(pkg);
 -        }
 -        pkg_vec_free(installed);
       }
  
-      opkg_configure_packages(conf, NULL);
+      opkg_configure_packages(NULL);
+@@ -1163,7 +1152,7 @@
+    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},
index 9b988b89e0f9a74c3489bffddbc71de16a0da879..a85e06e6a7505844b787757092281fa5dffc0ae4 100644 (file)
@@ -1,78 +1,60 @@
---- a/libopkg/args.c
-+++ b/libopkg/args.c
-@@ -264,8 +264,6 @@
-      printf("\tinstall <file.opk>     Install package <file.opk>\n");
-      printf("\tconfigure [<pkg>]      Configure unpacked packages\n");
-      printf("\tremove <pkg|regexp>    Remove package <pkg|packages following regexp>\n");
--     printf("\tflag <flag> <pkg> ...  Flag package(s) <pkg>\n");
--     printf("\t <flag>=hold|noprune|user|ok|installed|unpacked (one per invocation)   \n");
-     
-      printf("\nInformational Commands:\n");
-      printf("\tlist                   List available packages and descriptions\n");
 --- a/libopkg/opkg_cmd.c
 +++ b/libopkg/opkg_cmd.c
-@@ -54,7 +54,6 @@
- static int opkg_list_upgradable_cmd(opkg_conf_t *conf, int argc, char **argv);
- static int opkg_remove_cmd(opkg_conf_t *conf, int argc, char **argv);
- static int opkg_purge_cmd(opkg_conf_t *conf, int argc, char **argv);
--static int opkg_flag_cmd(opkg_conf_t *conf, int argc, char **argv);
- static int opkg_files_cmd(opkg_conf_t *conf, int argc, char **argv);
- static int opkg_search_cmd(opkg_conf_t *conf, int argc, char **argv);
- static int opkg_download_cmd(opkg_conf_t *conf, int argc, char **argv);
-@@ -80,7 +79,6 @@
-      {"list_installed", 0, (opkg_cmd_fun_t)opkg_list_installed_cmd},
-      {"list_upgradable", 0, (opkg_cmd_fun_t)opkg_list_upgradable_cmd},
-      {"info", 0, (opkg_cmd_fun_t)opkg_info_cmd},
--     {"flag", 1, (opkg_cmd_fun_t)opkg_flag_cmd},
-      {"status", 0, (opkg_cmd_fun_t)opkg_status_cmd},
-      {"install_pending", 0, (opkg_cmd_fun_t)opkg_install_pending_cmd},
-      {"install", 1, (opkg_cmd_fun_t)opkg_install_cmd},
-@@ -960,48 +958,6 @@
-      return 0;
+@@ -735,49 +735,6 @@
  }
  
--static int opkg_flag_cmd(opkg_conf_t *conf, int argc, char **argv)
+ static int
+-opkg_flag_cmd(int argc, char **argv)
 -{
 -     int i;
 -     pkg_t *pkg;
 -     const char *flags = argv[0];
 -    
--     global_conf = conf;
 -     signal(SIGINT, sigint_handler);
 -
 -     for (i=1; i < argc; i++) {
 -        if (conf->restrict_to_default_dest) {
--             pkg = pkg_hash_fetch_installed_by_name_dest(&conf->pkg_hash,
--                                                         argv[i],
+-             pkg = pkg_hash_fetch_installed_by_name_dest(argv[i],
 -                                                         conf->default_dest);
 -        } else {
--             pkg = pkg_hash_fetch_installed_by_name(&conf->pkg_hash, argv[i]);
+-             pkg = pkg_hash_fetch_installed_by_name(argv[i]);
 -        }
 -
 -        if (pkg == NULL) {
--             opkg_message(conf, OPKG_ERROR,
--                          "Package %s is not installed.\n", argv[i]);
+-             opkg_msg(ERROR, "Package %s is not installed.\n", argv[i]);
 -             continue;
 -        }
 -          if (( strcmp(flags,"hold")==0)||( strcmp(flags,"noprune")==0)||
 -              ( strcmp(flags,"user")==0)||( strcmp(flags,"ok")==0)) {
 -            pkg->state_flag = pkg_state_flag_from_str(flags);
 -          }
--/* pb_ asked this feature 03292004 */
--/* Actually I will use only this two, but this is an open for various status */
+-
+-        /* 
+-         * Useful if a package is installed in an offline_root, and
+-         * should be configured by opkg-cl configure at a later date.
+-         */
 -          if (( strcmp(flags,"installed")==0)||( strcmp(flags,"unpacked")==0)){
 -            pkg->state_status = pkg_state_status_from_str(flags);
 -          }
+-
 -        opkg_state_changed++;
--        opkg_message(conf, OPKG_NOTICE,
--                     "Setting flags for package %s to %s\n",
+-        opkg_msg(NOTICE, "Setting flags for package %s to %s.\n",
 -                     pkg->name, flags);
 -     }
 -
--     write_status_files_if_changed(conf);
+-     write_status_files_if_changed();
 -     return 0;
 -}
 -
- static int opkg_files_cmd(opkg_conf_t *conf, int argc, char **argv)
+-static int
+ opkg_files_cmd(int argc, char **argv)
  {
       pkg_t *pkg;
+@@ -1159,7 +1116,6 @@
+      {"list_upgradable", 0, (opkg_cmd_fun_t)opkg_list_upgradable_cmd, PFM_SOURCE},
+      {"list-upgradable", 0, (opkg_cmd_fun_t)opkg_list_upgradable_cmd, PFM_SOURCE},
+      {"info", 0, (opkg_cmd_fun_t)opkg_info_cmd, 0},
+-     {"flag", 1, (opkg_cmd_fun_t)opkg_flag_cmd, PFM_DESCRIPTION|PFM_SOURCE},
+      {"status", 0, (opkg_cmd_fun_t)opkg_status_cmd, PFM_DESCRIPTION|PFM_SOURCE},
+      {"install", 1, (opkg_cmd_fun_t)opkg_install_cmd, PFM_DESCRIPTION|PFM_SOURCE},
+      {"remove", 1, (opkg_cmd_fun_t)opkg_remove_cmd, PFM_DESCRIPTION|PFM_SOURCE},
diff --git a/package/opkg/patches/011-old-config-location.patch b/package/opkg/patches/011-old-config-location.patch
new file mode 100644 (file)
index 0000000..40d0b75
--- /dev/null
@@ -0,0 +1,14 @@
+--- a/src/opkg-cl.c
++++ b/src/opkg-cl.c
+@@ -169,7 +169,10 @@
+                       printf("Confusion: getopt_long returned %d\n", c);
+               }
+       }
+-    
++
++      if(!conf->conf_file)
++              conf->conf_file = "/etc/opkg.conf";
++
+       if (parse_err)
+               return parse_err;
+       else