opkg: some fixes/changes for handling packet recommends
authorAndreas Monzner <andreas.monzner@dream-property.net>
Sun, 17 Feb 2013 19:46:43 +0000 (04:46 +0900)
committerhschang <chang@dev3>
Tue, 11 Jun 2013 07:58:24 +0000 (16:58 +0900)
 - dont remove auto installed recommends when moved from depends to recommends
 - dont install recommends on package install / update
 - on image creation time recommends should be handled as depends.. but later not.. so dont apply our patches in native opkg build..

meta-openvuplus/recipes-devtools/opkg/opkg/0009-Revert-Add-Recommended-packages-to-the-depended_upon.patch [deleted file]
meta-openvuplus/recipes-devtools/opkg/opkg/0009-don-t-add-recommends-pkgs-to-depended-upon-by.patch [new file with mode: 0644]
meta-openvuplus/recipes-devtools/opkg/opkg/0011-opkg-allow-package-move-from-depends-to-recommends.patch [new file with mode: 0644]
meta-openvuplus/recipes-devtools/opkg/opkg/0012-opkg-dont-handle-recommends-as-depends.patch [new file with mode: 0644]
meta-openvuplus/recipes-devtools/opkg/opkg_svn.bbappend

diff --git a/meta-openvuplus/recipes-devtools/opkg/opkg/0009-Revert-Add-Recommended-packages-to-the-depended_upon.patch b/meta-openvuplus/recipes-devtools/opkg/opkg/0009-Revert-Add-Recommended-packages-to-the-depended_upon.patch
deleted file mode 100644 (file)
index bf61aef..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-From 70d10c10288da23755055c881bea01b61a2d4df7 Mon Sep 17 00:00:00 2001
-From: Andreas Oberritter <obi@opendreambox.org>
-Date: Thu, 17 May 2012 22:57:35 +0200
-Subject: [PATCH 09/10] Revert "Add Recommended packages to the
- depended_upon_by field."
-
-This reverts commit ac2222f7d6514fb403ce0848f6812a22a48f75c7.
----
- libopkg/pkg_depends.c |   70 ++++++++++++++++++++++---------------------------
- 1 file changed, 32 insertions(+), 38 deletions(-)
-
-diff --git a/libopkg/pkg_depends.c b/libopkg/pkg_depends.c
-index f237733..ec60b99 100644
---- a/libopkg/pkg_depends.c
-+++ b/libopkg/pkg_depends.c
-@@ -787,49 +787,43 @@ pkg_depend_str(pkg_t *pkg, int idx)
-       return str;
- }
-+/*
-+ * WARNING: This function assumes pre_depends and depends are at the
-+ * start of the pkg->depends array.
-+ */
- void buildDependedUponBy(pkg_t * pkg, abstract_pkg_t * ab_pkg)
- {
--      compound_depend_t * depends;
--      int count, othercount;
--      int i, j;
--      abstract_pkg_t * ab_depend;
--      abstract_pkg_t ** temp;
--
--      count = pkg->pre_depends_count +
--                      pkg->depends_count +
--                      pkg->recommends_count +
--                      pkg->suggests_count;
--
--      for (i = 0; i < count; i++) {
--              depends = &pkg->depends[i];
--              if (depends->type != PREDEPEND
--                  && depends->type != DEPEND
--                  && depends->type != RECOMMEND)
--                      continue;
--              for (j = 0; j < depends->possibility_count; j++) {
--                      ab_depend = depends->possibilities[j]->pkg;
--                      if (!ab_depend->depended_upon_by) {
--                              ab_depend->depended_upon_by =
--                                      xcalloc(1, sizeof(abstract_pkg_t *));
--                      }
-+     compound_depend_t * depends;
-+     int count, othercount;
-+     int i, j;
-+     abstract_pkg_t * ab_depend;
-+     abstract_pkg_t ** temp;
--                      temp = ab_depend->depended_upon_by;
--                      othercount = 1;
--                      while (*temp) {
--                          temp++;
--                          othercount++;
--                      }
--                      *temp = ab_pkg;
-+     count = pkg->pre_depends_count + pkg->depends_count;
-+     depends = pkg->depends;
--                      ab_depend->depended_upon_by =
--                              xrealloc(ab_depend->depended_upon_by,
--                              (othercount + 1) * sizeof(abstract_pkg_t *));
-+     for (i = 0; i < count; i++) {
-+        for (j = 0; j < depends->possibility_count; j++){
-+             ab_depend = depends->possibilities[j]->pkg;
-+             if(!ab_depend->depended_upon_by)
-+                  ab_depend->depended_upon_by = xcalloc(1, sizeof(abstract_pkg_t *));
-+
-+             temp = ab_depend->depended_upon_by;
-+             othercount = 1;
-+             while(*temp){
-+                  temp++;
-+                  othercount++;
-+             }
-+             *temp = ab_pkg;
--                      /* the array may have been moved by realloc */
--                      temp = ab_depend->depended_upon_by + othercount;
--                      *temp = NULL;
--              }
--      }
-+             ab_depend->depended_upon_by = xrealloc(ab_depend->depended_upon_by,
-+                                                                      (othercount + 1) * sizeof(abstract_pkg_t *));
-+             /* the array may have moved */
-+             temp = ab_depend->depended_upon_by + othercount;
-+             *temp = NULL;
-+        }
-+        depends++;
-+     }
- }
- static depend_t * depend_init(void)
--- 
-1.7.9.5
-
diff --git a/meta-openvuplus/recipes-devtools/opkg/opkg/0009-don-t-add-recommends-pkgs-to-depended-upon-by.patch b/meta-openvuplus/recipes-devtools/opkg/opkg/0009-don-t-add-recommends-pkgs-to-depended-upon-by.patch
new file mode 100644 (file)
index 0000000..e581dc0
--- /dev/null
@@ -0,0 +1,26 @@
+While removing a package with opkg, the process shouldn't be blocked if
+another package RECOMMENDS the package wanted to be removed. This is
+because, while generating the dependencies, opkg adds dependencies to
+depended_upon_by even if dependency's type is RECOMMEND. The fix is to
+skip dependencies of type RECOMMEND while constructing depended_upon_by.
+
+Bug info:
+https://bugzilla.yoctoproject.org/show_bug.cgi?id=2431
+
+Upstream-Status: Pending
+Signed-off-by: Andrei Gherzan <andrei@gherzan.ro>
+
+Index: trunk/libopkg/pkg_depends.c
+===================================================================
+--- trunk.orig/libopkg/pkg_depends.c   2011-09-03 05:54:56.000000000 +0300
++++ trunk/libopkg/pkg_depends.c        2012-10-20 22:23:03.783573202 +0300
+@@ -785,8 +785,7 @@
+       for (i = 0; i < count; i++) {
+               depends = &pkg->depends[i];
+               if (depends->type != PREDEPEND
+-                  && depends->type != DEPEND
+-                  && depends->type != RECOMMEND)
++                  && depends->type != DEPEND)
+                       continue;
+               for (j = 0; j < depends->possibility_count; j++) {
+                       ab_depend = depends->possibilities[j]->pkg;
diff --git a/meta-openvuplus/recipes-devtools/opkg/opkg/0011-opkg-allow-package-move-from-depends-to-recommends.patch b/meta-openvuplus/recipes-devtools/opkg/opkg/0011-opkg-allow-package-move-from-depends-to-recommends.patch
new file mode 100644 (file)
index 0000000..5b5bc56
--- /dev/null
@@ -0,0 +1,19 @@
+diff -Naur trunk.org/libopkg/opkg_install.c trunk/libopkg/opkg_install.c
+--- trunk.org/libopkg/opkg_install.c   2013-02-17 12:40:51.000000000 +0100
++++ trunk/libopkg/opkg_install.c       2013-02-17 01:17:37.000000000 +0100
+@@ -366,11 +366,12 @@
+                       for (k=0; k<count1; k++) {
+                               cd1 = &pkg->depends[k];
+-                              if (cd1->type != DEPEND)
++                              if (cd1->type != DEPEND && cd1->type != RECOMMEND)
+                                       continue;
+                               for (l=0; l<cd1->possibility_count; l++) {
+-                                      if (cd0->possibilities[j]
+-                                       == cd1->possibilities[l]) {
++                                      if ( (cd0->type == cd1->type && cd0->possibilities[j] == cd1->possibilities[l]) ||
++                                           (cd0->type != cd1->type && !strcmp(cd0->possibilities[j]->pkg->name, cd1->possibilities[l]->pkg->name) )
++                                         ) {
+                                               found = 1;
+                                               break;
+                                       }
diff --git a/meta-openvuplus/recipes-devtools/opkg/opkg/0012-opkg-dont-handle-recommends-as-depends.patch b/meta-openvuplus/recipes-devtools/opkg/opkg/0012-opkg-dont-handle-recommends-as-depends.patch
new file mode 100644 (file)
index 0000000..9d7ddc3
--- /dev/null
@@ -0,0 +1,15 @@
+diff -Naur trunk.orig/libopkg/pkg_depends.c trunk/libopkg/pkg_depends.c
+--- trunk.orig/libopkg/pkg_depends.c   2013-02-17 16:47:33.000000000 +0100
++++ trunk/libopkg/pkg_depends.c        2013-02-17 16:07:11.000000000 +0100
+@@ -236,6 +236,11 @@
+                        /* just mention it politely */
+                        opkg_msg(NOTICE, "package %s suggests installing %s\n",
+                               pkg->name, satisfier_entry_pkg->name);
++                  }
++                  else if (compound_depend->type == RECOMMEND) {
++                       /* just mention it politely */
++                       opkg_msg(NOTICE, "package %s recommend installing %s\n",
++                              pkg->name, satisfier_entry_pkg->name);
+                   } else {
+                        char ** newstuff = NULL;
index 76d0408..3eadd64 100644 (file)
@@ -1,4 +1,10 @@
-PR .= "-vuplus1"
+PR .= "-vuplus2"
+
+PATCHES = "file://0009-don-t-add-recommends-pkgs-to-depended-upon-by.patch \
+           file://0011-opkg-allow-package-move-from-depends-to-recommends.patch \
+           file://0012-opkg-dont-handle-recommends-as-depends.patch"
+
+PATCHES_virtclass-native = ""
 
 SRC_URI += "file://0001-Fixed-opkg-losing-auto_installed-flag-on-upgrading.patch \
             file://0002-Don-t-mark-Conflicts-as-Depends.patch \
@@ -8,8 +14,8 @@ SRC_URI += "file://0001-Fixed-opkg-losing-auto_installed-flag-on-upgrading.patch
             file://0006-pkg_hash_fetch_conflicts-fix-possible-segfaults.patch \
             file://0007-pkg_hash_fetch_conflicts-move-iteration-over-conflic.patch \
             file://0008-pkg_hash_fetch_conflicts-take-into-account-conflicts.patch \
-            file://0009-Revert-Add-Recommended-packages-to-the-depended_upon.patch \
             file://0010-opkg_remove-auto-delete-.pyo-files.patch \
+            ${PATCHES} \
             file://unarchive-fixed-uname-gname-cache.patch"
 
 FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"