[pacman-dev] sync_prepare clean-up III, TODO
Xavier
shiningxc at gmail.com
Tue Jul 24 07:02:15 EDT 2007
On Mon, Jul 23, 2007 at 10:49:53PM +0200, Nagy Gabor wrote:
> > That pactest doesn't look right, does it?
>
> Oh, yes; copy/paste (fix sync / local):-P I'm on holiday now, there is no
> linux machine here, but you can probably fix the pactest
> file; after reading the code: the corrected pactest file probably fails.
Should the pactest look like that ? (I'm not sure how you wanted pkg2
versions in local and sync repo) :
self.description = "Induced removal would break dependency"
sp1 = pmpkg("pkg1", "1.0-2")
sp1.replaces = [ "pkg2" ]
self.addpkg2db("sync", sp1)
sp2 = pmpkg("pkg2", "1.0-2")
self.addpkg2db("sync", sp2)
sp3 = pmpkg("pkg3", "1.0-2")
sp3.depends = ["pkg2=1.0-2"]
self.addpkg2db("sync", sp3)
lp1 = pmpkg("pkg1", "1.0-1")
self.addpkg2db("local", lp1)
lp2 = pmpkg("pkg2", "1.0-1")
self.addpkg2db("local", lp2)
lp3 = pmpkg("pkg3", "1.0-1")
self.addpkg2db("local", lp3)
self.args = "-Su"
self.addrule("PACMAN_RETCODE=1")
self.addrule("PKG_EXIST=pkg2")
What happens here is that pacman first want to replace pkg2 by pkg1,
but since pkg1 doesn't provide pkg2 (is that a packaging error or what?),
pacman will pull it back when resolving the dependencies of sp3.
And so it'll actually upgrade the 3 packages without problems, since pkg1
doesn't conflict with pkg2.
So this pactest is not really interesting imo. I don't think that what pacman
does is really wrong here. What's really wrong is sp1, because it
shouldn't only replaces pkg2, it should also conflicts/provides it.
So the usual case looks like this (and it works fine) :
self.description = "Induced removal would break dependency"
sp1 = pmpkg("pkg1", "1.0-2")
sp1.replaces = [ "pkg2" ]
sp1.conflicts = [ "pkg2" ]
sp1.provides = [ "pkg2" ]
self.addpkg2db("sync", sp1)
sp2 = pmpkg("pkg2", "1.0-2")
self.addpkg2db("sync", sp2)
sp3 = pmpkg("pkg3", "1.0-2")
sp3.depends = ["pkg2=1.0-2"]
self.addpkg2db("sync", sp3)
lp1 = pmpkg("pkg1", "1.0-1")
self.addpkg2db("local", lp1)
lp2 = pmpkg("pkg2", "1.0-1")
self.addpkg2db("local", lp2)
lp3 = pmpkg("pkg3", "1.0-1")
self.addpkg2db("local", lp3)
self.args = "-Su"
self.addrule("PACMAN_RETCODE=0")
self.addrule("!PKG_EXIST=pkg2")
self.addrule("PKG_EXIST=pkg1")
self.addrule("PKG_EXIST=pkg3")
More information about the pacman-dev
mailing list