tzdata: update bbappend for 2013i
[opendreambox.git] / meta-opendreambox / recipes-devtools / opkg / opkg / 0019-opkg_upgrade_cmd-Only-upgrade-installed-packages.patch
1 From d1af83268c5daba08a5a307c344d3b9fc544c2ad Mon Sep 17 00:00:00 2001
2 From: Paul Barker <paul@paulbarker.me.uk>
3 Date: Tue, 22 Apr 2014 10:55:01 +0100
4 Subject: [PATCH 19/19] opkg_upgrade_cmd: Only upgrade installed packages
5 To: opkg-devel@googlegroups.com
6 Cc: paul@paulbarker.me.uk
7
8 Fixes issue 127.
9
10 The manual page says that `opkg upgrade` upgrades already installed packages. If
11 a package given on the command line is not already installed, an error message
12 should be raised instead of installing the package. This bad argument is skipped
13 and other arguments are upgraded if they are installed.
14
15 The call to opkg_prepare_url_for_install() is removed as it is not necessary to
16 handle remote URLs or file names when the packages must already be installed.
17
18 The unused variable 'arg' is also removed.
19
20 Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
21 (cherry picked from commit 68d05cad132da635715539fb5cfef8f4138f67d6)
22 Signed-off-by: Andreas Oberritter <obi@opendreambox.org> (merge fixes)
23 ---
24  libopkg/opkg_cmd.c | 22 +++++++---------------
25  1 file changed, 7 insertions(+), 15 deletions(-)
26
27 diff --git a/libopkg/opkg_cmd.c b/libopkg/opkg_cmd.c
28 index ee82462..f75a196 100644
29 --- a/libopkg/opkg_cmd.c
30 +++ b/libopkg/opkg_cmd.c
31 @@ -521,34 +521,26 @@ opkg_upgrade_cmd(int argc, char **argv)
32       signal(SIGINT, sigint_handler);
33  
34       if (argc) {
35 -         for (i=0; i < argc; i++) {
36 -              char *arg = argv[i];
37 -
38 -               if (opkg_prepare_url_for_install(arg, &arg))
39 -                   return -1;
40 -         }
41           pkg_info_preinstall_check();
42  
43           for (i=0; i < argc; i++) {
44 -              char *arg = argv[i];
45                if (conf->restrict_to_default_dest) {
46                     pkg = pkg_hash_fetch_installed_by_name_dest(argv[i],
47                                                         conf->default_dest);
48                     if (pkg == NULL) {
49 -                        opkg_msg(NOTICE, "Package %s not installed in %s.\n",
50 +                        opkg_msg(ERROR, "Package %s not installed in %s.\n",
51                                       argv[i], conf->default_dest->name);
52                          continue;
53                     }
54                } else {
55                     pkg = pkg_hash_fetch_installed_by_name(argv[i]);
56 +                   if (pkg == NULL) {
57 +                        opkg_msg(ERROR, "Package %s not installed.\n", argv[i]);
58 +                        continue;
59 +                   }
60                }
61 -              if (pkg) {
62 -                   if (opkg_upgrade_pkg(pkg))
63 -                           err = -1;
64 -              } else {
65 -                   if (opkg_install_by_name(arg))
66 -                           err = -1;
67 -               }
68 +              if (opkg_upgrade_pkg(pkg))
69 +                   err = -1;
70           }
71       } else {
72           pkg_vec_t *installed = pkg_vec_alloc();
73 -- 
74 1.9.1
75