From d1ea16dfd0d497aff72d7a315890971e7f070786 Mon Sep 17 00:00:00 2001
From: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Date: Tue, 11 Mar 2008 16:40:27 +0100
Subject: Avoid duplicated target names.

This patch should avoid duplicated target names in the backend.
1. sync_loadtarget will return with PM_ERR_TRANS_DUP_TARGET when trying to
add a duplicated target
2. sysupgrade never pulls duplicated targets
3. resolvedeps won't pull duplicated targets anymore

A pulled list was introduced in sync_prepare to improve the
pmsyncpkg_t<->pmpkg_t list conversion by making it more direct.

Also replace sync1005 and sync1006 by the sync1008 pactest, which is
similar but more interesting (the provisions are dependencies instead of
explicit targets).
sync1005 didn't work as expected anyway. It was expecting that pacman
failed, and pacman indeed failed, but not for the good reason. It didn't
fail during the preparation step because of conflicting targets, but during
the commit step, because of a md5 error...
And sync1006 didn't pass and was not really worth fixing. We have already
enough failing pactests more important than these two.
sync1008 pass with this patch.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
---
 pactest/tests/sync1005.py | 14 --------------
 pactest/tests/sync1006.py | 14 --------------
 pactest/tests/sync1008.py | 19 +++++++++++++++++++
 3 files changed, 19 insertions(+), 28 deletions(-)
 delete mode 100644 pactest/tests/sync1005.py
 delete mode 100644 pactest/tests/sync1006.py
 create mode 100644 pactest/tests/sync1008.py

(limited to 'pactest')

diff --git a/pactest/tests/sync1005.py b/pactest/tests/sync1005.py
deleted file mode 100644
index 4fa82478..00000000
--- a/pactest/tests/sync1005.py
+++ /dev/null
@@ -1,14 +0,0 @@
-self.description = "Conflicting package names in sync repos"
-
-sp1 = pmpkg("pkg")
-sp1.provides = [ "provision1" ]
-self.addpkg2db("sync1", sp1)
-
-sp2 = pmpkg("pkg")
-sp2.provides = [ "provision2" ]
-self.addpkg2db("sync2", sp2)
-
-self.args = "-S provision1 provision2"
-
-self.addrule("PACMAN_RETCODE=1")
-self.addrule("!PKG_EXIST=pkg")
diff --git a/pactest/tests/sync1006.py b/pactest/tests/sync1006.py
deleted file mode 100644
index c331f42e..00000000
--- a/pactest/tests/sync1006.py
+++ /dev/null
@@ -1,14 +0,0 @@
-self.description = "Conflicting package names in sync repos (diff versions)"
-
-sp1 = pmpkg("pkg", "1.0-1")
-sp1.provides = [ "provision1" ]
-self.addpkg2db("sync1", sp1)
-
-sp2 = pmpkg("pkg", "2.0-1")
-sp2.provides = [ "provision2" ]
-self.addpkg2db("sync2", sp2)
-
-self.args = "-S provision1 provision2"
-
-self.addrule("PACMAN_RETCODE=1")
-self.addrule("!PKG_EXIST=pkg")
diff --git a/pactest/tests/sync1008.py b/pactest/tests/sync1008.py
new file mode 100644
index 00000000..a6064597
--- /dev/null
+++ b/pactest/tests/sync1008.py
@@ -0,0 +1,19 @@
+self.description = "Conflicting package names in sync repos"
+
+sp1 = pmpkg("cpkg", "1.0-1")
+sp1.provides = [ "provision1" ]
+self.addpkg2db("sync1", sp1)
+
+sp2 = pmpkg("cpkg", "2.0-1")
+sp2.provides = [ "provision2" ]
+self.addpkg2db("sync2", sp2)
+
+sp3 = pmpkg("pkg")
+sp3.depends = [ "provision1" , "provision2" ]
+self.addpkg2db("sync1", sp3)
+
+self.args = "-S pkg"
+
+self.addrule("PACMAN_RETCODE=1")
+self.addrule("!PKG_EXIST=pkg")
+self.addrule("!PKG_EXIST=cpkg")
-- 
cgit v1.2.3-54-g00ecf