1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-12-21 23:38:49 -05:00

test version range restrictions corner case

The test introduced herein illustrates a behavior that may be unexpected
to package writers.

It creates a package "pkg3" that is configured to depend on a
"dependency" which version is between 3 and 4, inclusive. Two other
packages are already present, providing "dependency" in version 2 and 5,
respectively. So, the situation looks roughly like this:

                 pkg1               pkg3                pkg2
               provides          depends on           provides
                  |            <------------>            |
version __________2____________3____________4____________5___________...

This seems to be enough to satisfy pacman when installing "pkg3". From
an iterative standpoint, this is completely logical: First, the
requirement "dependency>=3" is checked. There is a package that
satisfies this restriction, it is called "pkg2". Afterwards,
"dependency<=4" is covered in the same way by "pkg1".

Nonetheless, what a package writer intends when specifying

   depends=('dependency>=3' 'dependency<=4')

is most probably that pacman should only allow this package to be
installed when there indeed is a package present that provides a version
of "dependency" that lies _between_ 3 and 5.

Signed-off-by: Dominik Fischer <d dot f dot fischer at web dot de>
Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Dominik Fischer 2015-12-07 21:37:09 +01:00 committed by Allan McRae
parent 00c0329531
commit 9813107c33
2 changed files with 20 additions and 0 deletions

View File

@ -15,6 +15,7 @@ TESTS += test/pacman/tests/depconflict110.py
TESTS += test/pacman/tests/depconflict111.py
TESTS += test/pacman/tests/depconflict120.py
TESTS += test/pacman/tests/dependency-cycle-fixed-by-upgrade.py
TESTS += test/pacman/tests/deprange001.py
TESTS += test/pacman/tests/deptest001.py
TESTS += test/pacman/tests/dummy001.py
TESTS += test/pacman/tests/epoch001.py

View File

@ -0,0 +1,19 @@
self.description = "dependency ranges should be satisfied by the same package"
lp1 = pmpkg("pkg1")
lp1.provides = ["dependency=2"]
self.addpkg2db("local", lp1)
lp2 = pmpkg("pkg2")
lp2.provides = ["dependency=5"]
self.addpkg2db("local", lp2)
p = pmpkg("pkg3")
p.depends = ["dependency>=3", "dependency<=4"]
self.addpkg(p)
self.args = "-U %s" % p.filename()
self.addrule("PACMAN_RETCODE=1")
self.addrule("!PKG_EXIST=pkg3")
self.expectfailure = True