opkg: set PKG_UPGRADE also when running scripts for the old package

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>
This commit is contained in:
Jonas Gorski 2016-11-21 15:14:02 +01:00
parent 3c52cbfa53
commit a58f176ef2
5 changed files with 16 additions and 15 deletions

View 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)

View 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

View 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;

View 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 \
@ -719,7 +719,7 @@
#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)
}
@ -769,7 +769,7 @@
#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;