On 11 October 2014 15:41, Paul Barker <[email protected]> wrote: > On 10 October 2014 17:45, Peter Urbanec <[email protected]> > wrote: >> +diff --git a/libopkg/opkg_remove.c b/libopkg/opkg_remove.c >> +index 07401b2..52454f8 100644 >> +--- a/libopkg/opkg_remove.c >> ++++ b/libopkg/opkg_remove.c >> +@@ -292,7 +292,7 @@ opkg_remove_pkg(pkg_t *pkg, int from_upgrade) >> + pkg->state_want = SW_DEINSTALL; >> + opkg_state_changed++; >> + +- if (pkg_run_script(pkg, "prerm", "remove") != 0) { >> ++ if (pkg_run_script(pkg, "prerm", from_upgrade ? "upgrade" : "remove") >> != 0) { >> + if (!conf->force_remove) { >> + opkg_msg(ERROR, "not removing package \"%s\", " >> + "prerm script failed\n", pkg->name); >> +@@ -310,7 +310,7 @@ opkg_remove_pkg(pkg_t *pkg, int from_upgrade) >> + feel free to fix this. */ >> + remove_data_files_and_list(pkg); >> + >> +- err = pkg_run_script(pkg, "postrm", "remove"); >> ++ err = pkg_run_script(pkg, "postrm", from_upgrade ? "upgrade" : >> "remove"); >> + >> + remove_maintainer_scripts(pkg); >> + pkg->state_status = SS_NOT_INSTALLED; > > I'm happy with this change, both here and upstream. >
I think I need to take that back - the crappiness of the legacy code in opkg strikes again! opkg_remove_pkg is never called with from_upgrade set to a non-zero value. The removal of an old package during an upgrade is handled by directly calling remove_data_files_and_list and remove_maintainer_scripts from opkg_install_pkg. The desired behaviour is given in the comments in prerm_upgrade_old_pkg in opkg_install.c, the behaviour given by the comment in that function just needs implementing. This is already entered as issue 104 in the opkg issue tracker: https://code.google.com/p/opkg/issues/detail?id=104 Have you tested this patch before submitting it? -- Paul Barker Email: [email protected] http://www.paulbarker.me.uk -- _______________________________________________ Openembedded-core mailing list [email protected] http://lists.openembedded.org/mailman/listinfo/openembedded-core
