On 8 October 2014 13:16, Hongxu Jia <[email protected]> wrote: > opkg remove perl --force-removal-of-dependent-packages > ... > Removing package perl-module-extutils-mm-dos from root... > ... > Removing package perl-module-extutils-mm-dos from root... > You can force removal of packages with failed prerm scripts with the option: > --force-remove > No packages removed. > Collected errors: > * pkg_run_script: Internal error: perl-module-extutils-mm-dos has a > NULL tmp_unpack_dir. > * opkg_remove_pkg: not removing package "perl-module-extutils-mm-dos", > prerm script failed > ... > > While remove pkg with '--force-removal-of-dependent-packages', > pkg may be added to remove list multiple times, add status > check to make sure pkg only be removed once. > > [YOCTO #6819] > > Signed-off-by: Hongxu Jia <[email protected]> > --- > ...g_remove.c-avoid-remove-pkg-repeatly-with.patch | 39 > ++++++++++++++++++++++ > meta/recipes-devtools/opkg/opkg_0.2.2.bb | 1 + > 2 files changed, 40 insertions(+) > create mode 100644 > meta/recipes-devtools/opkg/opkg/libopkg-opkg_remove.c-avoid-remove-pkg-repeatly-with.patch > > diff --git > a/meta/recipes-devtools/opkg/opkg/libopkg-opkg_remove.c-avoid-remove-pkg-repeatly-with.patch > > b/meta/recipes-devtools/opkg/opkg/libopkg-opkg_remove.c-avoid-remove-pkg-repeatly-with.patch > new file mode 100644 > index 0000000..08433a9 > --- /dev/null > +++ > b/meta/recipes-devtools/opkg/opkg/libopkg-opkg_remove.c-avoid-remove-pkg-repeatly-with.patch > @@ -0,0 +1,39 @@ > +From 41425d67d3589b1912416a17f740d6407c7834f2 Mon Sep 17 00:00:00 2001 > +From: Hongxu Jia <[email protected]> > +Date: Wed, 8 Oct 2014 19:53:13 +0800 > +Subject: [PATCH] libopkg/opkg_remove.c: avoid remove pkg repeatly with option > + --force-removal-of-dependent-packages > + > +While remove pkg with '--force-removal-of-dependent-packages', > +pkg may be added to pkgs remove list multiple times, add status > +check to make sure pkg only be removed once. > + > +Upstream-Status: Pending > + > +Signed-off-by: Hongxu Jia <[email protected]> > +--- > + libopkg/opkg_remove.c | 8 ++++++++ > + 1 file changed, 8 insertions(+) > + > +diff --git a/libopkg/opkg_remove.c b/libopkg/opkg_remove.c > +index 34f9154..a225e41 100644 > +--- a/libopkg/opkg_remove.c > ++++ b/libopkg/opkg_remove.c > +@@ -250,6 +250,14 @@ opkg_remove_pkg(pkg_t *pkg, int from_upgrade) > + if ((parent_pkg = pkg->parent) == NULL) > + return 0; > + > ++ /* While remove pkg with '--force-removal-of-dependent-packages', > ++ pkg may be added to remove list multiple times, add status > ++ check to make sure pkg only be removed once. */ > ++ if (conf->force_removal_of_dependent_packages && > ++ pkg->state_flag & SF_FILELIST_CHANGED && > ++ pkg->state_status == SS_NOT_INSTALLED) > ++ return 0; > ++ > + /* only attempt to remove dependent installed packages if > + * force_depends is not specified or the package is being > + * replaced. > +-- > +1.9.1 > +
Your solution looks fine but I'd prefer it to be solved a different way upstream. It should be possible to ensure that duplicates don't enter the removal queue in the first place by checking the return of pkg_vec_contains(dependent_pkgs, dep_pkg) before calling pkg_vec_insert(dependent_pkgs, dep_pkg) in opkg_remove_dependent_pkgs. This would keep the logic in opkg_remove_pkg clean. If you've got time to try this alternative solution could you let me know if it works. If so, send the patch to [email protected] and I'll merge it upstream. If you're too busy I can have a look at this myself next week. Cheers, -- Paul Barker Email: [email protected] http://www.paulbarker.me.uk -- _______________________________________________ Openembedded-core mailing list [email protected] http://lists.openembedded.org/mailman/listinfo/openembedded-core
