dskvr / opkg

Automatically exported from code.google.com/p/opkg
0 stars 0 forks source link

opkg doesn't prioritise installing superior satisfying dependency #84

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

#!/usr/bin/python3

import opk, cfg, opkgcl

def cleanup():
    opkgcl.remove("a1")
    opkgcl.remove("b1")
    opkgcl.remove("a")
    opkgcl.remove("b")
    opkgcl.remove('c')

opk.regress_init()

o = opk.OpkGroup()
o.add(Package="a", Provides="v", Depends="a1")
o.add(Package="b", Provides="v", Depends="b1")
o.add(Package="c", Depends="v")
o.add(Package="a1")
o.add(Package="b1")

o.write_opk()
o.write_list()

opkgcl.update()

# install ``a1`` directly
opkgcl.install("a1_1.0_all.opk")
if not opkgcl.is_installed("a1"):
    print(__file__, ": package ``a1'' not installed.")
    cleanup()
    exit(False)

# install ``c'' from repository
opkgcl.install("c")
if not opkgcl.is_installed("c"):
    print(__file__, ": package ``c'' not installed.")
    cleanup()
    exit(False)

if opkgcl.is_installed("b1"):
    print(__file__, ": package ``b1'' is installed, but should not be.")
    cleanup()
    exit(False)

cleanup()

What is the expected output? What do you see instead?

As ``a1'' is already installed, it is expected that opkg should choose to 
install ``a'' as satisfying the virtual dependency for ``v''. This is not the 
case.

Original issue reported on code.google.com by graham.g...@gmail.com on 25 Oct 2011 at 6:29

GoogleCodeExporter commented 8 years ago
I don't see how we could assume 'a' is a superior satisfying dependency here. 
Using C-style pseudocode, what if sizeof('b1') + sizeof('b') < sizeof('a')? I 
don't see why a package having less dependencies is inherently better.

Unless there's a specific reason why the current behaviour is wrong which I've 
missed, I don't think this is an issue.

Original comment by paul.betafive on 18 Sep 2013 at 1:31

GoogleCodeExporter commented 8 years ago
I agree that fewer dependencies is not a good metric for being superior. But 
'a' should be considered superior because it's already installed.

The bug is that 'b' and 'b1' are installed unnecessarily, in addition to 'a' 
and 'a1'.

Original comment by graham.g...@gmail.com on 18 Sep 2013 at 1:42

GoogleCodeExporter commented 8 years ago
I read the test case as installing just 'a1', not 'a'. If 'a' is already 
installed then yes, 'b' shouldn't be. Not sure that's what's being tested here 
though.

Original comment by paul.betafive on 18 Sep 2013 at 1:45

GoogleCodeExporter commented 8 years ago
Well, my memory is not reliable, so I'll defer to your judgement.

Original comment by graham.g...@gmail.com on 18 Sep 2013 at 1:58