[pacman-dev] [PATCH 1/2] make -d less strict; add -dd option

Florian Pritz bluewind at server-speed.net
Fri Jan 28 03:11:04 EST 2011


From: Florian Pritz <bluewind at xssn.at>

-d skips checking the version of a dependency.

-dd skips the whole dependency check

Signed-off-by: Xavier Chantry <chantry.xavier at gmail.com>
Signed-off-by: Florian Pritz <bluewind at server-speed.net>
---
 doc/pacman.8.txt                         |    7 ++++---
 src/pacman/pacman.c                      |    9 ++++++++-
 test/pacman/tests/sync-nodepversion01.py |    6 ++----
 test/pacman/tests/sync-nodepversion03.py |    4 ++--
 test/pacman/tests/sync-nodepversion04.py |    4 +---
 test/pacman/tests/sync-nodepversion05.py |    4 ++--
 test/pacman/tests/sync045.py             |    4 ++--
 test/pacman/tests/upgrade072.py          |    2 +-
 8 files changed, 22 insertions(+), 18 deletions(-)

diff --git a/doc/pacman.8.txt b/doc/pacman.8.txt
index 2b47a88..4ce8fa2 100644
--- a/doc/pacman.8.txt
+++ b/doc/pacman.8.txt
@@ -152,9 +152,10 @@ Options
 Transaction Options (apply to '-S', '-R' and '-U')
 --------------------------------------------------
 *-d, \--nodeps*::
-	Skips all dependency checks. Normally, pacman will always check a
-	package's dependency fields to ensure that all dependencies are
-	installed and there are no package conflicts in the system.
+	Skips dependency version checks. Package names are still checked Normally,
+	pacman will always check a package's dependency fields to ensure that all
+	dependencies are installed and there are no package conflicts in the
+	system.  Specify this option twice to skip all dependency checks.
 
 *-k, \--dbonly*::
 	Adds/Removes the database entry only, leaves all files in place.
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
index c267060..363b167 100644
--- a/src/pacman/pacman.c
+++ b/src/pacman/pacman.c
@@ -553,7 +553,14 @@ static int parsearg_query(int opt)
 static int parsearg_trans(int opt)
 {
 	switch(opt) {
-		case 'd': config->flags |= PM_TRANS_FLAG_NODEPS; break;
+		case 'd':
+			if(config->flags & PM_TRANS_FLAG_NODEPVERSION) {
+				config->flags ^= PM_TRANS_FLAG_NODEPVERSION;
+				config->flags |= PM_TRANS_FLAG_NODEPS;
+			} else {
+				config->flags |= PM_TRANS_FLAG_NODEPVERSION;
+			}
+			break;
 		case 'k': config->flags |= PM_TRANS_FLAG_DBONLY; break;
 		case OP_NOPROGRESSBAR: config->noprogressbar = 1; break;
 		case OP_NOSCRIPTLET: config->flags |= PM_TRANS_FLAG_NOSCRIPTLET; break;
diff --git a/test/pacman/tests/sync-nodepversion01.py b/test/pacman/tests/sync-nodepversion01.py
index 3db445f..5829b9e 100644
--- a/test/pacman/tests/sync-nodepversion01.py
+++ b/test/pacman/tests/sync-nodepversion01.py
@@ -1,4 +1,4 @@
-self.description = "nodepversion: -Sdd works"
+self.description = "nodepversion: -Sd works"
 
 p1 = pmpkg("pkg1", "1.0-2")
 p1.depends = ["provision>1.0-1"]
@@ -8,11 +8,9 @@
 p2.provides = ["provision=1.0-1"]
 self.addpkg2db("sync", p2)
 
-self.args = "-Sdd %s" % p1.name
+self.args = "-Sd %s" % p1.name
 
 self.addrule("PACMAN_RETCODE=0")
 self.addrule("PKG_EXIST=pkg1")
 self.addrule("PKG_EXIST=pkg2")
 self.addrule("PKG_DEPENDS=pkg1|provision>1.0-1")
-
-self.expectfailure = True
diff --git a/test/pacman/tests/sync-nodepversion03.py b/test/pacman/tests/sync-nodepversion03.py
index 8ebb1c8..378ff76 100644
--- a/test/pacman/tests/sync-nodepversion03.py
+++ b/test/pacman/tests/sync-nodepversion03.py
@@ -1,4 +1,4 @@
-self.description = "nodepversion: -Sd works but no deps"
+self.description = "nodepversion: -Sdd works but no deps"
 
 p1 = pmpkg("pkg1", "1.0-2")
 p1.depends = ["provision>=1.0-2"]
@@ -8,7 +8,7 @@
 p2.provides = ["provision=1.0-1"]
 self.addpkg2db("sync", p2)
 
-self.args = "-Sd %s" % p1.name
+self.args = "-Sdd %s" % p1.name
 
 self.addrule("PACMAN_RETCODE=0")
 self.addrule("PKG_EXIST=pkg1")
diff --git a/test/pacman/tests/sync-nodepversion04.py b/test/pacman/tests/sync-nodepversion04.py
index f5a091e..2bf83bb 100644
--- a/test/pacman/tests/sync-nodepversion04.py
+++ b/test/pacman/tests/sync-nodepversion04.py
@@ -8,10 +8,8 @@
 p2.provides = ["provision=1.0-1"]
 self.addpkg2db("sync", p2)
 
-self.args = "-Sdd %s" % p1.name
+self.args = "-Sd %s" % p1.name
 
 self.addrule("PACMAN_RETCODE=1")
 self.addrule("!PKG_EXIST=pkg1")
 self.addrule("!PKG_EXIST=pkg2")
-
-self.expectfailure = True
diff --git a/test/pacman/tests/sync-nodepversion05.py b/test/pacman/tests/sync-nodepversion05.py
index f2a45f0..bc048db 100644
--- a/test/pacman/tests/sync-nodepversion05.py
+++ b/test/pacman/tests/sync-nodepversion05.py
@@ -1,4 +1,4 @@
-self.description = "nodepversion: -Sudd works"
+self.description = "nodepversion: -Sud works"
 
 p1 = pmpkg("pkg1", "1.0-1")
 p1.depends = ["provision=1.0"]
@@ -12,7 +12,7 @@
 sp2.provides = ["provision=1.1"]
 self.addpkg2db("sync", sp2)
 
-self.args = "-Sudd"
+self.args = "-Sud"
 
 self.addrule("PACMAN_RETCODE=0")
 self.addrule("PKG_VERSION=pkg1|1.0-1")
diff --git a/test/pacman/tests/sync045.py b/test/pacman/tests/sync045.py
index 574c0a5..6c31983 100644
--- a/test/pacman/tests/sync045.py
+++ b/test/pacman/tests/sync045.py
@@ -1,4 +1,4 @@
-self.description = "Install a sync package conflicting with two local ones (-d)"
+self.description = "Install a sync package conflicting with two local ones (-dd)"
 
 sp = pmpkg("pkg1")
 sp.conflicts = ["pkg2", "pkg3"]
@@ -10,7 +10,7 @@
 lp2 = pmpkg("pkg3")
 self.addpkg2db("local", lp2);
 
-self.args = "-Sd %s --ask=4" % sp.name
+self.args = "-Sdd %s --ask=4" % sp.name
 
 self.addrule("PACMAN_RETCODE=0")
 self.addrule("PKG_EXIST=pkg1")
diff --git a/test/pacman/tests/upgrade072.py b/test/pacman/tests/upgrade072.py
index f88e150..116103b 100644
--- a/test/pacman/tests/upgrade072.py
+++ b/test/pacman/tests/upgrade072.py
@@ -6,7 +6,7 @@
 p.depends = ["dep1"]
 self.addpkg(p)
 
-self.args = "-Ud %s" % p.filename()
+self.args = "-Udd %s" % p.filename()
 
 self.addrule("PACMAN_RETCODE=0")
 self.addrule("PKG_EXIST=dummy")
-- 
1.7.3.5


More information about the pacman-dev mailing list