Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/pactest
diff options
context:
space:
mode:
Diffstat (limited to 'pactest')
-rw-r--r--pactest/Makefile.am3
-rwxr-xr-xpactest/pmtest.py28
-rw-r--r--pactest/tests/TESTS63
-rw-r--r--pactest/tests/add001.py13
-rw-r--r--pactest/tests/add002.py18
-rw-r--r--pactest/tests/add004.py18
-rw-r--r--pactest/tests/add010.py15
-rw-r--r--pactest/tests/add050.py17
-rw-r--r--pactest/tests/depconflict110.py2
-rw-r--r--pactest/tests/depconflict111.py2
-rw-r--r--pactest/tests/deptest001.py24
-rw-r--r--pactest/tests/fileconflict001.py2
-rw-r--r--pactest/tests/fileconflict002.py2
-rw-r--r--pactest/tests/ldconfig001.py2
-rw-r--r--pactest/tests/mode001.py2
-rw-r--r--pactest/tests/mode002.py12
-rw-r--r--pactest/tests/mode003.py20
-rw-r--r--pactest/tests/query003.py1
-rw-r--r--pactest/tests/reason001.py16
-rw-r--r--pactest/tests/remove001.py5
-rw-r--r--pactest/tests/remove030.py2
-rw-r--r--pactest/tests/remove049.py19
-rw-r--r--pactest/tests/remove050.py20
-rw-r--r--pactest/tests/remove051.py20
-rw-r--r--pactest/tests/remove052.py21
-rw-r--r--pactest/tests/smoke001.py2
-rw-r--r--pactest/tests/sync021.py2
-rw-r--r--pactest/tests/sync031.py19
-rw-r--r--pactest/tests/sync1001.py18
-rw-r--r--pactest/tests/sync1002.py19
-rw-r--r--pactest/tests/sync1006.py14
-rw-r--r--pactest/tests/sync1008.py (renamed from pactest/tests/sync1005.py)11
-rw-r--r--pactest/tests/sync1101.py1
-rw-r--r--pactest/tests/sync120.py2
-rw-r--r--pactest/tests/sync133.py2
-rw-r--r--pactest/tests/sync138.py2
-rw-r--r--pactest/tests/sync301.py4
-rw-r--r--pactest/tests/sync500.py15
-rw-r--r--pactest/tests/sync501.py18
-rw-r--r--pactest/tests/sync893.py4
-rw-r--r--pactest/tests/sync897.py6
-rw-r--r--pactest/tests/upgrade005.py (renamed from pactest/tests/add003.py)2
-rw-r--r--pactest/tests/upgrade010.py2
-rw-r--r--pactest/tests/upgrade012.py (renamed from pactest/tests/add011.py)2
-rw-r--r--pactest/tests/upgrade013.py (renamed from pactest/tests/add012.py)2
-rw-r--r--pactest/tests/upgrade014.py (renamed from pactest/tests/add013.py)2
-rw-r--r--pactest/tests/upgrade015.py (renamed from pactest/tests/add020.py)2
-rw-r--r--pactest/tests/upgrade016.py (renamed from pactest/tests/add021.py)2
-rw-r--r--pactest/tests/upgrade032.py19
-rw-r--r--pactest/tests/upgrade070.py (renamed from pactest/tests/add060.py)4
-rw-r--r--pactest/tests/upgrade071.py (renamed from pactest/tests/add040.py)2
-rw-r--r--pactest/tests/upgrade072.py (renamed from pactest/tests/add041.py)2
-rw-r--r--pactest/tests/upgrade073.py (renamed from pactest/tests/add042.py)2
-rw-r--r--pactest/tests/upgrade074.py (renamed from pactest/tests/add046.py)2
-rw-r--r--pactest/tests/upgrade075.py (renamed from pactest/tests/add047.py)2
-rw-r--r--pactest/tests/xfercommand001.py2
-rwxr-xr-xpactest/util.py42
57 files changed, 293 insertions, 284 deletions
diff --git a/pactest/Makefile.am b/pactest/Makefile.am
index 879f23d0..85bb8017 100644
--- a/pactest/Makefile.am
+++ b/pactest/Makefile.am
@@ -7,8 +7,7 @@ check_SCRIPTS = \
pmrule.py \
pmtest.py \
util.py \
- $(wildcard tests/*.py) \
- tests/TESTS
+ $(wildcard tests/*.py)
noinst_SCRIPTS = $(check_SCRIPTS)
diff --git a/pactest/pmtest.py b/pactest/pmtest.py
index cd532dcf..e8f6fa8d 100755
--- a/pactest/pmtest.py
+++ b/pactest/pmtest.py
@@ -83,7 +83,8 @@ class pmtest:
"noupgrade": [],
"ignorepkg": [],
"ignoregroup": [],
- "noextract": []
+ "noextract": [],
+ "syncfirst": []
}
# Test rules
@@ -188,18 +189,22 @@ class pmtest:
cmd = [""]
if os.geteuid() != 0:
- cmd.append("fakeroot")
+ fakeroot = which("fakeroot")
+ if not fakeroot:
+ print "WARNING: fakeroot not found!"
+ else:
+ cmd.append("fakeroot")
- fakechroot = which("fakechroot")
- if not fakechroot:
- print "WARNING: fakechroot not found, scriptlet tests WILL fail!!!"
- else:
- cmd.append("fakechroot")
+ fakechroot = which("fakechroot")
+ if not fakechroot:
+ print "WARNING: fakechroot not found, scriptlet tests WILL fail!!!"
+ else:
+ cmd.append("fakechroot")
if pacman["gdb"]:
- cmd.append("libtool gdb --args")
+ cmd.append("libtool execute gdb --args")
if pacman["valgrind"]:
- cmd.append("valgrind --tool=memcheck --leak-check=full --show-reachable=yes")
+ cmd.append("valgrind -q --tool=memcheck --leak-check=full --show-reachable=yes")
cmd.append("\"%s\" --config=\"%s\" --root=\"%s\" --dbpath=\"%s\" --cachedir=\"%s\"" \
% (pacman["bin"],
os.path.join(self.root, PACCONF),
@@ -233,11 +238,6 @@ class pmtest:
vprint("\tretcode = %s" % self.retcode)
os.chdir(curdir)
- # Check if pacman failed because of bad permissions
- if self.retcode and not pacman["nolog"] \
- and grep(os.path.join(self.root, LOGFILE),
- "you cannot perform this operation unless you are root"):
- print "\tERROR: pacman support for fakeroot is not disabled"
# Check if the lock is still there
if os.path.isfile(PM_LOCK):
print "\tERROR: %s not removed" % PM_LOCK
diff --git a/pactest/tests/TESTS b/pactest/tests/TESTS
deleted file mode 100644
index e09a78b9..00000000
--- a/pactest/tests/TESTS
+++ /dev/null
@@ -1,63 +0,0 @@
-TODO: this is really outdated, needs regeneration (after we rename tests)
-
-add001: Install a package
-add002: Install a package (already installed)
-add003: Install a set of packages
-add004: Install a set of the same package at different versions
-add010: Install a package with a filesystem conflict
-add011: Install a package with a filesystem conflict (--force)
-add012: Install two packages with a conflicting file
-add013: Install two packages with a conflicting file (--force)
-add020: Install a package with an existing file
-add021: Install a package with an existing file (new modified)
-add030: Freshen a package
-add031: Freshen a package (installed is newer)
-add032: Freshen a package (installed is newer)
-add040: Install a package with a missing dependency
-add041: Install a package with a missing dependency (nodeps)
-add042: Install a package with cascaded dependencies
-add050: Install a package with a file in NoUpgrade
-add060: Install a package with a file in NoExtract
-query001: Query a package
-remove010: Remove a package, with a file marked for backup
-remove011: Remove a package, with a modified file marked for backup
-remove020: Remove a package, with a file marked for backup (--nosave)
-remove021: Remove a package, with a modified file marked for backup (--nosave)
-smoke001: Install a thousand packages in a single transaction
-sync001: Install a package from a sync db
-sync002: Upgrade a package from a sync db
-sync003: Install a package from a sync db, with a filesystem conflict
-sync010: Install a package from a sync db, with its dependencies
-sync040: Install two targets with a conflict
-sync041: Install two conflicting targets
-sync042: Install a sync package conflicting with a local one
-sync043: Install a sync package conflicting with a local one
-sync050: Install a virtual target (provided by a sync package)
-sync100: Sysupgrade with a newer sync package
-sync101: Sysupgrade with same version for local and sync packages
-sync102: Sysupgrade with a newer local package
-sync103: Sysupgrade with a local package not existing in sync db
-sync110: Sysupgrade of a package pulling new dependencies
-sync120: Sysupgrade of packages in 'IgnorePkg'
-sync130: Sysupgrade with a sync package replacing a local one
-sync131: Sysupgrade with a sync package replacing a set of local ones
-sync132: Sysupgrade with a replacement for a local package out of date
-sync133: Sysupgrade with a sync package replacing a local one in 'IgnorePkg'
-sync134: Sysupgrade with a set of sync packages replacing a set local one
-sync135: Sysupgrade with a set of sync packages replacing a set of local ones
-sync897: System upgrade
-sync898: System upgrade
-sync899: System upgrade
-sync990: Sync a package pulling a dependency conflicting with a target
-sync992: Sync a package pulling a conflicting dependency
-sync999: System upgrade
-upgrade001: Upgrade a package (newer version)
-upgrade002: Upgrade a package (same version)
-upgrade003: Upgrade a package (lesser version)
-upgrade004: Upgrade a package (not installed)
-upgrade010: Upgrade a package, with a file in NoUpgrade
-upgrade020: Upgrade a package, with a file in 'backup' (new modified)
-upgrade021: Upgrade a package, with a file in 'backup' (local modified, new unchanged)
-upgrade022: Upgrade a package, with a file in 'backup' (local and new modified)
-upgrade030: Upgrade packages with various reasons
-upgrade040: file relocation 1
diff --git a/pactest/tests/add001.py b/pactest/tests/add001.py
deleted file mode 100644
index 3dde4061..00000000
--- a/pactest/tests/add001.py
+++ /dev/null
@@ -1,13 +0,0 @@
-self.description = "Install a simple package with two files"
-
-p = pmpkg("dummy")
-p.files = ["bin/dummy",
- "usr/man/man1/dummy.1"]
-self.addpkg(p)
-
-self.args = "-A %s" % p.filename()
-
-self.addrule("PACMAN_RETCODE=0")
-self.addrule("PKG_EXIST=dummy")
-for f in p.files:
- self.addrule("FILE_EXIST=%s" % f)
diff --git a/pactest/tests/add002.py b/pactest/tests/add002.py
deleted file mode 100644
index f6bc91a2..00000000
--- a/pactest/tests/add002.py
+++ /dev/null
@@ -1,18 +0,0 @@
-self.description = "Install an already-installed package"
-
-lp = pmpkg("dummy")
-lp.files = ["bin/dummy",
- "usr/man/man1/dummy.1"]
-self.addpkg2db("local", lp)
-
-p = pmpkg("dummy")
-p.files = ["bin/dummy",
- "usr/man/man1/dummy.1"]
-self.addpkg(p)
-
-self.args = "-A %s" % p.filename()
-
-self.addrule("PACMAN_RETCODE=1")
-self.addrule("!PKG_MODIFIED=dummy")
-for f in lp.files:
- self.addrule("!FILE_MODIFIED=%s" % f)
diff --git a/pactest/tests/add004.py b/pactest/tests/add004.py
deleted file mode 100644
index d0188563..00000000
--- a/pactest/tests/add004.py
+++ /dev/null
@@ -1,18 +0,0 @@
-self.description = "Install three of the same package at different versions"
-
-p1 = pmpkg("dummy", "1.0-2")
-p1.files = ["bin/dummy"]
-p2 = pmpkg("dummy", "2.0-1")
-p2.files = ["bin/dummy"]
-p3 = pmpkg("dummy")
-p3.files = ["bin/dummy"]
-
-for p in p1, p2, p3:
- self.addpkg(p)
-
-self.args = "-A %s" % " ".join([p.filename() for p in p1, p2, p3])
-
-self.addrule("PACMAN_RETCODE=0")
-self.addrule("PKG_VERSION=dummy|2.0-1")
-for f in p2.files:
- self.addrule("FILE_EXIST=%s" % f)
diff --git a/pactest/tests/add010.py b/pactest/tests/add010.py
deleted file mode 100644
index a7874746..00000000
--- a/pactest/tests/add010.py
+++ /dev/null
@@ -1,15 +0,0 @@
-self.description = "Install a package with a filesystem conflict"
-
-p = pmpkg("dummy")
-p.files = ["bin/dummy",
- "usr/man/man1/dummy.1"]
-self.addpkg(p)
-
-self.filesystem = ["bin/dummy"]
-
-self.args = "-A %s" % p.filename()
-
-self.addrule("PACMAN_RETCODE=1")
-self.addrule("!PKG_EXIST=dummy")
-self.addrule("!FILE_MODIFIED=bin/dummy")
-self.addrule("!FILE_EXIST=usr/man/man1/dummy.1")
diff --git a/pactest/tests/add050.py b/pactest/tests/add050.py
deleted file mode 100644
index b48459ab..00000000
--- a/pactest/tests/add050.py
+++ /dev/null
@@ -1,17 +0,0 @@
-self.description = "Install a package with a file in NoUpgrade"
-
-p = pmpkg("dummy")
-p.files = ["etc/dummy.conf"]
-p.backup = ["etc/dummy.conf"]
-self.addpkg(p)
-
-self.filesystem = ["etc/dummy.conf"]
-
-self.option["noupgrade"] = ["etc/dummy.conf"]
-
-self.args = "-Af %s" % p.filename()
-
-self.addrule("PACMAN_RETCODE=0")
-self.addrule("PKG_EXIST=dummy")
-self.addrule("!FILE_MODIFIED=etc/dummy.conf")
-self.addrule("FILE_PACNEW=etc/dummy.conf")
diff --git a/pactest/tests/depconflict110.py b/pactest/tests/depconflict110.py
index 2e326f52..fd56fa89 100644
--- a/pactest/tests/depconflict110.py
+++ b/pactest/tests/depconflict110.py
@@ -7,7 +7,7 @@ self.addpkg(p);
lp = pmpkg("pkg2", "1.0-1")
self.addpkg2db("local", lp)
-self.args = "-A %s" % p.filename()
+self.args = "-U %s" % p.filename()
self.addrule("PACMAN_RETCODE=1")
self.addrule("!PKG_EXIST=pkg1")
self.addrule("PKG_EXIST=pkg2")
diff --git a/pactest/tests/depconflict111.py b/pactest/tests/depconflict111.py
index 6f95733b..0d11dd92 100644
--- a/pactest/tests/depconflict111.py
+++ b/pactest/tests/depconflict111.py
@@ -7,7 +7,7 @@ self.addpkg(p);
lp = pmpkg("pkg2", "1.0-1")
self.addpkg2db("local", lp)
-self.args = "-A %s" % p.filename()
+self.args = "-U %s" % p.filename()
self.addrule("PACMAN_RETCODE=0")
self.addrule("PKG_EXIST=pkg1")
self.addrule("PKG_EXIST=pkg2")
diff --git a/pactest/tests/deptest001.py b/pactest/tests/deptest001.py
index db0b7684..18569bea 100644
--- a/pactest/tests/deptest001.py
+++ b/pactest/tests/deptest001.py
@@ -1,20 +1,16 @@
self.description = "test deptest (-T) functionality"
-sp1 = pmpkg("pkg1")
-sp1.depends = ["dep"]
-self.addpkg2db("sync", sp1)
+lp1 = pmpkg("pkg1")
+self.addpkg2db("local", lp1)
-sp1dep = pmpkg("dep")
-self.addpkg2db("sync", sp1dep)
+lp3 = pmpkg("pkg3", "2.0-1")
+lp3.provides = ("prov=3.0")
+self.addpkg2db("local", lp3)
-sp2 = pmpkg("pkg2")
-self.addpkg2db("sync", sp2)
-
-lp2 = pmpkg("pkg2")
-self.addpkg2db("local", lp2)
-
-self.args = "-T pkg1 pkg2"
+self.args = "-T pkg1 pkg2 pkg3\>2.1 prov\>\=3.0"
self.addrule("PACMAN_RETCODE=127")
-self.addrule("PACMAN_OUTPUT=pkg1")
-self.addrule("!PACMAN_OUTPUT=pkg2")
+self.addrule("!PACMAN_OUTPUT=pkg1")
+self.addrule("PACMAN_OUTPUT=pkg2")
+self.addrule("PACMAN_OUTPUT=pkg3")
+self.addrule("!PACMAN_OUTPUT=prov")
diff --git a/pactest/tests/fileconflict001.py b/pactest/tests/fileconflict001.py
index 8aca9a0a..4c2069ee 100644
--- a/pactest/tests/fileconflict001.py
+++ b/pactest/tests/fileconflict001.py
@@ -13,7 +13,7 @@ p2 = pmpkg("pkg2")
p2.files = ["dir/symdir/file"]
self.addpkg(p2)
-self.args = "-A %s" % " ".join([p.filename() for p in p1, p2])
+self.args = "-U %s" % " ".join([p.filename() for p in p1, p2])
self.addrule("PACMAN_RETCODE=1")
self.addrule("!PKG_EXIST=pkg1")
diff --git a/pactest/tests/fileconflict002.py b/pactest/tests/fileconflict002.py
index da04e332..c54f6daf 100644
--- a/pactest/tests/fileconflict002.py
+++ b/pactest/tests/fileconflict002.py
@@ -9,7 +9,7 @@ p2 = pmpkg("pkg2")
p2.files = ["dir/symdir/file"]
self.addpkg(p2)
-self.args = "-A %s" % " ".join([p.filename() for p in p1, p2])
+self.args = "-U %s" % " ".join([p.filename() for p in p1, p2])
self.addrule("PACMAN_RETCODE=1")
self.addrule("!PKG_EXIST=pkg1")
diff --git a/pactest/tests/ldconfig001.py b/pactest/tests/ldconfig001.py
index aced413b..9ac2ff35 100644
--- a/pactest/tests/ldconfig001.py
+++ b/pactest/tests/ldconfig001.py
@@ -6,7 +6,7 @@ p = pmpkg("dummy")
self.addpkg(p)
# --debug is necessary to check PACMAN_OUTPUT
-self.args = "--debug -A %s" % p.filename()
+self.args = "--debug -U %s" % p.filename()
self.addrule("PACMAN_RETCODE=0")
self.addrule("PACMAN_OUTPUT=ldconfig")
diff --git a/pactest/tests/mode001.py b/pactest/tests/mode001.py
index ff245a2c..4ec11e10 100644
--- a/pactest/tests/mode001.py
+++ b/pactest/tests/mode001.py
@@ -1,7 +1,7 @@
self.description = "Check the mode of default files in a package"
p = pmpkg("pkg1")
-p.files = ["bin/foo"
+p.files = ["bin/foo",
"bin/bar"]
self.addpkg(p)
diff --git a/pactest/tests/mode002.py b/pactest/tests/mode002.py
new file mode 100644
index 00000000..cc4a8fe8
--- /dev/null
+++ b/pactest/tests/mode002.py
@@ -0,0 +1,12 @@
+self.description = "Check execute mode on files in a package"
+
+p = pmpkg("pkg1")
+p.files = ["bin/foo|755",
+ "bin/bar|755"]
+self.addpkg(p)
+
+self.args = "-U %s" % p.filename()
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("FILE_MODE=bin/foo|755")
+self.addrule("FILE_MODE=bin/bar|755")
diff --git a/pactest/tests/mode003.py b/pactest/tests/mode003.py
new file mode 100644
index 00000000..1193a5cf
--- /dev/null
+++ b/pactest/tests/mode003.py
@@ -0,0 +1,20 @@
+self.description = "Backup file permissions test (same as orig)"
+
+lp = pmpkg("filesystem")
+lp.files = ["etc/profile|666"]
+lp.backup = ["etc/profile*"]
+self.addpkg2db("local", lp)
+
+p = pmpkg("filesystem", "1.0-2")
+p.files = ["etc/profile|666**"]
+p.backup = ["etc/profile"]
+self.addpkg(p)
+
+self.args = "-U %s" % p.filename()
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("!FILE_PACSAVE=etc/profile")
+self.addrule("FILE_PACNEW=etc/profile")
+self.addrule("FILE_EXIST=etc/profile")
+self.addrule("FILE_MODE=etc/profile|666")
+self.addrule("FILE_MODE=etc/profile.pacnew|666")
diff --git a/pactest/tests/query003.py b/pactest/tests/query003.py
index ea113081..41b8a45b 100644
--- a/pactest/tests/query003.py
+++ b/pactest/tests/query003.py
@@ -2,6 +2,7 @@ self.description = "Query search for a package"
p = pmpkg("foobar")
p.files = ["bin/foobar"]
+p.groups = ["group1", "group2"]
self.addpkg2db("local", p)
self.args = "-Qs %s" % p.name
diff --git a/pactest/tests/reason001.py b/pactest/tests/reason001.py
new file mode 100644
index 00000000..40433f5e
--- /dev/null
+++ b/pactest/tests/reason001.py
@@ -0,0 +1,16 @@
+self.description = "Copy reason (to-be-replaced -> replacement)"
+
+sp = pmpkg("libfoo-ng")
+sp.replaces = [ "libfoo" ]
+self.addpkg2db("sync", sp)
+
+lp = pmpkg("libfoo")
+lp.reason = 1
+self.addpkg2db("local", lp)
+
+self.args = "-Su"
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("!PKG_EXIST=libfoo")
+self.addrule("PKG_EXIST=libfoo-ng")
+self.addrule("PKG_REASON=libfoo-ng|1")
diff --git a/pactest/tests/remove001.py b/pactest/tests/remove001.py
index 809bfdb7..d20dd079 100644
--- a/pactest/tests/remove001.py
+++ b/pactest/tests/remove001.py
@@ -1,4 +1,3 @@
-# If someone else can come up with a better name, please do so
self.description = "Remove a package listed 5 times"
p = pmpkg("foo")
@@ -6,5 +5,5 @@ self.addpkg2db("local", p)
self.args = "-R " + "foo "*5
-self.addrule("PACMAN_RETCODE=0")
-self.addrule("!PKG_EXISTS=foo")
+self.addrule("PACMAN_RETCODE=1")
+self.addrule("PKG_EXISTS=foo")
diff --git a/pactest/tests/remove030.py b/pactest/tests/remove030.py
index cc23f144..9e2b9da5 100644
--- a/pactest/tests/remove030.py
+++ b/pactest/tests/remove030.py
@@ -3,7 +3,7 @@ self.description = "Remove a package in HoldPkg"
p1 = pmpkg("dummy")
self.addpkg2db("local", p1)
-self.option["holdpkg"] = ["dummy"]
+self.option["HoldPkg"] = ["dummy"]
self.args = "-R %s" % p1.name
diff --git a/pactest/tests/remove049.py b/pactest/tests/remove049.py
new file mode 100644
index 00000000..724f8da2
--- /dev/null
+++ b/pactest/tests/remove049.py
@@ -0,0 +1,19 @@
+self.description = "-Ru test"
+
+lp1 = pmpkg("pkg1")
+lp1.requiredby = [ "pkg3" ]
+self.addpkg2db("local", lp1)
+
+lp2 = pmpkg("pkg2")
+self.addpkg2db("local", lp2)
+
+lp3 = pmpkg("pkg3")
+lp3.depends = [ "pkg1" ]
+self.addpkg2db("local", lp3)
+
+self.args = "-Ru pkg1 pkg2"
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_EXIST=pkg1")
+self.addrule("!PKG_EXIST=pkg2")
+self.addrule("PKG_EXIST=pkg3") \ No newline at end of file
diff --git a/pactest/tests/remove050.py b/pactest/tests/remove050.py
new file mode 100644
index 00000000..44b0d18c
--- /dev/null
+++ b/pactest/tests/remove050.py
@@ -0,0 +1,20 @@
+self.description = "-Rs test (exclude explicit)"
+
+lp1 = pmpkg("pkg1")
+lp1.depends = ["pkg2" , "pkg3"]
+self.addpkg2db("local", lp1)
+
+lp2 = pmpkg("pkg2")
+lp2.reason = 1
+self.addpkg2db("local", lp2)
+
+lp3 = pmpkg("pkg3")
+lp3.reason = 0
+self.addpkg2db("local", lp3)
+
+self.args = "-Rs %s" % lp1.name
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("!PKG_EXIST=pkg1")
+self.addrule("!PKG_EXIST=pkg2")
+self.addrule("PKG_EXIST=pkg3")
diff --git a/pactest/tests/remove051.py b/pactest/tests/remove051.py
new file mode 100644
index 00000000..bba87bba
--- /dev/null
+++ b/pactest/tests/remove051.py
@@ -0,0 +1,20 @@
+self.description = "-Rss test (include explicit)"
+
+lp1 = pmpkg("pkg1")
+lp1.depends = ["pkg2" , "pkg3"]
+self.addpkg2db("local", lp1)
+
+lp2 = pmpkg("pkg2")
+lp2.reason = 1
+self.addpkg2db("local", lp2)
+
+lp3 = pmpkg("pkg3")
+lp3.reason = 0
+self.addpkg2db("local", lp3)
+
+self.args = "-Rss %s" % lp1.name
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("!PKG_EXIST=pkg1")
+self.addrule("!PKG_EXIST=pkg2")
+self.addrule("!PKG_EXIST=pkg3")
diff --git a/pactest/tests/remove052.py b/pactest/tests/remove052.py
new file mode 100644
index 00000000..df1e0db1
--- /dev/null
+++ b/pactest/tests/remove052.py
@@ -0,0 +1,21 @@
+self.description = "-Rs test (dependency chain)"
+
+lp1 = pmpkg("pkg1")
+lp1.depends = ["pkg2"]
+self.addpkg2db("local", lp1)
+
+lp2 = pmpkg("pkg2")
+lp2.depends = ["pkg3"]
+lp2.reason = 1
+self.addpkg2db("local", lp2)
+
+lp3 = pmpkg("pkg3")
+lp3.reason = 1
+self.addpkg2db("local", lp3)
+
+self.args = "-Rs %s" % " ".join([p.name for p in lp1, lp3])
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("!PKG_EXIST=pkg1")
+self.addrule("!PKG_EXIST=pkg2")
+self.addrule("!PKG_EXIST=pkg3")
diff --git a/pactest/tests/smoke001.py b/pactest/tests/smoke001.py
index 71a08d3f..c6636391 100644
--- a/pactest/tests/smoke001.py
+++ b/pactest/tests/smoke001.py
@@ -12,7 +12,7 @@ for i in range(1000):
_list = []
[_list.append(p.filename()) for p in self.localpkgs]
-self.args = "-A %s" % " ".join(_list)
+self.args = "-U %s" % " ".join(_list)
self.addrule("PACMAN_RETCODE=0")
#for i in range(1000):
diff --git a/pactest/tests/sync021.py b/pactest/tests/sync021.py
index a4073eed..4c664d8e 100644
--- a/pactest/tests/sync021.py
+++ b/pactest/tests/sync021.py
@@ -12,7 +12,7 @@ sp3.groups = ["grp"]
for p in sp1, sp2, sp3:
self.addpkg2db("sync", p);
-self.option["ignorepkg"] = ["pkg2"]
+self.option["IgnorePkg"] = ["pkg2"]
self.args = "-S grp"
diff --git a/pactest/tests/sync031.py b/pactest/tests/sync031.py
new file mode 100644
index 00000000..4aa2ee39
--- /dev/null
+++ b/pactest/tests/sync031.py
@@ -0,0 +1,19 @@
+self.description = "Sync packages explicitly"
+
+lp1 = pmpkg("pkg1")
+lp1.reason = 1
+self.addpkg2db("local", lp1)
+
+p1 = pmpkg("pkg1", "1.0-2")
+p2 = pmpkg("pkg2", "1.0-2")
+
+for p in p1, p2:
+ self.addpkg2db("sync", p)
+
+self.args = "-S --asexplicit %s" % " ".join([p.name for p in p1, p2])
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_VERSION=pkg1|1.0-2")
+self.addrule("PKG_VERSION=pkg2|1.0-2")
+self.addrule("PKG_REASON=pkg1|0")
+self.addrule("PKG_REASON=pkg2|0")
diff --git a/pactest/tests/sync1001.py b/pactest/tests/sync1001.py
deleted file mode 100644
index 6c4aabcf..00000000
--- a/pactest/tests/sync1001.py
+++ /dev/null
@@ -1,18 +0,0 @@
-self.description = "Test -Se (ensure specified package is not installed)"
-
-sp1 = pmpkg("dummy")
-sp1.depends = [ "dep1", "dep2" ]
-self.addpkg2db("sync", sp1)
-
-sp2 = pmpkg("dep1")
-self.addpkg2db("sync", sp2)
-
-sp3 = pmpkg("dep2")
-self.addpkg2db("sync", sp3)
-
-self.args = "-Se dummy"
-
-self.addrule("PACMAN_RETCODE=0")
-self.addrule("PKG_EXIST=dep1")
-self.addrule("PKG_EXIST=dep2")
-self.addrule("!PKG_EXIST=dummy")
diff --git a/pactest/tests/sync1002.py b/pactest/tests/sync1002.py
deleted file mode 100644
index c158838b..00000000
--- a/pactest/tests/sync1002.py
+++ /dev/null
@@ -1,19 +0,0 @@
-self.description = "Test -Se (resolve the dependencies' dependencies )"
-
-sp1 = pmpkg("pkg1")
-sp1.depends = [ "pkg2" ]
-self.addpkg2db("sync", sp1)
-
-sp2 = pmpkg("pkg2")
-sp2.depends = [ "pkg3" ]
-self.addpkg2db("sync", sp2)
-
-sp3 = pmpkg("pkg3")
-self.addpkg2db("sync", sp3)
-
-self.args = "-Se pkg1 pkg3"
-
-self.addrule("PACMAN_RETCODE=0")
-self.addrule("PKG_EXIST=pkg2")
-self.addrule("PKG_EXIST=pkg3")
-self.addrule("!PKG_EXIST=pkg1")
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/sync1005.py b/pactest/tests/sync1008.py
index 4fa82478..a6064597 100644
--- a/pactest/tests/sync1005.py
+++ b/pactest/tests/sync1008.py
@@ -1,14 +1,19 @@
self.description = "Conflicting package names in sync repos"
-sp1 = pmpkg("pkg")
+sp1 = pmpkg("cpkg", "1.0-1")
sp1.provides = [ "provision1" ]
self.addpkg2db("sync1", sp1)
-sp2 = pmpkg("pkg")
+sp2 = pmpkg("cpkg", "2.0-1")
sp2.provides = [ "provision2" ]
self.addpkg2db("sync2", sp2)
-self.args = "-S provision1 provision2"
+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")
diff --git a/pactest/tests/sync1101.py b/pactest/tests/sync1101.py
index ba2ad44f..e3ed0f0f 100644
--- a/pactest/tests/sync1101.py
+++ b/pactest/tests/sync1101.py
@@ -1,6 +1,7 @@
self.description = "Search for package from a sync db"
sp = pmpkg("dummy")
+sp.groups = ["group1", "group2"]
sp.files = ["bin/dummy",
"usr/man/man1/dummy.1"]
self.addpkg2db("sync", sp)
diff --git a/pactest/tests/sync120.py b/pactest/tests/sync120.py
index b8fc6747..994e440e 100644
--- a/pactest/tests/sync120.py
+++ b/pactest/tests/sync120.py
@@ -12,7 +12,7 @@ lp2 = pmpkg("pkg2")
for p in lp1, lp2:
self.addpkg2db("local", p)
-self.option["ignorepkg"] = ["pkg2"]
+self.option["IgnorePkg"] = ["pkg2"]
self.args = "-Su"
diff --git a/pactest/tests/sync133.py b/pactest/tests/sync133.py
index b852a7fc..cea603b8 100644
--- a/pactest/tests/sync133.py
+++ b/pactest/tests/sync133.py
@@ -9,7 +9,7 @@ lp = pmpkg("pkg1")
self.addpkg2db("local", lp)
-self.option["ignorepkg"] = ["pkg1"]
+self.option["IgnorePkg"] = ["pkg1"]
self.args = "-Su"
diff --git a/pactest/tests/sync138.py b/pactest/tests/sync138.py
index 410c7f07..e67c4f46 100644
--- a/pactest/tests/sync138.py
+++ b/pactest/tests/sync138.py
@@ -13,7 +13,7 @@ lp2 = pmpkg("pkg2")
for p in lp1, lp2:
self.addpkg2db("local", p)
-self.option["ignoregroup"] = ["grp"]
+self.option["IgnoreGroup"] = ["grp"]
self.args = "-Su"
diff --git a/pactest/tests/sync301.py b/pactest/tests/sync301.py
index e8526b93..96402fc3 100644
--- a/pactest/tests/sync301.py
+++ b/pactest/tests/sync301.py
@@ -16,10 +16,12 @@ self.addpkg2db("local", lp)
lp1 = pmpkg("pkg1", "1.0-1")
self.addpkg2db("local", lp1)
+self.option["SyncFirst"] = ["pacman"]
+
self.args = "-Su"
self.addrule("PACMAN_RETCODE=0")
self.addrule("PKG_EXIST=pacman")
self.addrule("PKG_VERSION=pacman|1.0-2")
+self.addrule("PKG_VERSION=pkg1|1.0-1")
self.addrule("PKG_EXIST=dep")
-self.addrule("PKG_REQUIREDBY=dep|pacman")
diff --git a/pactest/tests/sync500.py b/pactest/tests/sync500.py
new file mode 100644
index 00000000..ccfffa7c
--- /dev/null
+++ b/pactest/tests/sync500.py
@@ -0,0 +1,15 @@
+self.description = "Install a package from a sync db with NoExtract"
+
+sp = pmpkg("dummy")
+sp.files = ["bin/dummy",
+ "usr/man/man1/dummy.1"]
+self.addpkg2db("sync", sp)
+
+self.option["NoExtract"] = ["usr/man/man1/dummy.1"]
+
+self.args = "-S %s" % sp.name
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_EXIST=dummy")
+self.addrule("FILE_EXIST=bin/dummy")
+self.addrule("!FILE_EXIST=usr/man/man1/dummy.1")
diff --git a/pactest/tests/sync501.py b/pactest/tests/sync501.py
new file mode 100644
index 00000000..eb826e21
--- /dev/null
+++ b/pactest/tests/sync501.py
@@ -0,0 +1,18 @@
+self.description = "Upgrade a package, with a file in NoUpgrade"
+
+sp = pmpkg("dummy", "1.0-2")
+sp.files = ["etc/dummy.conf"]
+self.addpkg2db("sync", sp)
+
+lp = pmpkg("dummy")
+lp.files = ["etc/dummy.conf"]
+self.addpkg2db("local", lp)
+
+self.option["NoUpgrade"] = ["etc/dummy.conf"]
+
+self.args = "-S %s" % sp.name
+
+self.addrule("PKG_VERSION=dummy|1.0-2")
+self.addrule("!FILE_MODIFIED=etc/dummy.conf")
+self.addrule("FILE_PACNEW=etc/dummy.conf")
+self.addrule("!FILE_PACSAVE=etc/dummy.conf")
diff --git a/pactest/tests/sync893.py b/pactest/tests/sync893.py
index 9420b74c..1c8494a3 100644
--- a/pactest/tests/sync893.py
+++ b/pactest/tests/sync893.py
@@ -15,6 +15,6 @@ self.addpkg2db("local", lp2)
self.args = "-S %s" % " ".join([p.name for p in sp1, sp2])
-self.addrule("PACMAN_RETCODE=0")
+self.addrule("PACMAN_RETCODE=1")
self.addrule("PKG_EXIST=pkg1")
-self.addrule("!PKG_EXIST=pkg2")
+self.addrule("PKG_EXIST=pkg2")
diff --git a/pactest/tests/sync897.py b/pactest/tests/sync897.py
index 3cf43929..f7bd3d71 100644
--- a/pactest/tests/sync897.py
+++ b/pactest/tests/sync897.py
@@ -18,7 +18,7 @@ self.addpkg2db("local", lp3)
self.args = "-Su"
-self.addrule("PACMAN_RETCODE=0")
+self.addrule("PACMAN_RETCODE=1")
self.addrule("PKG_EXIST=pkg1")
-self.addrule("!PKG_EXIST=pkg2")
-self.addrule("!PKG_EXIST=pkg3")
+self.addrule("PKG_EXIST=pkg2")
+self.addrule("PKG_EXIST=pkg3")
diff --git a/pactest/tests/add003.py b/pactest/tests/upgrade005.py
index 4f8ae600..0f8c13ef 100644
--- a/pactest/tests/add003.py
+++ b/pactest/tests/upgrade005.py
@@ -14,7 +14,7 @@ p3.files = ["bin/pkg3", "usr/man/man1/pkg3.1"]
for p in p1, p2, p3:
self.addpkg(p)
-self.args = "-A %s" % " ".join([p.filename() for p in p1, p2, p3])
+self.args = "-U %s" % " ".join([p.filename() for p in p1, p2, p3])
self.addrule("PACMAN_RETCODE=0")
for p in p1, p2, p3:
diff --git a/pactest/tests/upgrade010.py b/pactest/tests/upgrade010.py
index 633ef7e4..3d8b21e1 100644
--- a/pactest/tests/upgrade010.py
+++ b/pactest/tests/upgrade010.py
@@ -8,7 +8,7 @@ p = pmpkg("dummy", "1.0-2")
p.files = ["etc/dummy.conf"]
self.addpkg(p)
-self.option["noupgrade"] = ["etc/dummy.conf"]
+self.option["NoUpgrade"] = ["etc/dummy.conf"]
self.args = "-U %s" % p.filename()
diff --git a/pactest/tests/add011.py b/pactest/tests/upgrade012.py
index 5d2ae43f..dba8dc18 100644
--- a/pactest/tests/add011.py
+++ b/pactest/tests/upgrade012.py
@@ -6,7 +6,7 @@ self.addpkg(p)
self.filesystem = ["bin/dummy"]
-self.args = "-Af %s" % p.filename()
+self.args = "-Uf %s" % p.filename()
self.addrule("PACMAN_RETCODE=0")
self.addrule("PKG_EXIST=dummy")
diff --git a/pactest/tests/add012.py b/pactest/tests/upgrade013.py
index 291d1fba..5a327599 100644
--- a/pactest/tests/add012.py
+++ b/pactest/tests/upgrade013.py
@@ -13,7 +13,7 @@ p2.files = ["bin/foobar",
for p in p1, p2:
self.addpkg(p)
-self.args = "-A %s" % " ".join([p.filename() for p in p1, p2])
+self.args = "-U %s" % " ".join([p.filename() for p in p1, p2])
self.addrule("PACMAN_RETCODE=1")
self.addrule("!PKG_EXIST=dummy")
diff --git a/pactest/tests/add013.py b/pactest/tests/upgrade014.py
index 547ce001..1632dd36 100644
--- a/pactest/tests/add013.py
+++ b/pactest/tests/upgrade014.py
@@ -13,7 +13,7 @@ p2.files = ["bin/foobar",
for p in p1, p2:
self.addpkg(p)
-self.args = "-Af %s" % " ".join([p.filename() for p in p1, p2])
+self.args = "-Uf %s" % " ".join([p.filename() for p in p1, p2])
self.addrule("PACMAN_RETCODE=0")
for p in p1, p2:
diff --git a/pactest/tests/add020.py b/pactest/tests/upgrade015.py
index 8a2f4a71..22f7c36b 100644
--- a/pactest/tests/add020.py
+++ b/pactest/tests/upgrade015.py
@@ -6,7 +6,7 @@ self.addpkg(p)
self.filesystem = ["etc/dummy.conf"]
-self.args = "-Af %s" % p.filename()
+self.args = "-Uf %s" % p.filename()
self.addrule("PACMAN_RETCODE=0")
self.addrule("PKG_EXIST=dummy")
diff --git a/pactest/tests/add021.py b/pactest/tests/upgrade016.py
index a6dda963..dd31c9ab 100644
--- a/pactest/tests/add021.py
+++ b/pactest/tests/upgrade016.py
@@ -7,7 +7,7 @@ self.addpkg(p)
self.filesystem = ["etc/dummy.conf"]
-self.args = "-Af %s" % p.filename()
+self.args = "-Uf %s" % p.filename()
self.addrule("PACMAN_RETCODE=0")
self.addrule("PKG_EXIST=dummy")
diff --git a/pactest/tests/upgrade032.py b/pactest/tests/upgrade032.py
new file mode 100644
index 00000000..85e048e0
--- /dev/null
+++ b/pactest/tests/upgrade032.py
@@ -0,0 +1,19 @@
+self.description = "Install packages explicitly"
+
+lp1 = pmpkg("pkg1")
+lp1.reason = 1
+self.addpkg2db("local", lp1)
+
+p1 = pmpkg("pkg1", "1.0-2")
+p2 = pmpkg("pkg2", "1.0-2")
+
+for p in p1, p2:
+ self.addpkg(p)
+
+self.args = "-U --asexplicit %s" % " ".join([p.filename() for p in p1, p2])
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_VERSION=pkg1|1.0-2")
+self.addrule("PKG_VERSION=pkg2|1.0-2")
+self.addrule("PKG_REASON=pkg1|0")
+self.addrule("PKG_REASON=pkg2|0")
diff --git a/pactest/tests/add060.py b/pactest/tests/upgrade070.py
index 4c5f17da..01f0ba48 100644
--- a/pactest/tests/add060.py
+++ b/pactest/tests/upgrade070.py
@@ -5,9 +5,9 @@ p.files = ["bin/dummy",
"usr/man/man1/dummy.1"]
self.addpkg(p)
-self.option["noextract"] = ["usr/man/man1/dummy.1"]
+self.option["NoExtract"] = ["usr/man/man1/dummy.1"]
-self.args = "-A %s" % p.filename()
+self.args = "-U %s" % p.filename()
self.addrule("PACMAN_RETCODE=0")
self.addrule("PKG_EXIST=dummy")
diff --git a/pactest/tests/add040.py b/pactest/tests/upgrade071.py
index 6d6da602..1f21c558 100644
--- a/pactest/tests/add040.py
+++ b/pactest/tests/upgrade071.py
@@ -6,7 +6,7 @@ p.files = ["bin/dummy",
p.depends = ["dep1"]
self.addpkg(p)
-self.args = "-A %s" % p.filename()
+self.args = "-U %s" % p.filename()
self.addrule("PACMAN_RETCODE=1")
self.addrule("!PKG_EXIST=dummy")
diff --git a/pactest/tests/add041.py b/pactest/tests/upgrade072.py
index af3ffe46..f88e150c 100644
--- a/pactest/tests/add041.py
+++ b/pactest/tests/upgrade072.py
@@ -6,7 +6,7 @@ p.files = ["bin/dummy",
p.depends = ["dep1"]
self.addpkg(p)
-self.args = "-Ad %s" % p.filename()
+self.args = "-Ud %s" % p.filename()
self.addrule("PACMAN_RETCODE=0")
self.addrule("PKG_EXIST=dummy")
diff --git a/pactest/tests/add042.py b/pactest/tests/upgrade073.py
index 48104b0c..3486c417 100644
--- a/pactest/tests/add042.py
+++ b/pactest/tests/upgrade073.py
@@ -15,7 +15,7 @@ p3.files = ["bin/dep2"]
for p in p1, p2, p3:
self.addpkg(p)
-self.args = "-A %s" % " ".join([p.filename() for p in p1, p2, p3])
+self.args = "-U %s" % " ".join([p.filename() for p in p1, p2, p3])
self.addrule("PACMAN_RETCODE=0")
self.addrule("PKG_VERSION=dummy|1.0-2")
diff --git a/pactest/tests/add046.py b/pactest/tests/upgrade074.py
index 5f967cbe..ca052855 100644
--- a/pactest/tests/add046.py
+++ b/pactest/tests/upgrade074.py
@@ -7,7 +7,7 @@ self.addpkg(p)
lp = pmpkg("pkg2", "1.9b-3")
self.addpkg2db("local", lp)
-self.args = "-A %s" % p.filename()
+self.args = "-U %s" % p.filename()
self.addrule("PACMAN_RETCODE=0")
self.addrule("PKG_EXIST=pkg1")
diff --git a/pactest/tests/add047.py b/pactest/tests/upgrade075.py
index 153364a5..8d2f3fc4 100644
--- a/pactest/tests/add047.py
+++ b/pactest/tests/upgrade075.py
@@ -7,7 +7,7 @@ self.addpkg(p)
lp = pmpkg("pkg2", "2.0-3")
self.addpkg2db("local", lp)
-self.args = "-A %s" % p.filename()
+self.args = "-U %s" % p.filename()
self.addrule("PACMAN_RETCODE=1")
self.addrule("!PKG_EXIST=pkg1")
diff --git a/pactest/tests/xfercommand001.py b/pactest/tests/xfercommand001.py
index a9c41d8c..a645cf7f 100644
--- a/pactest/tests/xfercommand001.py
+++ b/pactest/tests/xfercommand001.py
@@ -3,7 +3,7 @@ self.description = "Quick check for using XferCommand"
# this setting forces us to download packages
self.cachepkgs = False
#wget doesn't support file:// urls. curl does
-self.option['xfercommand'] = ['/usr/bin/curl %u > %o']
+self.option['XferCommand'] = ['/usr/bin/curl %u > %o']
numpkgs = 10
pkgnames = []
diff --git a/pactest/util.py b/pactest/util.py
index 2a6ff4e7..c6d5a594 100755
--- a/pactest/util.py
+++ b/pactest/util.py
@@ -58,35 +58,35 @@ def vprint(msg):
def getfilename(name):
"""
"""
- filename = ""
- link = ""
- if name.find(" -> ") != -1:
- filename, link = name.split(" -> ")
- elif name[-1] == "*":
- filename = name.rstrip("*")
- else:
- filename = name
+ filename = name
+ extra = ""
+ if filename[-1] == "*":
+ filename = filename.rstrip("*")
+ if filename.find(" -> ") != -1:
+ filename, extra = filename.split(" -> ")
+ elif filename.find("|") != -1:
+ filename, extra = filename.split("|")
return filename
def mkfile(name, data = ""):
"""
"""
-
- isaltered = 0
isdir = 0
islink = 0
+ setperms = 0
+ filename = name
link = ""
- filename = ""
+ perms = ""
- if name.find(" -> ") != -1:
+ if filename[-1] == "*":
+ filename = filename.rstrip("*")
+ if filename.find(" -> ") != -1:
islink = 1
- filename, link = name.split(" -> ")
- elif name[-1] == "*":
- isaltered = 1
- filename = name.rstrip("*")
- else:
- filename = name
- if name[-1] == "/":
+ filename, link = filename.split(" -> ")
+ elif filename.find("|") != -1:
+ setperms = 1
+ filename, perms = filename.split("|")
+ if filename[-1] == "/":
isdir = 1
if isdir:
@@ -114,6 +114,8 @@ def mkfile(name, data = ""):
if data[-1] != "\n":
fd.write("\n")
fd.close()
+ if setperms:
+ os.chmod(filename, int(perms, 8))
def mkdescfile(filename, pkg):
"""
@@ -181,7 +183,7 @@ def mkcfgfile(filename, root, option, db):
# Repositories
data.extend(["[%s]\n" \
- "server = file://%s\n" \
+ "Server = file://%s\n" \
% (value.treename, \
os.path.join(root, SYNCREPO, value.treename)) \
for key, value in db.iteritems() if key != "local"])