<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>10781</bug_id>
          
          <creation_ts>2016-12-09 10:52:50 +0000</creation_ts>
          <short_desc>[internalsolv] opkg: tries to install all providers of a virtual package</short_desc>
          <delta_ts>2017-05-08 19:46:27 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>6</classification_id>
          <classification>Yocto Project Subprojects</classification>
          <product>opkg</product>
          <component>opkg</component>
          <version>0.3.3</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Undecided</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>0.3.5</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Markus Lehtonen">markus.lehtonen</reporter>
          <assigned_to name="Alejandro del Castillo">alejandro.delcastillo</assigned_to>
          <cc>markus.lehtonen</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>68975</commentid>
    <comment_count>0</comment_count>
    <who name="Markus Lehtonen">markus.lehtonen</who>
    <bug_when>2016-12-09 10:52:50 +0000</bug_when>
    <thetext>When trying to install a &quot;virtual package&quot; for which there are multiple providers (i.e multiple &quot;real packages&quot; are providing it), opkg tries to install all of the providers, and, most likely fails because of conflicts. Opkg should only install one provider, using Recommends and Suggests as hints for which package to select.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>69009</commentid>
    <comment_count>1</comment_count>
    <who name="Alejandro del Castillo">alejandro.delcastillo</who>
    <bug_when>2016-12-09 22:02:39 +0000</bug_when>
    <thetext>Could you provide more details on a reproducing case? With the following configuration:

o = opk.OpkGroup()
o.add(Package=&quot;a&quot;, Provides=&quot;b&quot;)
o.add(Package=&quot;x&quot;, Provides=&quot;b&quot;)
o.add(Package=&quot;y&quot;, Provides=&quot;b&quot;)
o.add(Package=&quot;z&quot;, Depends=&quot;b&quot;)
o.write_opk()
o.write_list(

adelcast@delcastillo2 ~/git/opkg/tests $ opkg -o /tmp/opkg install z
Installing a (1.0) on root
Downloading file:/tmp/opk/a_1.0_all.opk.
Installing z (1.0) on root

cleaning the workspace, then trying to install the provided package directly:

adelcast@delcastillo2 ~/git/opkg/tests $ opkg -o /tmp/opkg install b
Installing a (1.0) on root
Downloading file:/tmp/opk/a_1.0_all.opk.

Which looks correct to me. This worked with both solvers.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>69036</commentid>
    <comment_count>2</comment_count>
    <who name="Markus Lehtonen">markus.lehtonen</who>
    <bug_when>2016-12-12 12:56:22 +0000</bug_when>
    <thetext>I tested this a bit more and it seems to be a bit more complex case.

I see the problem when I try to build core-image-minimal in this branch:
http://git.openembedded.org/openembedded-core-contrib/log/?h=marquiz/fixes-10433

Virtual package that causes problems is initd-functions. Installing one package at  a time (e.g. sysvinit that requires initd-functions) seems to work as expected, pulling only one provider of initd-functions. However, problems arise when I try to install packagegroup-core-boot. 

Running opkg-native manually:
$ tmp-glibc/sysroots/x86_64-linux/usr/bin/opkg --volatile-cache -f tmp-glibc/work/qemux86-oe-linux/core-image-minimal/1.0-r0/opkg.conf -o /var/tmp/opkg-testroot -V4 install packagegroup-core-boot

I see the following in the log:
------ 8&lt; 8&lt; 8&lt; --------------------------------------------
pkg_hash_fetch_unsatisfied_dependencies: Checking dependencies for &apos;initscripts&apos;.
pkg_hash_fetch_best_installation_candidate: Best installation candidate for initd-functions:
pkg_hash_fetch_best_installation_candidate: apkg=initd-functions nprovides=2.
pkg_hash_fetch_best_installation_candidate: Adding initscripts-functions to providers.
pkg_hash_fetch_best_installation_candidate: Adding lsbinitscripts to providers.
pkg_hash_fetch_best_installation_candidate: Not selecting initscripts-functions 1.0 due to unmatched constraint.
pkg_hash_fetch_best_installation_candidate: Not selecting lsbinitscripts 9.68 due to unmatched constraint.
pkg_hash_fetch_unsatisfied_dependencies: satisfying_pkg=(nil)
pkg_hash_fetch_best_installation_candidate: Best installation candidate for initd-functions:
pkg_hash_fetch_best_installation_candidate: apkg=initd-functions nprovides=2.
pkg_hash_fetch_best_installation_candidate: Adding initscripts-functions to providers.
pkg_hash_fetch_best_installation_candidate: Adding lsbinitscripts to providers.
pkg_hash_fetch_best_installation_candidate: initscripts-functions arch=i586 arch_priority=21 version=1.0.
pkg_hash_fetch_best_installation_candidate: lsbinitscripts arch=i586 arch_priority=21 version=9.68.
pkg_hash_fetch_best_installation_candidate: 2 matching pkgs for apkg=initd-functions:
pkg_hash_fetch_best_installation_candidate: initscripts-functions 1.0 i586
pkg_hash_fetch_best_installation_candidate: lsbinitscripts 9.68 i586
pkg_hash_fetch_best_installation_candidate: Using latest matching lsbinitscripts 9.68 i586.
------ 8&lt; 8&lt; 8&lt; --------------------------------------------


BUT, strangely later in the log:
------ 8&lt; 8&lt; 8&lt; --------------------------------------------
pkg_hash_fetch_unsatisfied_dependencies: Already checked dependencies for &apos;initscripts&apos;.
pkg_hash_fetch_best_installation_candidate: Best installation candidate for initd-functions:
pkg_hash_fetch_best_installation_candidate: apkg=initd-functions nprovides=2.
pkg_hash_fetch_best_installation_candidate: Adding initscripts-functions to providers.
pkg_hash_fetch_best_installation_candidate: Adding lsbinitscripts to providers.
pkg_hash_fetch_best_installation_candidate: initscripts-functions arch=i586 arch_priority=21 version=1.0.
pkg_hash_fetch_best_installation_candidate: lsbinitscripts arch=i586 arch_priority=21 version=9.68.
pkg_hash_fetch_best_installation_candidate: Match initscripts-functions with priority 21.
pkg_hash_fetch_best_installation_candidate: 2 matching pkgs for apkg=initd-functions:
pkg_hash_fetch_best_installation_candidate: initscripts-functions 1.0 i586
pkg_hash_fetch_best_installation_candidate: lsbinitscripts 9.68 i586
pkg_hash_fetch_best_installation_candidate: Using priorized matching initscripts-functions 1.0 i586.
------ 8&lt; 8&lt; 8&lt; --------------------------------------------


Somehow opkg first chooses lsbinitscripts and later prioritizes initscripts-functions. And, tries to install both as the install fails with:
Collected errors:
 * check_conflicts_for: The following packages conflict with initscripts-functions:
 * check_conflicts_for: 	lsbinitscripts * 
 * check_conflicts_for: The following packages conflict with initscripts-functions:
 * check_conflicts_for: 	lsbinitscripts *</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>69390</commentid>
    <comment_count>3</comment_count>
    <who name="Alejandro del Castillo">alejandro.delcastillo</who>
    <bug_when>2016-12-27 22:28:40 +0000</bug_when>
    <thetext>Did something change on the branch posted? I cloned the branch and was able to build the image successfully. I also tried to manually install packagegroup-core-boot and that also worked.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>69396</commentid>
    <comment_count>4</comment_count>
    <who name="Markus Lehtonen">markus.lehtonen</who>
    <bug_when>2016-12-28 11:14:47 +0000</bug_when>
    <thetext>Ah, I forgot one detail. Naturally, you need to have both/all of the providers in the ipk repository in order to see the problem. This command should reproduce the problem:
$ bitbake initscripts lsbinitscripts core-image-minimal</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>69418</commentid>
    <comment_count>5</comment_count>
    <who name="Alejandro del Castillo">alejandro.delcastillo</who>
    <bug_when>2016-12-30 19:38:25 +0000</bug_when>
    <thetext>I was able to reproduce the problem with:

import os
import opk, cfg, opkgcl

opk.regress_init()

o = opk.OpkGroup()
o.add(Package=&quot;a&quot;, Depends=&quot;b&quot;)
o.add(Package=&quot;b&quot;, Depends=&quot;d&quot;)
o.add(Package=&quot;c&quot;, Provides=&quot;d&quot;, Conflicts=&quot;e&quot;)
o.add(Package=&quot;e&quot;, Provides=&quot;d&quot;, Conflicts=&quot;c&quot;)
o.write_opk()
o.write_list()

opkgcl.update()

opkgcl.install(&quot;a&quot;)

That configuration does show the &quot;check_conflicts_for&quot; error, but the packages are all installed correctly (and opkg returns 0). I believe that&apos;s enough to trip OE.

The good news is that this is an internal solver only error, the libsolv backend works with no problems (and is more robust in many other ways).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>73124</commentid>
    <comment_count>6</comment_count>
    <who name="Alejandro del Castillo">alejandro.delcastillo</who>
    <bug_when>2017-05-08 19:46:27 +0000</bug_when>
    <thetext>Fixed on 500346f628a6a04a7e4ca8075f92f63d45a94603</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>