index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
diff --git a/pactest/Makefile.am b/pactest/Makefile.am index 879f23d0..ce611f78 100644 --- a/pactest/Makefile.am +++ b/pactest/Makefile.am @@ -8,7 +8,7 @@ check_SCRIPTS = \ pmtest.py \ util.py \ $(wildcard tests/*.py) \ - tests/TESTS + vercmptest.sh 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/remove040.py b/pactest/tests/remove040.py index 07d3e67d..9d95b60e 100644 --- a/pactest/tests/remove040.py +++ b/pactest/tests/remove040.py @@ -6,13 +6,10 @@ self.addpkg2db("local", lp1) lp2 = pmpkg("pkg2") lp2.provides = ["imaginary"] -lp2.requiredby = [ "pkg1" ] self.addpkg2db("local", lp2) - self.args = "-R %s" % lp1.name self.addrule("PACMAN_RETCODE=0") self.addrule("!PKG_EXIST=pkg1") self.addrule("PKG_EXIST=pkg2") -self.addrule("!PKG_REQUIREDBY=pkg2|pkg1") diff --git a/pactest/tests/remove041.py b/pactest/tests/remove041.py index 9ab7bf74..be27fd4c 100644 --- a/pactest/tests/remove041.py +++ b/pactest/tests/remove041.py @@ -2,12 +2,10 @@ self.description = "Remove a no longer needed package (multiple provision)" lp1 = pmpkg("pkg1") lp1.provides = ["imaginary"] -lp1.requiredby = ["pkg3"] self.addpkg2db("local", lp1) lp2 = pmpkg("pkg2") lp2.provides = ["imaginary"] -lp2.requiredby = ["pkg3"] self.addpkg2db("local", lp2) lp3 = pmpkg("pkg3") diff --git a/pactest/tests/remove042.py b/pactest/tests/remove042.py index 5de1fb41..796d0406 100644 --- a/pactest/tests/remove042.py +++ b/pactest/tests/remove042.py @@ -6,10 +6,8 @@ self.addpkg2db("local", lp1) lp2 = pmpkg("pkg2") lp2.provides = ["imaginary"] -lp2.requiredby = [ "pkg1" ] self.addpkg2db("local", lp2) - self.args = "-Rc %s" % lp2.name self.addrule("PACMAN_RETCODE=0") diff --git a/pactest/tests/remove043.py b/pactest/tests/remove043.py index a377c58b..0d448d0d 100644 --- a/pactest/tests/remove043.py +++ b/pactest/tests/remove043.py @@ -6,13 +6,10 @@ self.addpkg2db("local", lp1) lp2 = pmpkg("pkg2") lp2.provides = ["imaginary"] -lp2.requiredby = [ "pkg1" ] self.addpkg2db("local", lp2) - self.args = "-R %s" % lp2.name self.addrule("!PACMAN_RETCODE=0") self.addrule("PKG_EXIST=pkg1") self.addrule("PKG_EXIST=pkg2") -self.addrule("PKG_REQUIREDBY=pkg2|pkg1") diff --git a/pactest/tests/remove045.py b/pactest/tests/remove045.py index d8b7845b..f42e58f2 100644 --- a/pactest/tests/remove045.py +++ b/pactest/tests/remove045.py @@ -7,18 +7,15 @@ self.addpkg2db("local", lp1) lp2 = pmpkg("pkg2") lp2.reason = 1 lp2.depends = ["pkg4"] -lp2.requiredby = ["pkg1"] self.addpkg2db("local", lp2) lp3 = pmpkg("pkg3") lp3.reason = 1 -lp3.requiredby = ["pkg1", "pkg4"] self.addpkg2db("local", lp3) lp4 = pmpkg("pkg4") lp4.reason = 1 lp4.depends = ["pkg3"] -lp4.requiredby = ["pkg2"] self.addpkg2db("local", lp4) self.args = "-Rs %s" % lp1.name diff --git a/pactest/tests/remove046.py b/pactest/tests/remove046.py deleted file mode 100644 index 1ee8be17..00000000 --- a/pactest/tests/remove046.py +++ /dev/null @@ -1,10 +0,0 @@ -self.description = "Cascade remove a package with a broken required by" - -lp1 = pmpkg("pkg1") -lp1.requiredby = [ "fake" ] -self.addpkg2db("local", lp1) - -self.args = "-Rc %s" % lp1.name - -self.addrule("PACMAN_RETCODE=0") -self.addrule("!PKG_EXIST=pkg1") diff --git a/pactest/tests/remove047.py b/pactest/tests/remove047.py index 9606c2e3..8bb1a63a 100644 --- a/pactest/tests/remove047.py +++ b/pactest/tests/remove047.py @@ -1,7 +1,6 @@ self.description = "Remove a package required by other packages" lp1 = pmpkg("pkg1") -lp1.requiredby = ["pkg2", "pkg3", "pkg4"] self.addpkg2db("local", lp1) lp2 = pmpkg("pkg2") diff --git a/pactest/tests/remove048.py b/pactest/tests/remove048.py deleted file mode 100644 index 2d9b4803..00000000 --- a/pactest/tests/remove048.py +++ /dev/null @@ -1,10 +0,0 @@ -self.description = "Remove a package with a broken required by" - -lp1 = pmpkg("pkg1") -lp1.requiredby = [ "dep" ] -self.addpkg2db("local", lp1) - -self.args = "-R %s" % lp1.name - -self.addrule("PACMAN_RETCODE=0") -self.addrule("!PKG_EXIST=pkg1") diff --git a/pactest/tests/remove049.py b/pactest/tests/remove049.py new file mode 100644 index 00000000..a0336295 --- /dev/null +++ b/pactest/tests/remove049.py @@ -0,0 +1,18 @@ +self.description = "-Ru test" + +lp1 = pmpkg("pkg1") +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/requiredby002.py b/pactest/tests/requiredby002.py deleted file mode 100644 index 299ec88b..00000000 --- a/pactest/tests/requiredby002.py +++ /dev/null @@ -1,16 +0,0 @@ -self.description = "A package was removed with -Rd, then downgraded" - -lp1 = pmpkg("pkg1") -lp1.depends = ["pkg2=1.1"] -self.addpkg2db("local", lp1) - -p = pmpkg("pkg2", "1.0-1") -self.addpkg(p) - -self.args = "-U %s" % p.filename() - -self.addrule("PACMAN_RETCODE=0") -self.addrule("PKG_EXIST=pkg1") -self.addrule("PKG_VERSION=pkg2|1.0-1") -self.addrule("PKG_EXIST=pkg2") -self.addrule("!PKG_REQUIREDBY=pkg2|pkg1") diff --git a/pactest/tests/requiredby003.py b/pactest/tests/requiredby003.py deleted file mode 100644 index 3279c2ab..00000000 --- a/pactest/tests/requiredby003.py +++ /dev/null @@ -1,16 +0,0 @@ -self.description = "A package was removed with -Rd, then upgraded" - -lp1 = pmpkg("pkg1") -lp1.depends = ["pkg2>=1.1"] -self.addpkg2db("local", lp1) - -p = pmpkg("pkg2", "1.2-1") -self.addpkg(p) - -self.args = "-U %s" % p.filename() - -self.addrule("PACMAN_RETCODE=0") -self.addrule("PKG_EXIST=pkg1") -self.addrule("PKG_VERSION=pkg2|1.2-1") -self.addrule("PKG_EXIST=pkg2") -self.addrule("PKG_REQUIREDBY=pkg2|pkg1") diff --git a/pactest/tests/requiredby004.py b/pactest/tests/requiredby004.py deleted file mode 100644 index c4fe7687..00000000 --- a/pactest/tests/requiredby004.py +++ /dev/null @@ -1,20 +0,0 @@ -self.description = "Upgrade a package that no longer needs a depend" - -lp1 = pmpkg("pkg1") -lp1.depends = ["pkg2"] -self.addpkg2db("local", lp1) - -lp2 = pmpkg("pkg2") -lp2.requiredby = ["pkg1"] -self.addpkg2db("local", lp2) - -p = pmpkg("pkg1", "1.1-1") -self.addpkg(p) - -self.args = "-U %s" % p.filename() - -self.addrule("PACMAN_RETCODE=0") -self.addrule("PKG_EXIST=pkg1") -self.addrule("PKG_VERSION=pkg1|1.1-1") -self.addrule("PKG_EXIST=pkg2") -self.addrule("!PKG_REQUIREDBY=pkg2|pkg1") diff --git a/pactest/tests/requiredby005.py b/pactest/tests/requiredby005.py deleted file mode 100644 index 5b2ce164..00000000 --- a/pactest/tests/requiredby005.py +++ /dev/null @@ -1,21 +0,0 @@ -self.description = "Remove lp1, requiredby should move from lp1 to lp2" - -lp1 = pmpkg("foo") -lp1.requiredby = ["pkg3"] -self.addpkg2db("local", lp1) - -lp2 = pmpkg("pkg2") -lp2.provides = ["foo"] -self.addpkg2db("local", lp2) - -lp3 = pmpkg("pkg3") -lp3.depends = ["foo"] -self.addpkg2db("local", lp3) - - -self.args = "-R %s" % lp1.name - -self.addrule("PACMAN_RETCODE=0") -self.addrule("!PKG_EXIST=foo") -self.addrule("PKG_EXIST=pkg2") -self.addrule("PKG_REQUIREDBY=pkg2|pkg3") diff --git a/pactest/tests/requiredby006.py b/pactest/tests/requiredby006.py deleted file mode 100644 index ea14cde5..00000000 --- a/pactest/tests/requiredby006.py +++ /dev/null @@ -1,21 +0,0 @@ -self.description = "Broken requiredby/depends list" - -lp1 = pmpkg("pkg1") -lp1.depends = ["pkg2"] -self.addpkg2db("local", lp1) - -lp2 = pmpkg("pkg2") -lp2.requiredby = ["foo", "pkg1"] -self.addpkg2db("local", lp2) - -p = pmpkg("pkg1", "1.1-1") -p.depends = ["pkg2"] -self.addpkg(p) - -self.args = "-U %s" % p.filename() - -self.addrule("PACMAN_RETCODE=0") -self.addrule("PKG_EXIST=pkg1") -self.addrule("PKG_VERSION=pkg1|1.1-1") -self.addrule("PKG_EXIST=pkg2") -self.addrule("PKG_REQUIREDBY=pkg2|pkg1") 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/sync010.py b/pactest/tests/sync010.py index 7ddc1492..df407a32 100644 --- a/pactest/tests/sync010.py +++ b/pactest/tests/sync010.py @@ -25,5 +25,3 @@ for p in sp1, sp2, sp3: for f in p.files: self.addrule("FILE_EXIST=%s" % f) self.addrule("PKG_DEPENDS=dep1|dep2") -self.addrule("PKG_REQUIREDBY=dep1|dummy") -self.addrule("PKG_REQUIREDBY=dep2|dep1") 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/sync060.py b/pactest/tests/sync060.py deleted file mode 100644 index 45f0c3e0..00000000 --- a/pactest/tests/sync060.py +++ /dev/null @@ -1,15 +0,0 @@ -self.description = "Replace a package with a broken required by" - -lp1 = pmpkg("pkg1") -lp1.replaces = [ "pkg2" ] -self.addpkg2db("sync", lp1) - -lp2 = pmpkg("pkg2") -lp2.requiredby = [ "fake" ] -self.addpkg2db("local", lp2) - -self.args = "-Su" - -self.addrule("PACMAN_RETCODE=0") -self.addrule("PKG_EXIST=pkg1") -self.addrule("!PKG_EXIST=pkg2") diff --git a/pactest/tests/sync1000.py b/pactest/tests/sync1000.py index be1254bf..e7f43263 100644 --- a/pactest/tests/sync1000.py +++ b/pactest/tests/sync1000.py @@ -2,11 +2,9 @@ self.description = "stonecrest's problem" sp = pmpkg("dummy", "1.1-1") -sp.requiredby = [ "pkg" ] self.addpkg2db("sync", sp) lp1 = pmpkg("dummy", "1.0-1") -lp1.requiredby = [ "pkg" ] self.addpkg2db("local", lp1) lp2 = pmpkg("pkg") 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/sync1003.py b/pactest/tests/sync1003.py index 3fd9799d..cd980637 100644 --- a/pactest/tests/sync1003.py +++ b/pactest/tests/sync1003.py @@ -4,23 +4,18 @@ 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") +lp2 = pmpkg("pkg2", "1.0-1") self.addpkg2db("local", lp2) lp3 = pmpkg("pkg3", "1.0-1") +lp3.depends = [ "pkg2=1.0" ] self.addpkg2db("local", lp3) self.args = "-Su" self.addrule("PACMAN_RETCODE=1") +self.addrule("!PKG_EXIST=pkg1") self.addrule("PKG_EXIST=pkg2") +self.addrule("PKG_EXIST=pkg3") +self.addrule("PKG_VERSION=pkg2|1.0-1") +self.addrule("PKG_VERSION=pkg3|1.0-1") 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/sync300.py b/pactest/tests/sync300.py index 85fb850d..31b520a8 100644 --- a/pactest/tests/sync300.py +++ b/pactest/tests/sync300.py @@ -12,4 +12,3 @@ self.args = "-S %s" % sp1.name self.addrule("PACMAN_RETCODE=1") self.addrule("!PKG_EXIST=pkg1") self.addrule("!PKG_EXIST=pkg2") -self.addrule("!PKG_REQUIREDBY=pkg2|pkg1") 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/sync400.py b/pactest/tests/sync400.py index 2ee1095d..dd6aaf4e 100644 --- a/pactest/tests/sync400.py +++ b/pactest/tests/sync400.py @@ -13,7 +13,6 @@ lp1.depends = ["pkg2=1.0-1"] self.addpkg2db("local", lp1) lp2 = pmpkg("pkg2", "1.0-1") -lp2.requiredby = [ "pkg1" ] self.addpkg2db("local", lp2) self.args = "-S pkg1" 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/sync895.py b/pactest/tests/sync895.py index 03ddc745..1b348c19 100644 --- a/pactest/tests/sync895.py +++ b/pactest/tests/sync895.py @@ -6,7 +6,6 @@ self.addpkg2db("sync", sp) lp1 = pmpkg("pkg1") lp1.provides = ["foo"] -lp1.requiredby = ["pkg2"] self.addpkg2db("local", lp1) lp2 = pmpkg("pkg2") @@ -19,4 +18,3 @@ self.addrule("PACMAN_RETCODE=1") self.addrule("PKG_EXIST=pkg1") self.addrule("PKG_EXIST=pkg2") self.addrule("!PKG_EXIST=pkg3") -self.addrule("PKG_REQUIREDBY=pkg1|pkg2") diff --git a/pactest/tests/sync896.py b/pactest/tests/sync896.py index 830b7192..a89b5c70 100644 --- a/pactest/tests/sync896.py +++ b/pactest/tests/sync896.py @@ -7,7 +7,6 @@ self.addpkg2db("sync", sp) lp1 = pmpkg("pkg1") lp1.provides = ["foo"] -lp1.requiredby = ["pkg2"] self.addpkg2db("local", lp1) lp2 = pmpkg("pkg2") @@ -20,4 +19,3 @@ self.addrule("PACMAN_RETCODE=0") self.addrule("!PKG_EXIST=pkg1") self.addrule("PKG_EXIST=pkg2") self.addrule("PKG_EXIST=pkg3") -self.addrule("PKG_REQUIREDBY=pkg3|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/sync900.py b/pactest/tests/sync900.py index f21af06a..16dfee12 100644 --- a/pactest/tests/sync900.py +++ b/pactest/tests/sync900.py @@ -6,7 +6,6 @@ sp.conflicts = ["foo"] self.addpkg2db("sync", sp) lp = pmpkg("foo") -lp.requiredby = ["lp1", "lp2"] self.addpkg2db("local", lp) lp1 = pmpkg("pkg1") @@ -23,6 +22,4 @@ self.addrule("PACMAN_RETCODE=0") self.addrule("!PKG_EXIST=foo") self.addrule("PKG_EXIST=bar") self.addrule("PKG_EXIST=pkg1") -self.addrule("PKG_REQUIREDBY=bar|pkg1") self.addrule("PKG_EXIST=pkg2") -self.addrule("PKG_REQUIREDBY=bar|pkg2") diff --git a/pactest/tests/sync901.py b/pactest/tests/sync901.py index 423fe42c..bb420b79 100644 --- a/pactest/tests/sync901.py +++ b/pactest/tests/sync901.py @@ -6,7 +6,6 @@ self.addpkg2db("sync", sp) lp = pmpkg("bar") lp.provides = ["foo"] lp.conflicts = ["foo"] -lp.requiredby = ["lp1", "lp2"] self.addpkg2db("local", lp) lp1 = pmpkg("pkg1") @@ -23,6 +22,4 @@ self.addrule("PACMAN_RETCODE=0") self.addrule("PKG_EXIST=foo") self.addrule("!PKG_EXIST=bar") self.addrule("PKG_EXIST=pkg1") -self.addrule("PKG_REQUIREDBY=foo|pkg1") self.addrule("PKG_EXIST=pkg2") -self.addrule("PKG_REQUIREDBY=foo|pkg2") 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/upgrade052.py b/pactest/tests/upgrade052.py index 7db85df9..7000a12f 100644 --- a/pactest/tests/upgrade052.py +++ b/pactest/tests/upgrade052.py @@ -6,7 +6,6 @@ self.addpkg2db("local", lp1) lp2 = pmpkg("pkg2") lp2.provides = ["imaginary", "real"] -lp2.requiredby = [ "pkg1" ] self.addpkg2db("local", lp2) p = pmpkg("pkg2", "1.0-2") diff --git a/pactest/tests/upgrade053.py b/pactest/tests/upgrade053.py index 4cbaa1f8..78de0b5e 100644 --- a/pactest/tests/upgrade053.py +++ b/pactest/tests/upgrade053.py @@ -17,4 +17,3 @@ self.args = "-U %s" % p.filename() self.addrule("PACMAN_RETCODE=0") self.addrule("PKG_VERSION=pkg1|1.0-2") self.addrule("PKG_EXIST=pkg2") -self.addrule("PKG_REQUIREDBY=pkg2|pkg1") diff --git a/pactest/tests/upgrade054.py b/pactest/tests/upgrade054.py index b60f15f4..817d1b3d 100644 --- a/pactest/tests/upgrade054.py +++ b/pactest/tests/upgrade054.py @@ -17,4 +17,3 @@ self.args = "-U %s" % p.filename() self.addrule("PACMAN_RETCODE=0") self.addrule("PKG_VERSION=pkg1|1.0-2") self.addrule("PKG_EXIST=pkg2") -self.addrule("PKG_REQUIREDBY=pkg2|pkg1") diff --git a/pactest/tests/upgrade055.py b/pactest/tests/upgrade055.py index 7cdf6b5d..25083962 100644 --- a/pactest/tests/upgrade055.py +++ b/pactest/tests/upgrade055.py @@ -6,12 +6,10 @@ self.addpkg2db("local", lp1) lp2 = pmpkg("pkg2") lp2.provides = ["imaginary"] -lp2.requiredby = [ "pkg1" ] self.addpkg2db("local", lp2) lp3 = pmpkg("pkg3") lp3.provides = ["imaginary2"] -lp3.requiredby = [ "pkg1" ] self.addpkg2db("local", lp3) p = pmpkg("pkg2", "1.0-2") @@ -24,5 +22,4 @@ self.addrule("PACMAN_RETCODE=0") self.addrule("PKG_EXIST=pkg1") self.addrule("PKG_VERSION=pkg2|1.0-2") self.addrule("PKG_EXIST=pkg3") -self.addrule("PKG_REQUIREDBY=pkg2|pkg1") self.addrule("PKG_DEPENDS=pkg1|imaginary") diff --git a/pactest/tests/upgrade056.py b/pactest/tests/upgrade056.py index b92c38ac..908fa30c 100644 --- a/pactest/tests/upgrade056.py +++ b/pactest/tests/upgrade056.py @@ -6,12 +6,10 @@ self.addpkg2db("local", lp1) lp2 = pmpkg("pkg2") lp2.provides = ["imaginary"] -lp2.requiredby = [ "pkg1" ] self.addpkg2db("local", lp2) lp3 = pmpkg("pkg3") lp3.provides = ["imaginary"] -lp3.requiredby = [ "pkg1" ] self.addpkg2db("local", lp3) p = pmpkg("pkg2", "1.0-2") @@ -23,5 +21,3 @@ self.addrule("PACMAN_RETCODE=0") self.addrule("PKG_EXIST=pkg1") self.addrule("PKG_VERSION=pkg2|1.0-2") self.addrule("PKG_EXIST=pkg3") -self.addrule("!PKG_REQUIREDBY=pkg2|pkg1") -self.addrule("PKG_REQUIREDBY=pkg3|pkg1") diff --git a/pactest/tests/upgrade057.py b/pactest/tests/upgrade057.py index fd3e7138..b1eb5029 100644 --- a/pactest/tests/upgrade057.py +++ b/pactest/tests/upgrade057.py @@ -6,7 +6,6 @@ self.addpkg2db("local", lp1) lp2 = pmpkg("pkg2") lp2.provides = ["imag3"] -lp2.requiredby = ["pkg1"] self.addpkg2db("local", lp2) p = pmpkg("pkg2", "1.0-2") @@ -18,6 +17,5 @@ self.args = "-U %s" % p.filename() self.addrule("PACMAN_RETCODE=0") self.addrule("PKG_EXIST=pkg1") self.addrule("PKG_VERSION=pkg2|1.0-2") -self.addrule("PKG_REQUIREDBY=pkg2|pkg1") self.addrule("PKG_DEPENDS=pkg1|pkg2") self.addrule("PKG_DEPENDS=pkg1|imag3") diff --git a/pactest/tests/upgrade058.py b/pactest/tests/upgrade058.py index 76416802..38576fff 100644 --- a/pactest/tests/upgrade058.py +++ b/pactest/tests/upgrade058.py @@ -5,7 +5,6 @@ lp1.depends = [ "pkg2=1.0" ] self.addpkg2db("local", lp1) lp2 = pmpkg("pkg2", "1.0-1") -lp2.requiredby = [ "pkg1" ] self.addpkg2db("local", lp2) p = pmpkg("pkg2", "1.1-1") @@ -14,4 +13,4 @@ self.addpkg(p) self.args = "-U %s" % p.filename() self.addrule("PACMAN_RETCODE=1") -self.addrule("!PKG_VERSION=pkg2|1.1") +self.addrule("!PKG_VERSION=pkg2|1.1-1") diff --git a/pactest/tests/upgrade059.py b/pactest/tests/upgrade059.py index 933e4e74..9cd9f1f0 100644 --- a/pactest/tests/upgrade059.py +++ b/pactest/tests/upgrade059.py @@ -6,12 +6,10 @@ self.addpkg2db("local", lp1) lp2 = pmpkg("pkg2", "1.0-1") lp2.provides = ["imaginary"] -lp2.requiredby = [ "pkg1" ] self.addpkg2db("local", lp2) lp3 = pmpkg("pkg3", "1.0-1") lp3.provides = ["imaginary"] -lp3.requiredby = [ "pkg1" ] self.addpkg2db("local", lp3) p2 = pmpkg("pkg2", "1.0-2") diff --git a/pactest/tests/upgrade060.py b/pactest/tests/upgrade060.py index dd78bba3..7a28f3eb 100644 --- a/pactest/tests/upgrade060.py +++ b/pactest/tests/upgrade060.py @@ -5,7 +5,6 @@ lp1.depends = ["pkg2=1.0"] self.addpkg2db("local", lp1) lp2 = pmpkg("pkg2", "1.0-1") -lp2.requiredby = [ "pkg1" ] self.addpkg2db("local", lp2) p1 = pmpkg("pkg1", "1.1-1") diff --git a/pactest/tests/upgrade061.py b/pactest/tests/upgrade061.py index 0b1ed4e5..310e5043 100644 --- a/pactest/tests/upgrade061.py +++ b/pactest/tests/upgrade061.py @@ -5,7 +5,6 @@ lp1.depends = ["imaginary"] self.addpkg2db("local", lp1) lp2 = pmpkg("pkg2", "1.0-1") -lp2.requiredby = [ "pkg1" ] lp2.provides = ["imaginary"] self.addpkg2db("local", lp2) 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..752a2336 100644 --- a/pactest/tests/add042.py +++ b/pactest/tests/upgrade073.py @@ -15,14 +15,12 @@ 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") self.addrule("PKG_DEPENDS=dummy|dep1") self.addrule("PKG_DEPENDS=dep1|dep2") -self.addrule("PKG_REQUIREDBY=dep1|dummy") -self.addrule("PKG_REQUIREDBY=dep2|dep1") for p in p1, p2, p3: self.addrule("PKG_EXIST=%s" % p.name) for f in p.files: 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/requiredby001.py b/pactest/tests/upgrade076.py index 0f05d82c..87ccbddf 100644 --- a/pactest/tests/requiredby001.py +++ b/pactest/tests/upgrade076.py @@ -1,11 +1,10 @@ -self.description = "A package is downgraded no longer satisfying a depend" +self.description = "Package downgrade (failure)" lp1 = pmpkg("pkg1") lp1.depends = ["pkg2=1.1"] self.addpkg2db("local", lp1) lp2 = pmpkg("pkg2", "1.1-1") -lp2.requiredby = ["pkg1"] self.addpkg2db("local", lp2) p = pmpkg("pkg2", "1.0-1") @@ -15,6 +14,5 @@ self.args = "-U %s" % p.filename() self.addrule("PACMAN_RETCODE=1") self.addrule("PKG_EXIST=pkg1") -self.addrule("PKG_VERSION=pkg2|1.1-1") self.addrule("PKG_EXIST=pkg2") -self.addrule("PKG_REQUIREDBY=pkg2|pkg1") +self.addrule("PKG_VERSION=pkg2|1.1-1") 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"]) diff --git a/pactest/vercmptest.sh b/pactest/vercmptest.sh new file mode 100755 index 00000000..f8d457ee --- /dev/null +++ b/pactest/vercmptest.sh @@ -0,0 +1,100 @@ +#!/bin/sh +# +# vercmptest - a test suite for the vercmp/libalpm program +# +# Copyright (c) 2008 by Dan McGee <dan@archlinux.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +# default binary if one was not specified as $1 +bin='vercmp' +# holds counts of tests +total=0 +failure=0 + +# args: +# pass ver1 ver2 ret expected +pass() { + echo "test: ver1: $1 ver2: $2 ret: $3 expected: $4" + echo " --> pass" +} + +# args: +# fail ver1 ver2 ret expected +fail() { + echo "test: ver1: $1 ver2: $2 ret: $3 expected: $4" + echo " ==> FAILURE" + failure=$(expr $failure + 1) +} + +# args: +# runtest ver1 ver2 expected +runtest() { + # run the test + ret=$($bin $1 $2) + func='pass' + [ $ret -eq $3 ] || func='fail' + $func $1 $2 $ret $3 + total=$(expr $total + 1) + # and run its mirror case just to be sure + reverse=0 + [ $3 -eq 1 ] && reverse=-1 + [ $3 -eq -1 ] && reverse=1 + ret=$($bin $2 $1) + func='pass' + [ $ret -eq $reverse ] || func='fail' + $func $1 $2 $ret $reverse + total=$(expr $total + 1) +} + +# use first arg as our binary if specified +[ -n "$1" ] && bin="$1" + +# BEGIN TESTS + +# all similar length, no pkgrel +runtest 1.5.0 1.5.0 0 +runtest 1.5.1 1.5.0 1 + +# mixed length +runtest 1.5.1 1.5 1 + +# with pkgrel, simple +runtest 1.5.0-1 1.5.0-1 0 +runtest 1.5.0-1 1.5.0-2 -1 +runtest 1.5.0-1 1.5.1-1 -1 +runtest 1.5.0-2 1.5.1-1 -1 + +# with pkgrel, mixed lengths +runtest 1.5-1 1.5.1-1 -1 +runtest 1.5-2 1.5.1-1 -1 +runtest 1.5-2 1.5.1-2 -1 + +# mixed pkgrel inclusion +runtest 1.5 1.5-1 0 +runtest 1.5-1 1.5 0 +runtest 1.1-1 1.1 0 +runtest 1.0-1 1.1 -1 +runtest 1.1-1 1.0 1 + +#END TESTS + +echo +if [ $failure -eq 0 ]; then + echo "All $total tests successful" + exit 0 +fi + +echo "$failure of $total tests failed" +exit 1 |