diff options
author | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2019-04-04 18:32:57 (EDT) |
---|---|---|
committer | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2019-04-04 18:32:57 (EDT) |
commit | b4655a222efd29326bb5bc766c472774800d5905 (patch) | |
tree | dd551dedaa8541bd4025643f023d5aea04b0dacd | |
parent | 9e24f0e1ce777dda2abe72f63172f0c2f6c639dd (diff) |
patches, build: Allow upgrade command without arguments
-rwxr-xr-x | build | 1 | ||||
-rw-r--r-- | changelog | 1 | ||||
-rw-r--r-- | patches/0002-cli-Optionally-enforce-argument-to-upgrade-command.patch | 91 |
3 files changed, 93 insertions, 0 deletions
@@ -14,6 +14,7 @@ build: -D LOCK_FILE:STRING=/var/lib/opkg/lock \ -D STATIC_UBOX:BOOL=ON \ -D BUILD_TESTS:BOOL=OFF \ + -D REQUIRE_UPGRADE_ARGS:BOOL=OFF \ -D VERSION:STRING="$(version)" \ .) oh-autobuild @@ -6,6 +6,7 @@ opkg-lede (0+git20190131.d4ba162-2) trunk with the original opkg. * Manage opkg-key and update-alternatives with update-alternatives. * Conflict with opkg and opkg-gpg (<< 0.2.4-2). + * Allow upgrade command without arguments, as with the original opkg. -- Patrick McDermott <patrick.mcdermott@libiquity.com> Thu, 04 Apr 2019 16:52:10 -0400 diff --git a/patches/0002-cli-Optionally-enforce-argument-to-upgrade-command.patch b/patches/0002-cli-Optionally-enforce-argument-to-upgrade-command.patch new file mode 100644 index 0000000..5908d57 --- /dev/null +++ b/patches/0002-cli-Optionally-enforce-argument-to-upgrade-command.patch @@ -0,0 +1,91 @@ +From ffe7462678026e456453941733a19a32752da4c9 Mon Sep 17 00:00:00 2001 +From: Patrick McDermott <patrick.mcdermott@libiquity.com> +Date: Thu, 4 Apr 2019 18:25:51 -0400 +Subject: [PATCH] cli: Optionally enforce argument to upgrade command + +This reverts and amends commit 673d7213175c2cf209b25c8eb2632941cdbb8519. + +Signed-off-by: Patrick McDermott <patrick.mcdermott@libiquity.com> +--- + CMakeLists.txt | 4 ++++ + libopkg/opkg_cmd.c | 17 +++++++++++++++++ + src/opkg-cl.c | 4 ++++ + 3 files changed, 25 insertions(+) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 26230b3..75968b3 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -13,6 +13,7 @@ SET(VERSION "" CACHE STRING "Override version") + OPTION(STATIC_UBOX "Statically link libubox" OFF) + OPTION(BUILD_TESTS "Build test programs" ON) + OPTION(ENABLE_USIGN "Enable usign support" ON) ++OPTION(REQUIRE_UPGRADE_ARGS "Require argument(s) to upgrade command" ON) + + IF(NOT HOST_CPU) + SET(HOST_CPU "${CMAKE_HOST_SYSTEM_PROCESSOR}") +@@ -49,6 +50,9 @@ ADD_DEFINITIONS(-Os -Wall --std=gnu99 -g3 -Wmissing-declarations + IF(ENABLE_USIGN) + ADD_DEFINITIONS(-DHAVE_USIGN) + ENDIF() ++IF(REQUIRE_UPGRADE_ARGUMENTS) ++ ADD_DEFINITIONS(-DREQUIRE_UPGRADE_ARGS) ++ENDIF() + + IF(WORDS_BIGENDIAN) + ADD_DEFINITIONS(-DWORDS_BIGENDIAN) +diff --git a/libopkg/opkg_cmd.c b/libopkg/opkg_cmd.c +index c823df8..2a4021d 100644 +--- a/libopkg/opkg_cmd.c ++++ b/libopkg/opkg_cmd.c +@@ -529,6 +529,19 @@ static int opkg_upgrade_cmd(int argc, char **argv) + err = -1; + } + } ++#if not defined(REQUIRE_UPGRADE_ARGS) ++ } 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); ++#endif + } + + if (opkg_configure_packages(NULL)) +@@ -1256,7 +1269,11 @@ static int opkg_print_architecture_cmd(int argc, char **argv) + static opkg_cmd_t cmds[] = { + {"update", 0, (opkg_cmd_fun_t) opkg_update_cmd, + PFM_DESCRIPTION | PFM_SOURCE}, ++#if defined(REQUIRE_UPGRADE_ARGS) + {"upgrade", 1, (opkg_cmd_fun_t) opkg_upgrade_cmd, ++#else ++ {"upgrade", 0, (opkg_cmd_fun_t) opkg_upgrade_cmd, ++#endif + 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, +diff --git a/src/opkg-cl.c b/src/opkg-cl.c +index a3ea5c1..29cd373 100644 +--- a/src/opkg-cl.c ++++ b/src/opkg-cl.c +@@ -260,7 +260,11 @@ static void usage() + printf("\nPackage Manipulation:\n"); + printf + ("\tupdate Update list of available packages\n"); ++#if defined(REQUIRE_UPGRADE_ARGS) + printf("\tupgrade <pkgs> Upgrade packages\n"); ++#else ++ printf("\tupgrade Upgrade packages\n"); ++#endif + printf("\tinstall <pkgs> Install package(s)\n"); + printf("\tconfigure <pkgs> Configure unpacked package(s)\n"); + printf("\tremove <pkgs|regexp> Remove package(s)\n"); +-- +2.11.0 + |