Message ID | 20210907224245.4993-1-champetier.etienne@gmail.com |
---|---|
State | Accepted |
Headers | show |
Series | [opkg-lede] opkg_remove: avoid remove pkg repeatly with option --force-removal-of-dependent-packages | expand |
+ @Jo-Philipp Wich Tested using mvebu target removing librt Le mar. 7 sept. 2021 à 18:42, Etienne Champetier <champetier.etienne@gmail.com> a écrit : > > From: Hongxu Jia <hongxu.jia@windriver.com> > > 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. > > Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> > Signed-off-by: Paul Barker <paul@paulbarker.me.uk> > (Cherry picked from https://git.yoctoproject.org/cgit/cgit.cgi/opkg/commit/?id=e8996180833aa35d101fbeadec3d787ce0bbda5c) > (Fixes https://dev.archive.openwrt.org/ticket/18320 and openwrt/packages CI) > --- > libopkg/opkg_remove.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/libopkg/opkg_remove.c b/libopkg/opkg_remove.c > index 96ca558..c2abf81 100644 > --- a/libopkg/opkg_remove.c > +++ b/libopkg/opkg_remove.c > @@ -249,6 +249,14 @@ int 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. > -- > 2.31.1 >
Hello OpenWrt devs, Here an example of CI failure this patch fixes: https://github.com/openwrt/packages/runs/4427963136?check_suite_focus=true Anything I can do to have this patch included ? Best, Etienne Le dim. 12 sept. 2021 à 18:31, Etienne Champetier <champetier.etienne@gmail.com> a écrit : > > + @Jo-Philipp Wich > > Tested using mvebu target removing librt > > Le mar. 7 sept. 2021 à 18:42, Etienne Champetier > <champetier.etienne@gmail.com> a écrit : > > > > From: Hongxu Jia <hongxu.jia@windriver.com> > > > > 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. > > > > Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> > > Signed-off-by: Paul Barker <paul@paulbarker.me.uk> > > (Cherry picked from https://git.yoctoproject.org/cgit/cgit.cgi/opkg/commit/?id=e8996180833aa35d101fbeadec3d787ce0bbda5c) > > (Fixes https://dev.archive.openwrt.org/ticket/18320 and openwrt/packages CI) > > --- > > libopkg/opkg_remove.c | 8 ++++++++ > > 1 file changed, 8 insertions(+) > > > > diff --git a/libopkg/opkg_remove.c b/libopkg/opkg_remove.c > > index 96ca558..c2abf81 100644 > > --- a/libopkg/opkg_remove.c > > +++ b/libopkg/opkg_remove.c > > @@ -249,6 +249,14 @@ int 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. > > -- > > 2.31.1 > >
Merged into project/opkg-lede.git, branch master. Thank you!
diff --git a/libopkg/opkg_remove.c b/libopkg/opkg_remove.c index 96ca558..c2abf81 100644 --- a/libopkg/opkg_remove.c +++ b/libopkg/opkg_remove.c @@ -249,6 +249,14 @@ int 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.