opkg: set PKG_UPGRADE also when running scripts for the old package
authorJonas Gorski <jonas.gorski@gmail.com>
Mon, 21 Nov 2016 14:14:02 +0000 (15:14 +0100)
committerJonas Gorski <jonas.gorski@gmail.com>
Mon, 21 Nov 2016 17:40:15 +0000 (18:40 +0100)
Allow scripts from the package to be upgraded to be aware of being
upgraded.

Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
Acked-by: Jo-Philipp Wich <jo@mein.io>
package/system/opkg/Makefile
package/system/opkg/patches/007-force_static.patch
package/system/opkg/patches/110-upgrade.patch
package/system/opkg/patches/200-usign_support.patch
package/system/opkg/patches/220-drop-release-support.patch

index 34db3d1..5b96fea 100644 (file)
@@ -13,7 +13,7 @@ include $(INCLUDE_DIR)/feeds.mk
 PKG_NAME:=opkg
 PKG_REV:=9c97d5ecd795709c8584e972bfdf3aee3a5b846d
 PKG_VERSION:=$(PKG_REV)
-PKG_RELEASE:=13
+PKG_RELEASE:=14
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_VERSION:=$(PKG_REV)
index 38cdb7a..7497707 100644 (file)
@@ -1,6 +1,6 @@
 --- a/libopkg/Makefile.am
 +++ b/libopkg/Makefile.am
-@@ -38,16 +38,10 @@
+@@ -38,16 +38,10 @@ if HAVE_SHA256
  opkg_util_sources += sha256.c sha256.h
  endif
  
@@ -22,7 +22,7 @@
 +libopkg_a_LIBADD = $(top_builddir)/libbb/libbb.a
 --- a/libbb/Makefile.am
 +++ b/libbb/Makefile.am
-@@ -2,9 +2,9 @@
+@@ -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@
  
@@ -36,7 +36,7 @@
        wfopen.c \
 --- a/tests/Makefile.am
 +++ b/tests/Makefile.am
-@@ -4,11 +4,11 @@
+@@ -4,11 +4,11 @@ AM_CFLAGS = $(ALL_CFLAGS) -Wall -g -O3 -
  #noinst_PROGRAMS = libopkg_test opkg_active_list_test
  noinst_PROGRAMS = libopkg_test
  
@@ -50,7 +50,7 @@
  #opkg_extract_test_SOURCES = opkg_extract_test.c
  #opkg_extract_test_CFLAGS = $(ALL_CFLAGS) -I$(top_srcdir)
  
-@@ -16,7 +16,7 @@
+@@ -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)
  
@@ -61,7 +61,7 @@
  
 --- a/src/Makefile.am
 +++ b/src/Makefile.am
-@@ -2,5 +2,5 @@
+@@ -2,5 +2,5 @@ AM_CFLAGS = -I${top_srcdir}/libopkg ${AL
  bin_PROGRAMS = opkg-cl
  
  opkg_cl_SOURCES = opkg-cl.c
index 071df0e..61f454a 100644 (file)
@@ -1,6 +1,6 @@
 --- a/libopkg/opkg_install.c
 +++ b/libopkg/opkg_install.c
-@@ -1405,9 +1405,10 @@
+@@ -1405,9 +1405,11 @@ opkg_install_pkg(pkg_t *pkg, int from_up
          opkg_state_changed++;
          pkg->state_flag |= SF_FILELIST_CHANGED;
  
@@ -8,12 +8,13 @@
 +        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 +1467,7 @@
+@@ -1466,7 +1468,7 @@ opkg_install_pkg(pkg_t *pkg, int from_up
          }
  
  
@@ -24,7 +25,7 @@
                               " Package debris may remain!\n",
 --- a/libopkg/pkg.c
 +++ b/libopkg/pkg.c
-@@ -1285,6 +1285,12 @@
+@@ -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);
  
@@ -39,7 +40,7 @@
          return 0;
 --- a/libopkg/pkg.h
 +++ b/libopkg/pkg.h
-@@ -184,6 +184,7 @@
+@@ -184,6 +184,7 @@ struct pkg
       /* this flag specifies whether the package was installed to satisfy another
        * package's dependancies */
       int auto_installed;
index 991708a..6479d57 100644 (file)
@@ -59,7 +59,7 @@
  #include <stdio.h>
  #include <unistd.h>
  #include <libgen.h>
-@@ -342,7 +343,28 @@ opkg_prepare_url_for_install(const char 
+@@ -342,7 +343,28 @@ opkg_prepare_url_for_install(const char
  int
  opkg_verify_file (char *text_file, char *sig_file)
  {
index 41f271f..131c2cb 100644 (file)
@@ -1,6 +1,6 @@
 --- a/libopkg/Makefile.am
 +++ b/libopkg/Makefile.am
-@@ -15,7 +15,6 @@
+@@ -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 \
@@ -8,7 +8,7 @@
                  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 @@
+@@ -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 \
  #include "pkg.h"
  #include "pkg_dest.h"
  #include "pkg_parse.h"
-@@ -114,39 +113,6 @@
+@@ -114,39 +113,6 @@ opkg_update_cmd(int argc, char **argv)
       }
  
  
  #include "pkg.h"
  #include "opkg_message.h"
  #include "pkg_vec.h"
-@@ -183,40 +182,6 @@
+@@ -183,40 +182,6 @@ pkg_hash_load_feeds(void)
        lists_dir = conf->restrict_to_default_dest ?
                conf->default_dest->lists_dir : conf->lists_dir;