aboutsummaryrefslogtreecommitdiffstats
path: root/package/system
diff options
context:
space:
mode:
authorJohn Crispin <blogic@openwrt.org>2015-10-15 14:41:30 +0000
committerJohn Crispin <blogic@openwrt.org>2015-10-15 14:41:30 +0000
commit57ddf3d6941f831214ceeb52be8510cee58e0801 (patch)
tree360e8bb205b240ebcdb569d058dbd8cfca28ec07 /package/system
parent7692796fe330f7c10025315c1717f495b18dcf04 (diff)
downloadupstream-57ddf3d6941f831214ceeb52be8510cee58e0801.tar.gz
upstream-57ddf3d6941f831214ceeb52be8510cee58e0801.tar.bz2
upstream-57ddf3d6941f831214ceeb52be8510cee58e0801.zip
opkg: backport 'opkg list --size' option
Backport from trunk to CC15.05 the --size option to optionally show also the *.ipk size in the opkg package listing. * Default behaviour is to list the available packages as earlier: "name - version - description" * with "--size" the output of is "name - version - size - description". Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi> git-svn-id: svn://svn.openwrt.org/openwrt/branches/chaos_calmer@47196 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/system')
-rw-r--r--package/system/opkg/Makefile4
-rw-r--r--package/system/opkg/patches/260-add-print-package-size.patch74
2 files changed, 76 insertions, 2 deletions
diff --git a/package/system/opkg/Makefile b/package/system/opkg/Makefile
index 32bcf2bdf1..76688f5256 100644
--- a/package/system/opkg/Makefile
+++ b/package/system/opkg/Makefile
@@ -1,5 +1,5 @@
#
-# Copyright (C) 2006-2014 OpenWrt.org
+# Copyright (C) 2006-2015 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
@@ -12,7 +12,7 @@ include $(INCLUDE_DIR)/feeds.mk
PKG_NAME:=opkg
PKG_REV:=9c97d5ecd795709c8584e972bfdf3aee3a5b846d
PKG_VERSION:=$(PKG_REV)
-PKG_RELEASE:=8
+PKG_RELEASE:=9
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=$(PKG_REV)
diff --git a/package/system/opkg/patches/260-add-print-package-size.patch b/package/system/opkg/patches/260-add-print-package-size.patch
new file mode 100644
index 0000000000..0cdf408c54
--- /dev/null
+++ b/package/system/opkg/patches/260-add-print-package-size.patch
@@ -0,0 +1,74 @@
+--- a/libopkg/opkg_conf.c
++++ b/libopkg/opkg_conf.c
+@@ -69,6 +69,7 @@ opkg_option_t options[] = {
+ { "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 },
++ { "size", OPKG_OPT_TYPE_BOOL, &_conf.size },
+ { "tmp_dir", OPKG_OPT_TYPE_STRING, &_conf.tmp_dir },
+ { "verbosity", OPKG_OPT_TYPE_INT, &_conf.verbosity },
+ #if defined(HAVE_OPENSSL)
+--- a/libopkg/opkg_conf.h
++++ b/libopkg/opkg_conf.h
+@@ -88,6 +88,7 @@ struct opkg_conf
+ int query_all;
+ int verbosity;
+ int noaction;
++ int size;
+ int download_only;
+ char *cache;
+
+--- a/src/opkg-cl.c
++++ b/src/opkg-cl.c
+@@ -52,6 +52,7 @@ enum {
+ ARGS_OPT_AUTOREMOVE,
+ ARGS_OPT_CACHE,
+ ARGS_OPT_FORCE_SIGNATURE,
++ ARGS_OPT_SIZE,
+ };
+
+ static struct option long_options[] = {
+@@ -98,6 +99,7 @@ static struct option long_options[] = {
+ {"offline-root", 1, 0, 'o'},
+ {"add-arch", 1, 0, ARGS_OPT_ADD_ARCH},
+ {"add-dest", 1, 0, ARGS_OPT_ADD_DEST},
++ {"size", 0, 0, ARGS_OPT_SIZE},
+ {"test", 0, 0, ARGS_OPT_NOACTION},
+ {"tmp-dir", 1, 0, 't'},
+ {"tmp_dir", 1, 0, 't'},
+@@ -207,6 +209,9 @@ args_parse(int argc, char *argv[])
+ }
+ free(tuple);
+ break;
++ case ARGS_OPT_SIZE:
++ conf->size = 1;
++ break;
+ case ARGS_OPT_NOACTION:
+ conf->noaction = 1;
+ break;
+@@ -310,6 +315,7 @@ usage()
+ 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--size Print package size when listing available packages\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");
+--- a/libopkg/opkg_cmd.c
++++ b/libopkg/opkg_cmd.c
+@@ -47,10 +47,12 @@ static void
+ print_pkg(pkg_t *pkg)
+ {
+ char *version = pkg_version_str_alloc(pkg);
++ printf("%s - %s", pkg->name, version);
++ if (conf->size)
++ printf(" - %lu", pkg->size);
+ if (pkg->description)
+- printf("%s - %s - %s\n", pkg->name, version, pkg->description);
+- else
+- printf("%s - %s\n", pkg->name, version);
++ printf(" - %s", pkg->description);
++ printf("\n");
+ free(version);
+ }
+