Bug 10781 - [internalsolv] opkg: tries to install all providers of a virtual package
Summary: [internalsolv] opkg: tries to install all providers of a virtual package
Status: RESOLVED FIXED
Alias: None
Product: opkg
Classification: Yocto Project Subprojects
Component: opkg (show other bugs)
Version: 0.3.3
Hardware: x86 Multiple
: Undecided normal
Target Milestone: 0.3.5
Assignee: Alejandro del Castillo
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2016-12-09 10:52 UTC by Markus Lehtonen
Modified: 2017-05-08 19:46 UTC (History)
1 user (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Lehtonen 2016-12-09 10:52:50 UTC
When trying to install a "virtual package" for which there are multiple providers (i.e multiple "real packages" 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.
Comment 1 Alejandro del Castillo 2016-12-09 22:02:39 UTC
Could you provide more details on a reproducing case? With the following configuration:

o = opk.OpkGroup()
o.add(Package="a", Provides="b")
o.add(Package="x", Provides="b")
o.add(Package="y", Provides="b")
o.add(Package="z", Depends="b")
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.
Comment 2 Markus Lehtonen 2016-12-12 12:56:22 UTC
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< 8< 8< --------------------------------------------
pkg_hash_fetch_unsatisfied_dependencies: Checking dependencies for 'initscripts'.
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< 8< 8< --------------------------------------------


BUT, strangely later in the log:
------ 8< 8< 8< --------------------------------------------
pkg_hash_fetch_unsatisfied_dependencies: Already checked dependencies for 'initscripts'.
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< 8< 8< --------------------------------------------


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 *
Comment 3 Alejandro del Castillo 2016-12-27 22:28:40 UTC
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.
Comment 4 Markus Lehtonen 2016-12-28 11:14:47 UTC
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
Comment 5 Alejandro del Castillo 2016-12-30 19:38:25 UTC
I was able to reproduce the problem with:

import os
import opk, cfg, opkgcl

opk.regress_init()

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

opkgcl.update()

opkgcl.install("a")

That configuration does show the "check_conflicts_for" error, but the packages are all installed correctly (and opkg returns 0). I believe that'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).
Comment 6 Alejandro del Castillo 2017-05-08 19:46:27 UTC
Fixed on 500346f628a6a04a7e4ca8075f92f63d45a94603