On 11 October 2014 11:17, Hongxu Jia <[email protected]> wrote:
> On 10/11/2014 05:31 PM, Paul Barker wrote:
>>
>> 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.
>
>
> The pkg_vec_contains(dependent_pkgs, dep_pkg) could not work here.
> Because 'dependent_pkgs' is not global which contains all removed pkgs.
>
> The checking will filter duplicated pkg.
>

I've attached a patch which should apply to opkg v0.2.2 to show what I intended.

Thanks,

-- 
Paul Barker

Email: [email protected]
http://www.paulbarker.me.uk
From b663a030db08fee1da4976436b58a7f1a19a551d Mon Sep 17 00:00:00 2001
From: Paul Barker <[email protected]>
Date: Sat, 11 Oct 2014 10:23:45 +0000
Subject: [PATCH] WIP: Attempt to fix duplicate removal of dependent packages
To: [email protected]

Signed-off-by: Paul Barker <[email protected]>
---
 libopkg/opkg_remove.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libopkg/opkg_remove.c b/libopkg/opkg_remove.c
index 34f9154..fb8ab52 100644
--- a/libopkg/opkg_remove.c
+++ b/libopkg/opkg_remove.c
@@ -117,7 +117,8 @@ opkg_remove_dependent_pkgs(pkg_t *pkg, abstract_pkg_t **dependents)
         if (dep_ab_pkg->state_status == SS_INSTALLED) {
             for (a = 0; a < dep_ab_pkg->pkgs->len; a++) {
                 pkg_t *dep_pkg = dep_ab_pkg->pkgs->pkgs[a];
-                if (dep_pkg->state_status == SS_INSTALLED) {
+                if (dep_pkg->state_status == SS_INSTALLED
+                        && !pkg_vec_contains(dependent_pkgs, dep_pkg)) {
                     pkg_vec_insert(dependent_pkgs, dep_pkg);
                     count++;
                 }
-- 
2.1.2

-- 
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Reply via email to