[pacman-dev] sync_prepare clean-up III, TODO

Xavier shiningxc at gmail.com
Wed Jul 25 09:43:11 EDT 2007


On Wed, Jul 25, 2007 at 11:35:58AM +0200, Nagy Gabor wrote:
> Well, the fixed pactest file, this should fail:
> --------
> 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-2")
> 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")
> 

You were right to ignore everything I just said, it doesn't apply.
The local version of pkg2 being 1.0-2 is very important, that's why I wanted
you to submit the new corrected pactest yourself :)

So yes, there is indeed a problem when a dependency is satisfied by a locally
installed package going to be removed (pkg2 here).
Btw it's possible to achieve the same with conflicts instead of replaces. Not
sure which one we should choose, maybe both?

Anyway, is here the same (I think) pactest simplified a bit, in a git patch :

>From fa7f06fce067baf1fd5d857fcee4178444c2f811 Mon Sep 17 00:00:00 2001
From: Chantry Xavier <shiningxc at gmail.com>
Date: Wed, 25 Jul 2007 14:47:46 +0200
Subject: [PATCH] Add sync1003 pactest.

This test shows a problem when a dependency is satisfied by a locally
installed package going to be removed (pkg2 here).

checkdeps doesn't know about packages going to be removed, and so fails
to do its job (checking dependencies) correctly.

Signed-off-by: Chantry Xavier <shiningxc at gmail.com>
---
 pactest/tests/sync1003.py |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
 create mode 100644 pactest/tests/sync1003.py

diff --git a/pactest/tests/sync1003.py b/pactest/tests/sync1003.py
new file mode 100644
index 0000000..27a7aa5
--- /dev/null
+++ b/pactest/tests/sync1003.py
@@ -0,0 +1,17 @@
+self.description = "Induced removal would break dependency"
+
+sp1 = pmpkg("pkg1", "1.0-1")
+sp1.conflicts = [ "pkg2" ]
+self.addpkg2db("sync", sp1)
+
+lp2 = pmpkg("pkg2", "1.0-2")
+self.addpkg2db("local", lp2)
+
+lp3 = pmpkg("pkg3", "1.0-1")
+lp3.depends = ["pkg2=1.0-2"]
+self.addpkg2db("local", lp3)
+
+self.args = "-S pkg1"
+
+self.addrule("PACMAN_RETCODE=1")
+self.addrule("PKG_EXIST=pkg2")
-- 
1.5.2.4





More information about the pacman-dev mailing list