index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
diff --git a/pactest/.gitignore b/pactest/.gitignore index 59a0622c..0d20b648 100644 --- a/pactest/.gitignore +++ b/pactest/.gitignore @@ -1,4 +1 @@ -Makefile -Makefile.in *.pyc -root diff --git a/pactest/Makefile.am b/pactest/Makefile.am index 37c394fd..879f23d0 100644 --- a/pactest/Makefile.am +++ b/pactest/Makefile.am @@ -17,3 +17,5 @@ EXTRA_DIST = \ TODO \ ChangeLog \ $(check_SCRIPTS) + +# vim:set ts=2 sw=2 noet: diff --git a/pactest/TODO b/pactest/TODO index 437bf02c..c7d4555a 100644 --- a/pactest/TODO +++ b/pactest/TODO @@ -2,7 +2,7 @@ TODO ==== Features: -- implement gensync support +- implement script support (makekpg, repo-add, etc) Tests: - add test cases for pacman -D and pacman -T diff --git a/pactest/pmdb.py b/pactest/pmdb.py index fb0e10bb..ed552dbf 100755 --- a/pactest/pmdb.py +++ b/pactest/pmdb.py @@ -187,8 +187,8 @@ class pmdb: line = line.strip("\n") if line == "%DEPENDS%": pkg.depends = _getsection(fd) - elif line == "%REQUIREDBY%": - pkg.requiredby = _getsection(fd) + elif line == "%OPTDEPENDS%": + pkg.optdepends = _getsection(fd) elif line == "%CONFLICTS%": pkg.conflicts = _getsection(fd) elif line == "%PROVIDES%": @@ -218,7 +218,10 @@ class pmdb: """ """ - path = os.path.join(self.dbdir, self.treename, pkg.fullname()) + if self.treename == "local": + path = os.path.join(self.dbdir, self.treename, pkg.fullname()) + else: + path = os.path.join(self.dbdir, "sync", self.treename, pkg.fullname()) mkdir(path) # desc @@ -233,19 +236,19 @@ class pmdb: data.append(_mksection("DESC", pkg.desc)) if pkg.groups: data.append(_mksection("GROUPS", pkg.groups)) + if pkg.license: + data.append(_mksection("LICENSE", pkg.license)) + if pkg.arch: + data.append(_mksection("ARCH", pkg.arch)) + if pkg.builddate: + data.append(_mksection("BUILDDATE", pkg.builddate)) + if pkg.packager: + data.append(_mksection("PACKAGER", pkg.packager)) if self.treename == "local": if pkg.url: data.append(_mksection("URL", pkg.url)) - if pkg.license: - data.append(_mksection("LICENSE", pkg.license)) - if pkg.arch: - data.append(_mksection("ARCH", pkg.arch)) - if pkg.builddate: - data.append(_mksection("BUILDDATE", pkg.builddate)) if pkg.installdate: data.append(_mksection("INSTALLDATE", pkg.installdate)) - if pkg.packager: - data.append(_mksection("PACKAGER", pkg.packager)) if pkg.size: data.append(_mksection("SIZE", pkg.size)) if pkg.reason: @@ -283,14 +286,13 @@ class pmdb: pkg.mtime["files"] = getmtime(filename) # depends - # for local db entries: depends, requiredby, conflicts, provides + # for local db entries: depends, conflicts, provides # for sync ones: depends, conflicts, provides data = [] if pkg.depends: data.append(_mksection("DEPENDS", pkg.depends)) - if self.treename == "local": - if pkg.requiredby: - data.append(_mksection("REQUIREDBY", pkg.requiredby)) + if pkg.optdepends: + data.append(_mksection("OPTDEPENDS", pkg.optdepends)) if pkg.conflicts: data.append(_mksection("CONFLICTS", pkg.conflicts)) if pkg.provides: diff --git a/pactest/pmenv.py b/pactest/pmenv.py index bff32e98..3b54afc0 100755 --- a/pactest/pmenv.py +++ b/pactest/pmenv.py @@ -68,12 +68,10 @@ class pmenv: t.generate() # Hack for mtimes consistency - modified = 0 for i in t.rules: if i.rule.find("MODIFIED") != -1: - modified = 1 - if modified: - time.sleep(3) + time.sleep(1.5) + break t.run(self.pacman) diff --git a/pactest/pmpkg.py b/pactest/pmpkg.py index c302d2ae..7b8f81d0 100755 --- a/pactest/pmpkg.py +++ b/pactest/pmpkg.py @@ -53,7 +53,7 @@ class pmpkg: self.force = 0 # sync only (will be moved to depends) # depends self.depends = [] - self.requiredby = [] # local only + self.optdepends = [] self.conflicts = [] self.provides = [] # files @@ -146,6 +146,8 @@ class pmpkg: data.append("group = %s" % i) for i in self.depends: data.append("depend = %s" % i) + for i in self.optdepends: + data.append("optdepend = %s" % i) for i in self.conflicts: data.append("conflict = %s" % i) for i in self.provides: @@ -165,13 +167,23 @@ class pmpkg: # .FILELIST if self.files: - os.system("tar cvf /dev/null * | sort >.FILELIST") + # generate a filelist + filelist = [] + current = "" + for path, dirs, files in os.walk("."): + # we have to strip the './' portion from the path + # and add a newline to each entry. + current = os.path.join(path, "")[2:] + if len(current) != 0: + filelist.append(current + "\n") + for file in files: + # skip .PKGINFO, etc. + if(not file.startswith(".")): + filelist.append(os.path.join(path, file)[2:] + "\n") + f = open('.FILELIST', 'w') + f.writelines(filelist) + f.close() targets += " .FILELIST *" - else: - #prevent some pacman warnings... I expect a real package would - #always have at least one file... - os.system("touch .FILELIST") - targets += " .FILELIST" #safely create the dir mkdir(os.path.dirname(self.path)) diff --git a/pactest/pmrule.py b/pactest/pmrule.py index 886ac545..8b49f5cd 100755 --- a/pactest/pmrule.py +++ b/pactest/pmrule.py @@ -19,7 +19,7 @@ from util import * - +from stat import * class pmrule: """Rule object @@ -83,8 +83,8 @@ class pmrule: elif case == "DEPENDS": if not value in newpkg.depends: success = 0 - elif case == "REQUIREDBY": - if not value in newpkg.requiredby: + elif case == "OPTDEPENDS": + if not value in newpkg.optdepends: success = 0 elif case == "REASON": if newpkg.reason != int(value): @@ -108,24 +108,37 @@ class pmrule: if case == "EXIST": if not os.path.isfile(filename): success = 0 - else: - if case == "MODIFIED": - for f in files: - if f.name == key: - if not f.ismodified(): - success = 0 - elif case == "PACNEW": - if not os.path.isfile("%s%s" % (filename, PM_PACNEW)): + elif case == "MODIFIED": + for f in files: + if f.name == key: + if not f.ismodified(): + success = 0 + elif case == "MODE": + mode = os.lstat(filename)[ST_MODE] + if int(value,8) != S_IMODE(mode): + success = 0 + elif case == "TYPE": + if value == "dir": + if not os.path.isdir(filename): success = 0 - elif case == "PACORIG": - if not os.path.isfile("%s%s" % (filename, PM_PACORIG)): + elif value == "file": + if not os.path.isfile(filename): success = 0 - elif case == "PACSAVE": - if not os.path.isfile("%s%s" % (filename, PM_PACSAVE)): + elif value == "link": + if not os.path.islink(filename): success = 0 - else: - print "FILE rule '%s' not found" % case - success = -1 + elif case == "PACNEW": + if not os.path.isfile("%s%s" % (filename, PM_PACNEW)): + success = 0 + elif case == "PACORIG": + if not os.path.isfile("%s%s" % (filename, PM_PACORIG)): + success = 0 + elif case == "PACSAVE": + if not os.path.isfile("%s%s" % (filename, PM_PACSAVE)): + success = 0 + else: + print "FILE rule '%s' not found" % case + success = -1 else: print "Rule kind '%s' not found" % kind success = -1 diff --git a/pactest/pmtest.py b/pactest/pmtest.py index 06b65bbb..e0b3fd44 100755 --- a/pactest/pmtest.py +++ b/pactest/pmtest.py @@ -84,6 +84,7 @@ class pmtest: self.option = { "noupgrade": [], "ignorepkg": [], + "ignoregroup": [], "noextract": [] } @@ -192,8 +193,12 @@ class pmtest: cmd.append("libtool gdb --args") if pacman["valgrind"]: cmd.append("valgrind --tool=memcheck --leak-check=full --show-reachable=yes") - cmd.append("%s --config=%s --root=%s" \ - % (pacman["bin"], os.path.join(self.root, PACCONF), self.root)) + cmd.append("%s --config=%s --root=%s --dbpath=%s --cachedir=%s" \ + % (pacman["bin"], + os.path.join(self.root, PACCONF), + self.root, + os.path.join(self.root, PM_DBPATH), + os.path.join(self.root, PM_CACHEDIR))) if not pacman["manual-confirm"]: cmd.append("--noconfirm") if pacman["debug"]: diff --git a/pactest/tests/add030.py b/pactest/tests/add030.py deleted file mode 100644 index d36311c0..00000000 --- a/pactest/tests/add030.py +++ /dev/null @@ -1,18 +0,0 @@ -self.description = "Freshen a package" - -lp = pmpkg("dummy") -lp.files = ["bin/dummy", - "usr/man/man1/dummy.1"] -self.addpkg2db("local", lp) - -p = pmpkg("dummy", "1.0-2") -p.files = ["bin/dummy", - "usr/man/man1/dummy.1"] -self.addpkg(p) - -self.args = "-F %s" % p.filename() - -self.addrule("PACMAN_RETCODE=0") -self.addrule("PKG_VERSION=dummy|1.0-2") -for f in p.files: - self.addrule("FILE_MODIFIED=%s" % f) diff --git a/pactest/tests/add031.py b/pactest/tests/add031.py deleted file mode 100644 index 38b0485c..00000000 --- a/pactest/tests/add031.py +++ /dev/null @@ -1,18 +0,0 @@ -self.description = "Freshen a package (installed is newer)" - -lp = pmpkg("dummy", "1.0-2") -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 = "-F %s" % p.filename() - -self.addrule("PACMAN_RETCODE=1") -self.addrule("!PKG_MODIFIED=dummy") -for f in p.files: - self.addrule("!FILE_MODIFIED=%s" % f) diff --git a/pactest/tests/add032.py b/pactest/tests/add032.py deleted file mode 100644 index 2c5a11fa..00000000 --- a/pactest/tests/add032.py +++ /dev/null @@ -1,18 +0,0 @@ -self.description = "Freshen a package (installed is same)" - -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 = "-F %s" % p.filename() - -self.addrule("PACMAN_RETCODE=1") -self.addrule("!PKG_MODIFIED=dummy") -for f in p.files: - self.addrule("!FILE_MODIFIED=%s" % f) diff --git a/pactest/tests/add043.py b/pactest/tests/add043.py new file mode 100644 index 00000000..18f732ee --- /dev/null +++ b/pactest/tests/add043.py @@ -0,0 +1,15 @@ +self.description = "provision>=1.0-2 dependency" + +p = pmpkg("pkg1", "1.0-2") +p.depends = ["provision>=1.0-2"] +self.addpkg(p) + +lp = pmpkg("pkg2", "1.0-2") +lp.provides = ["provision"] +self.addpkg2db("local", lp) + +self.args = "-A %s" % p.filename() + +self.addrule("PACMAN_RETCODE=1") +self.addrule("!PKG_EXIST=pkg1") +self.addrule("PKG_EXIST=pkg2") diff --git a/pactest/tests/add044.py b/pactest/tests/add044.py new file mode 100644 index 00000000..cbc82e9d --- /dev/null +++ b/pactest/tests/add044.py @@ -0,0 +1,15 @@ +self.description = "provision>=1.0-2 dependency (2)" + +p = pmpkg("pkg1", "1.0-2") +p.depends = ["provision>=1.0-2"] +self.addpkg(p) + +lp = pmpkg("pkg2", "1.0-2") +lp.provides = ["provision 1.0-2"] +self.addpkg2db("local", lp) + +self.args = "-A %s" % p.filename() + +self.addrule("PACMAN_RETCODE=0") +self.addrule("PKG_EXIST=pkg1") +self.addrule("PKG_EXIST=pkg2") diff --git a/pactest/tests/add045.py b/pactest/tests/add045.py new file mode 100644 index 00000000..b53e0906 --- /dev/null +++ b/pactest/tests/add045.py @@ -0,0 +1,15 @@ +self.description = "provision>=1.0-2 dependency (3)" + +p = pmpkg("pkg1", "1.0-2") +p.depends = ["provision>=1.0-2"] +self.addpkg(p) + +lp = pmpkg("pkg2", "1.0-2") +lp.provides = ["provision 1.0-1"] +self.addpkg2db("local", lp) + +self.args = "-A %s" % p.filename() + +self.addrule("PACMAN_RETCODE=1") +self.addrule("!PKG_EXIST=pkg1") +self.addrule("PKG_EXIST=pkg2") diff --git a/pactest/tests/depconflict100.py b/pactest/tests/depconflict100.py new file mode 100644 index 00000000..948017d9 --- /dev/null +++ b/pactest/tests/depconflict100.py @@ -0,0 +1,15 @@ +self.description = "a package conflicts with itself" + +sp1 = pmpkg("pkg1") +sp1.conflicts = ["pkg1"] +self.addpkg2db("sync", sp1); + +sp2 = pmpkg("pkg2", "1.0-2") +self.addpkg2db("sync", sp2) + +self.args = "-S %s" % " ".join([p.name for p in sp1, sp2]) + +self.addrule("PACMAN_RETCODE=0") +self.addrule("PKG_EXIST=pkg1") +self.addrule("PKG_EXIST=pkg2") +self.addrule("PKG_VERSION=pkg2|1.0-2") diff --git a/pactest/tests/depconflict110.py b/pactest/tests/depconflict110.py new file mode 100644 index 00000000..2e326f52 --- /dev/null +++ b/pactest/tests/depconflict110.py @@ -0,0 +1,13 @@ +self.description = "conflict with version (conflict)" + +p = pmpkg("pkg1") +p.conflicts = ["pkg2<=1.0-2"] +self.addpkg(p); + +lp = pmpkg("pkg2", "1.0-1") +self.addpkg2db("local", lp) + +self.args = "-A %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 new file mode 100644 index 00000000..6f95733b --- /dev/null +++ b/pactest/tests/depconflict111.py @@ -0,0 +1,13 @@ +self.description = "conflict with version (no conflict)" + +p = pmpkg("pkg1") +p.conflicts = ["pkg2=1.0-2"] +self.addpkg(p); + +lp = pmpkg("pkg2", "1.0-1") +self.addpkg2db("local", lp) + +self.args = "-A %s" % p.filename() +self.addrule("PACMAN_RETCODE=0") +self.addrule("PKG_EXIST=pkg1") +self.addrule("PKG_EXIST=pkg2") diff --git a/pactest/tests/depconflict120.py b/pactest/tests/depconflict120.py new file mode 100644 index 00000000..a9f3f6b3 --- /dev/null +++ b/pactest/tests/depconflict120.py @@ -0,0 +1,19 @@ +self.description = "target vs db conflict will disappear after upgrade" + +sp1 = pmpkg("pkg1") +sp1.conflicts = ["imaginary"] +self.addpkg2db("sync", sp1); + +sp2 = pmpkg("pkg2", "1.0-2") +self.addpkg2db("sync", sp2) + +lp = pmpkg("pkg2", "1.0-1") +lp.provides = ["imaginary"] +self.addpkg2db("local", lp) + +self.args = "-S %s" % " ".join([p.name for p in sp1, sp2]) + +self.addrule("PACMAN_RETCODE=0") +self.addrule("PKG_EXIST=pkg1") +self.addrule("PKG_EXIST=pkg2") +self.addrule("PKG_VERSION=pkg2|1.0-2") diff --git a/pactest/tests/deptest001.py b/pactest/tests/deptest001.py new file mode 100644 index 00000000..db0b7684 --- /dev/null +++ b/pactest/tests/deptest001.py @@ -0,0 +1,20 @@ +self.description = "test deptest (-T) functionality" + +sp1 = pmpkg("pkg1") +sp1.depends = ["dep"] +self.addpkg2db("sync", sp1) + +sp1dep = pmpkg("dep") +self.addpkg2db("sync", sp1dep) + +sp2 = pmpkg("pkg2") +self.addpkg2db("sync", sp2) + +lp2 = pmpkg("pkg2") +self.addpkg2db("local", lp2) + +self.args = "-T pkg1 pkg2" + +self.addrule("PACMAN_RETCODE=127") +self.addrule("PACMAN_OUTPUT=pkg1") +self.addrule("!PACMAN_OUTPUT=pkg2") diff --git a/pactest/tests/fileconflict001.py b/pactest/tests/fileconflict001.py new file mode 100644 index 00000000..8aca9a0a --- /dev/null +++ b/pactest/tests/fileconflict001.py @@ -0,0 +1,20 @@ +self.description = "Fileconflict with symlinks" + +lp = pmpkg("dummy") +lp.files = ["dir/realdir/", + "dir/symdir -> realdir"] +self.addpkg2db("local", lp) + +p1 = pmpkg("pkg1") +p1.files = ["dir/realdir/file"] +self.addpkg(p1) + +p2 = pmpkg("pkg2") +p2.files = ["dir/symdir/file"] +self.addpkg(p2) + +self.args = "-A %s" % " ".join([p.filename() for p in p1, p2]) + +self.addrule("PACMAN_RETCODE=1") +self.addrule("!PKG_EXIST=pkg1") +self.addrule("!PKG_EXIST=pkg2") diff --git a/pactest/tests/fileconflict002.py b/pactest/tests/fileconflict002.py new file mode 100644 index 00000000..da04e332 --- /dev/null +++ b/pactest/tests/fileconflict002.py @@ -0,0 +1,16 @@ +self.description = "Fileconflict with symlinks (2)" + +p1 = pmpkg("pkg1") +p1.files = ["dir/realdir/file", + "dir/symdir -> realdir"] +self.addpkg(p1) + +p2 = pmpkg("pkg2") +p2.files = ["dir/symdir/file"] +self.addpkg(p2) + +self.args = "-A %s" % " ".join([p.filename() for p in p1, p2]) + +self.addrule("PACMAN_RETCODE=1") +self.addrule("!PKG_EXIST=pkg1") +self.addrule("!PKG_EXIST=pkg2") diff --git a/pactest/tests/mode001.py b/pactest/tests/mode001.py new file mode 100644 index 00000000..ff245a2c --- /dev/null +++ b/pactest/tests/mode001.py @@ -0,0 +1,12 @@ +self.description = "Check the mode of default files in a package" + +p = pmpkg("pkg1") +p.files = ["bin/foo" + "bin/bar"] +self.addpkg(p) + +self.args = "-U %s" % p.filename() + +self.addrule("PACMAN_RETCODE=0") +for f in p.files: + self.addrule("FILE_MODE=%s|644" % f) diff --git a/pactest/tests/pacman001.py b/pactest/tests/pacman001.py new file mode 100644 index 00000000..d467e3f2 --- /dev/null +++ b/pactest/tests/pacman001.py @@ -0,0 +1,5 @@ +self.description = "Test command line option (--version)" + +self.args = "--version" + +self.addrule("PACMAN_RETCODE=2") diff --git a/pactest/tests/pacman002.py b/pactest/tests/pacman002.py new file mode 100644 index 00000000..c0217259 --- /dev/null +++ b/pactest/tests/pacman002.py @@ -0,0 +1,5 @@ +self.description = "Test command line option (--help)" + +self.args = "--help" + +self.addrule("PACMAN_RETCODE=2") diff --git a/pactest/tests/pacman003.py b/pactest/tests/pacman003.py new file mode 100644 index 00000000..b5275943 --- /dev/null +++ b/pactest/tests/pacman003.py @@ -0,0 +1,5 @@ +self.description = "Test command line option (-S --help)" + +self.args = "-S --help" + +self.addrule("PACMAN_RETCODE=2") diff --git a/pactest/tests/pacman004.py b/pactest/tests/pacman004.py new file mode 100644 index 00000000..d8d6b102 --- /dev/null +++ b/pactest/tests/pacman004.py @@ -0,0 +1,5 @@ +self.description = "Test command line option (-v)" + +self.args = "-v" + +self.addrule("PACMAN_RETCODE=1") diff --git a/pactest/tests/query001.py b/pactest/tests/query001.py index 315af84a..8faf0e15 100644 --- a/pactest/tests/query001.py +++ b/pactest/tests/query001.py @@ -7,4 +7,4 @@ self.addpkg2db("local", p) self.args = "-Q %s" % p.name self.addrule("PACMAN_RETCODE=0") -self.addrule("PACMAN_OUTPUT=foobar") +self.addrule("PACMAN_OUTPUT=%s" % p.name) diff --git a/pactest/tests/query002.py b/pactest/tests/query002.py new file mode 100644 index 00000000..c6a6c7d3 --- /dev/null +++ b/pactest/tests/query002.py @@ -0,0 +1,23 @@ +self.description = "Query info on a package" + +p = pmpkg("foobar") +p.files = ["bin/foobar"] +p.desc = "test description" +p.groups = ["foo"] +p.url = "http://www.archlinux.org" +p.license = "GPL2" +p.arch = "i686" +# test both old style and new style dates +p.builddate = "Mon Oct 1 01:40:21 2007 UTC" +p.installdate = "1196640127" +p.packager = "Arch Linux" + +self.addpkg2db("local", p) + +self.args = "-Qi %s" % p.name + +self.addrule("PACMAN_RETCODE=0") +self.addrule("PACMAN_OUTPUT=%s" % p.name) +self.addrule("PACMAN_OUTPUT=%s" % p.desc) +self.addrule("PACMAN_OUTPUT=Oct") +self.addrule("PACMAN_OUTPUT=Dec") diff --git a/pactest/tests/query003.py b/pactest/tests/query003.py new file mode 100644 index 00000000..ea113081 --- /dev/null +++ b/pactest/tests/query003.py @@ -0,0 +1,10 @@ +self.description = "Query search for a package" + +p = pmpkg("foobar") +p.files = ["bin/foobar"] +self.addpkg2db("local", p) + +self.args = "-Qs %s" % p.name + +self.addrule("PACMAN_RETCODE=0") +self.addrule("PACMAN_OUTPUT=%s" % p.name) diff --git a/pactest/tests/query004.py b/pactest/tests/query004.py new file mode 100644 index 00000000..8faf0e15 --- /dev/null +++ b/pactest/tests/query004.py @@ -0,0 +1,10 @@ +self.description = "Query a package" + +p = pmpkg("foobar") +p.files = ["bin/foobar"] +self.addpkg2db("local", p) + +self.args = "-Q %s" % p.name + +self.addrule("PACMAN_RETCODE=0") +self.addrule("PACMAN_OUTPUT=%s" % p.name) diff --git a/pactest/tests/remove040.py b/pactest/tests/remove040.py index d15984b3..07d3e67d 100644 --- a/pactest/tests/remove040.py +++ b/pactest/tests/remove040.py @@ -1,4 +1,4 @@ -self.description = "Remove a package required by another package" +self.description = "Remove a package that requires another package" lp1 = pmpkg("pkg1") lp1.depends = ["imaginary"] diff --git a/pactest/tests/remove041.py b/pactest/tests/remove041.py new file mode 100644 index 00000000..9ab7bf74 --- /dev/null +++ b/pactest/tests/remove041.py @@ -0,0 +1,21 @@ +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") +lp3.depends = ["imaginary"] +self.addpkg2db("local", lp3) + +self.args = "-R %s" % lp1.name + +self.addrule("PACMAN_RETCODE=0") +self.addrule("!PKG_EXIST=pkg1") +self.addrule("PKG_EXIST=pkg2") diff --git a/pactest/tests/remove042.py b/pactest/tests/remove042.py new file mode 100644 index 00000000..5de1fb41 --- /dev/null +++ b/pactest/tests/remove042.py @@ -0,0 +1,17 @@ +self.description = "Cascade remove a package required by another package" + +lp1 = pmpkg("pkg1") +lp1.depends = ["imaginary"] +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") +self.addrule("!PKG_EXIST=pkg1") +self.addrule("!PKG_EXIST=pkg2") diff --git a/pactest/tests/remove043.py b/pactest/tests/remove043.py new file mode 100644 index 00000000..a377c58b --- /dev/null +++ b/pactest/tests/remove043.py @@ -0,0 +1,18 @@ +self.description = "Remove a package required by another package" + +lp1 = pmpkg("pkg1") +lp1.depends = ["imaginary"] +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/remove044.py b/pactest/tests/remove044.py new file mode 100644 index 00000000..720c1fe7 --- /dev/null +++ b/pactest/tests/remove044.py @@ -0,0 +1,16 @@ +self.description = "-Rs test" + +lp1 = pmpkg("pkg1") +lp1.depends = ["pkg2=1.1-1"] +self.addpkg2db("local", lp1) + +lp2 = pmpkg("pkg2", "1.0-1") +lp2.reason = 1 +self.addpkg2db("local", lp2) + + +self.args = "-Rs %s" % lp1.name + +self.addrule("PACMAN_RETCODE=0") +self.addrule("!PKG_EXIST=pkg1") +self.addrule("PKG_EXIST=pkg2") diff --git a/pactest/tests/remove045.py b/pactest/tests/remove045.py new file mode 100644 index 00000000..d8b7845b --- /dev/null +++ b/pactest/tests/remove045.py @@ -0,0 +1,30 @@ +self.description = "-Rs advanced test" + +lp1 = pmpkg("pkg1") +lp1.depends = ["pkg2" , "pkg3"] +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 + +self.addrule("PACMAN_RETCODE=0") +self.addrule("!PKG_EXIST=pkg1") +self.addrule("!PKG_EXIST=pkg2") +self.addrule("!PKG_EXIST=pkg3") +self.addrule("!PKG_EXIST=pkg4") diff --git a/pactest/tests/remove046.py b/pactest/tests/remove046.py new file mode 100644 index 00000000..1ee8be17 --- /dev/null +++ b/pactest/tests/remove046.py @@ -0,0 +1,10 @@ +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 new file mode 100644 index 00000000..9606c2e3 --- /dev/null +++ b/pactest/tests/remove047.py @@ -0,0 +1,25 @@ +self.description = "Remove a package required by other packages" + +lp1 = pmpkg("pkg1") +lp1.requiredby = ["pkg2", "pkg3", "pkg4"] +self.addpkg2db("local", lp1) + +lp2 = pmpkg("pkg2") +lp2.depends = ["pkg1"] +self.addpkg2db("local", lp2) + +lp3 = pmpkg("pkg3") +lp3.depends = ["pkg1"] +self.addpkg2db("local", lp3) + +lp4 = pmpkg("pkg4") +lp4.depends = ["pkg1"] +self.addpkg2db("local", lp4) + +self.args = "-R pkg1 pkg2" + +self.addrule("!PACMAN_RETCODE=0") +self.addrule("PKG_EXIST=pkg1") +self.addrule("PKG_EXIST=pkg2") +self.addrule("PKG_EXIST=pkg3") +self.addrule("PKG_EXIST=pkg4") diff --git a/pactest/tests/remove048.py b/pactest/tests/remove048.py new file mode 100644 index 00000000..2d9b4803 --- /dev/null +++ b/pactest/tests/remove048.py @@ -0,0 +1,10 @@ +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/requiredby001.py b/pactest/tests/requiredby001.py new file mode 100644 index 00000000..0f05d82c --- /dev/null +++ b/pactest/tests/requiredby001.py @@ -0,0 +1,20 @@ +self.description = "A package is downgraded no longer satisfying a depend" + +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") +self.addpkg(p) + +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") diff --git a/pactest/tests/requiredby002.py b/pactest/tests/requiredby002.py new file mode 100644 index 00000000..299ec88b --- /dev/null +++ b/pactest/tests/requiredby002.py @@ -0,0 +1,16 @@ +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 new file mode 100644 index 00000000..3279c2ab --- /dev/null +++ b/pactest/tests/requiredby003.py @@ -0,0 +1,16 @@ +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 new file mode 100644 index 00000000..c4fe7687 --- /dev/null +++ b/pactest/tests/requiredby004.py @@ -0,0 +1,20 @@ +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 new file mode 100644 index 00000000..5b2ce164 --- /dev/null +++ b/pactest/tests/requiredby005.py @@ -0,0 +1,21 @@ +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 new file mode 100644 index 00000000..ea14cde5 --- /dev/null +++ b/pactest/tests/requiredby006.py @@ -0,0 +1,21 @@ +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/scriptlet001.py b/pactest/tests/scriptlet001.py index 73bb7691..3609d167 100644 --- a/pactest/tests/scriptlet001.py +++ b/pactest/tests/scriptlet001.py @@ -2,6 +2,10 @@ # validity of the scripts, only that they fire (or try to) self.description = "Scriptlet test (pre/post install)" +lpsh = pmpkg("sh") +lpsh.files = ['bin/sh'] +self.addpkg2db("local", lpsh) + p1 = pmpkg("dummy") p1.files = ['etc/dummy.conf'] p1.install['pre_install'] = "ls /etc"; @@ -12,5 +16,6 @@ self.addpkg(p1) self.args = "--debug -U %s" % p1.filename() self.addrule("PACMAN_RETCODE=0") +self.addrule("FILE_EXIST=bin/sh") self.addrule("PACMAN_OUTPUT=pre_install") self.addrule("PACMAN_OUTPUT=post_install") diff --git a/pactest/tests/scriptlet002.py b/pactest/tests/scriptlet002.py new file mode 100644 index 00000000..38ed5fd0 --- /dev/null +++ b/pactest/tests/scriptlet002.py @@ -0,0 +1,21 @@ +# quick note here - chroot() is expected to fail. We're not checking the +# validity of the scripts, only that they fire (or try to) +self.description = "Scriptlet test (pre/post remove)" + +lpsh = pmpkg("sh") +lpsh.files = ['bin/sh'] +self.addpkg2db("local", lpsh) + +p1 = pmpkg("dummy") +p1.files = ['etc/dummy.conf'] +p1.install['pre_remove'] = "ls /etc"; +p1.install['post_remove'] = "ls /etc"; +self.addpkg2db("local", p1) + +# --debug is necessary to check PACMAN_OUTPUT +self.args = "--debug -R %s" % p1.name + +self.addrule("PACMAN_RETCODE=0") +self.addrule("FILE_EXIST=bin/sh") +self.addrule("PACMAN_OUTPUT=pre_remove") +self.addrule("PACMAN_OUTPUT=post_remove") diff --git a/pactest/tests/symlink001.py b/pactest/tests/symlink001.py new file mode 100644 index 00000000..cbf71ccc --- /dev/null +++ b/pactest/tests/symlink001.py @@ -0,0 +1,20 @@ +self.description = "Dir symlinks overwritten on install (the perl/git bug)" + +lp = pmpkg("dummy") +lp.files = ["dir/realdir/", + "dir/symdir -> realdir"] +self.addpkg2db("local", lp) + +p = pmpkg("pkg1") +p.files = ["dir/symdir/tmp"] +self.addpkg(p) + +self.args = "-U %s" % p.filename() + +self.addrule("PACMAN_RETCODE=0") +self.addrule("PKG_EXIST=pkg1") +self.addrule("FILE_EXIST=dir/symdir/tmp") +self.addrule("FILE_EXIST=dir/realdir/tmp") +self.addrule("FILE_TYPE=dir/symdir/tmp|file") +self.addrule("FILE_TYPE=dir/symdir|link") +self.addrule("FILE_TYPE=dir/realdir|dir") diff --git a/pactest/tests/sync011.py b/pactest/tests/sync011.py new file mode 100644 index 00000000..f5b1943a --- /dev/null +++ b/pactest/tests/sync011.py @@ -0,0 +1,20 @@ +self.description = "Install a package from a sync db with cascaded dependencies + provides" + +sp1 = pmpkg("dummy", "1.0-2") +sp1.depends = ["dep1", "dep2=1.0-2"] + +sp2 = pmpkg("dep1") +sp2.files = ["bin/dep1"] +sp2.provides = ["dep2"] + +sp3 = pmpkg("dep2", "1.0-2") + +for p in sp1, sp2, sp3: + self.addpkg2db("sync", p); + +self.args = "-S %s" % sp1.name + +self.addrule("PACMAN_RETCODE=0") +self.addrule("PKG_VERSION=dummy|1.0-2") +self.addrule("PKG_EXIST=dep1") +self.addrule("PKG_EXIST=dep2") diff --git a/pactest/tests/sync012.py b/pactest/tests/sync012.py new file mode 100644 index 00000000..3aaba376 --- /dev/null +++ b/pactest/tests/sync012.py @@ -0,0 +1,20 @@ +self.description = "Install packages from a sync db with circular dependencies" + +sp1 = pmpkg("pkg1") +sp1.depends = ["pkg2"] + +sp2 = pmpkg("pkg2") +sp2.depends = ["pkg3"] + +sp3 = pmpkg("pkg3") +sp3.depends = ["pkg1"] + +for p in sp1, sp2, sp3: + self.addpkg2db("sync", p); + +self.args = "-S %s" % sp1.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/sync030.py b/pactest/tests/sync030.py new file mode 100644 index 00000000..1fd97500 --- /dev/null +++ b/pactest/tests/sync030.py @@ -0,0 +1,19 @@ +self.description = "Sync packages non-explicitly" + +lp1 = pmpkg("pkg1") +lp1.reason = 0 +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 --asdeps %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|1") +self.addrule("PKG_REASON=pkg2|1") diff --git a/pactest/tests/sync044.py b/pactest/tests/sync044.py new file mode 100644 index 00000000..c4ff1549 --- /dev/null +++ b/pactest/tests/sync044.py @@ -0,0 +1,20 @@ +self.description = "A dependency induces a replacement" + +lp1 = pmpkg("pkg1") +self.addpkg2db("local", lp1); + +sp2 = pmpkg("pkg2") +sp2.depends = ["pkg3"] +self.addpkg2db("sync", sp2); + +sp3 = pmpkg("pkg3") +sp3.conflicts = ["pkg1"] +self.addpkg2db("sync", sp3); + +self.args = "-S pkg2" + +self.addrule("PACMAN_RETCODE=0") +self.addrule("!PKG_EXIST=pkg1") +self.addrule("PKG_EXIST=pkg2") +self.addrule("PKG_EXIST=pkg3") +self.addrule("PKG_REASON=pkg3|1") diff --git a/pactest/tests/sync060.py b/pactest/tests/sync060.py new file mode 100644 index 00000000..45f0c3e0 --- /dev/null +++ b/pactest/tests/sync060.py @@ -0,0 +1,15 @@ +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/sync1002.py b/pactest/tests/sync1002.py new file mode 100644 index 00000000..c158838b --- /dev/null +++ b/pactest/tests/sync1002.py @@ -0,0 +1,19 @@ +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 new file mode 100644 index 00000000..3fd9799d --- /dev/null +++ b/pactest/tests/sync1003.py @@ -0,0 +1,26 @@ +self.description = "Induced removal would break dependency" + +sp1 = pmpkg("pkg1", "1.0-2") +sp1.replaces = [ "pkg2" ] +self.addpkg2db("sync", sp1) + +sp2 = pmpkg("pkg2", "1.0-2") +self.addpkg2db("sync", sp2) + +sp3 = pmpkg("pkg3", "1.0-2") +sp3.depends = ["pkg2=1.0-2"] +self.addpkg2db("sync", sp3) + +lp1 = pmpkg("pkg1", "1.0-1") +self.addpkg2db("local", lp1) + +lp2 = pmpkg("pkg2", "1.0-2") +self.addpkg2db("local", lp2) + +lp3 = pmpkg("pkg3", "1.0-1") +self.addpkg2db("local", lp3) + +self.args = "-Su" + +self.addrule("PACMAN_RETCODE=1") +self.addrule("PKG_EXIST=pkg2") diff --git a/pactest/tests/sync1004.py b/pactest/tests/sync1004.py new file mode 100644 index 00000000..f87bbe9b --- /dev/null +++ b/pactest/tests/sync1004.py @@ -0,0 +1,18 @@ +self.description = "Induced removal would break dependency (2)" + +sp1 = pmpkg("pkg1") +sp1.conflicts = [ "depend" ] +self.addpkg2db("sync", sp1) + +sp2 = pmpkg("pkg2") +sp2.depends = ["depend"] +self.addpkg2db("sync", sp2) + +lp = pmpkg("depend") +self.addpkg2db("local", lp) + +self.args = "-S pkg1 pkg2" + +self.addrule("PACMAN_RETCODE=1") +self.addrule("PKG_EXIST=depend") + diff --git a/pactest/tests/sync1005.py b/pactest/tests/sync1005.py new file mode 100644 index 00000000..4fa82478 --- /dev/null +++ b/pactest/tests/sync1005.py @@ -0,0 +1,14 @@ +self.description = "Conflicting package names in sync repos" + +sp1 = pmpkg("pkg") +sp1.provides = [ "provision1" ] +self.addpkg2db("sync1", sp1) + +sp2 = pmpkg("pkg") +sp2.provides = [ "provision2" ] +self.addpkg2db("sync2", sp2) + +self.args = "-S provision1 provision2" + +self.addrule("PACMAN_RETCODE=1") +self.addrule("!PKG_EXIST=pkg") diff --git a/pactest/tests/sync1006.py b/pactest/tests/sync1006.py new file mode 100644 index 00000000..c331f42e --- /dev/null +++ b/pactest/tests/sync1006.py @@ -0,0 +1,14 @@ +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/sync1100.py b/pactest/tests/sync1100.py new file mode 100644 index 00000000..f0fb4f64 --- /dev/null +++ b/pactest/tests/sync1100.py @@ -0,0 +1,23 @@ +self.description = "Get info on package from a sync db" + +sp = pmpkg("dummy") +sp.files = ["bin/dummy", + "usr/man/man1/dummy.1"] +sp.desc = "test description" +sp.groups = ["foo"] +sp.url = "http://www.archlinux.org" +sp.license = "GPL2" +sp.arch = "i686" +# test both old style and new style dates +sp.builddate = "Mon Oct 1 01:40:21 2007 UTC" +sp.packager = "Arch Linux" +sp.md5sum = "00000000000000000000000000000000" + +self.addpkg2db("sync", sp) + +self.args = "-Si %s" % sp.name + +self.addrule("PACMAN_RETCODE=0") +self.addrule("PACMAN_OUTPUT=%s" % sp.name) +self.addrule("PACMAN_OUTPUT=%s" % sp.desc) +self.addrule("PACMAN_OUTPUT=Oct") diff --git a/pactest/tests/sync1101.py b/pactest/tests/sync1101.py new file mode 100644 index 00000000..ba2ad44f --- /dev/null +++ b/pactest/tests/sync1101.py @@ -0,0 +1,11 @@ +self.description = "Search for package from a sync db" + +sp = pmpkg("dummy") +sp.files = ["bin/dummy", + "usr/man/man1/dummy.1"] +self.addpkg2db("sync", sp) + +self.args = "-Ss %s" % sp.name + +self.addrule("PACMAN_RETCODE=0") +self.addrule("PACMAN_OUTPUT=%s" % sp.name) diff --git a/pactest/tests/sync1102.py b/pactest/tests/sync1102.py new file mode 100644 index 00000000..3a27238f --- /dev/null +++ b/pactest/tests/sync1102.py @@ -0,0 +1,12 @@ +self.description = "Get URL on package from a sync db" + +sp = pmpkg("dummy") +sp.files = ["bin/dummy", + "usr/man/man1/dummy.1"] +self.addpkg2db("sync", sp) + +self.args = "-Sp %s" % sp.name + +self.addrule("PACMAN_RETCODE=0") +self.addrule("PACMAN_OUTPUT=%s" % sp.name) +self.addrule("PACMAN_OUTPUT=file://") diff --git a/pactest/tests/sync1103.py b/pactest/tests/sync1103.py new file mode 100644 index 00000000..052c7236 --- /dev/null +++ b/pactest/tests/sync1103.py @@ -0,0 +1,11 @@ +self.description = "Get package list from sync dbs" + +sp = pmpkg("dummy") +sp.files = ["bin/dummy", + "usr/man/man1/dummy.1"] +self.addpkg2db("sync", sp) + +self.args = "-Sl" + +self.addrule("PACMAN_RETCODE=0") +self.addrule("PACMAN_OUTPUT=%s" % sp.name) diff --git a/pactest/tests/sync138.py b/pactest/tests/sync138.py new file mode 100644 index 00000000..410c7f07 --- /dev/null +++ b/pactest/tests/sync138.py @@ -0,0 +1,22 @@ +self.description = "Sysupgrade of packages in 'IgnoreGroup'" + +sp1 = pmpkg("pkg1", "1.0-2") +sp2 = pmpkg("pkg2", "1.0-2") +sp2.groups = ["grp"] + +for p in sp1, sp2: + self.addpkg2db("sync", p) + +lp1 = pmpkg("pkg1") +lp2 = pmpkg("pkg2") + +for p in lp1, lp2: + self.addpkg2db("local", p) + +self.option["ignoregroup"] = ["grp"] + +self.args = "-Su" + +self.addrule("PACMAN_RETCODE=0") +self.addrule("PKG_VERSION=pkg1|1.0-2") +self.addrule("!PKG_MODIFIED=pkg2") diff --git a/pactest/tests/sync300.py b/pactest/tests/sync300.py new file mode 100644 index 00000000..85fb850d --- /dev/null +++ b/pactest/tests/sync300.py @@ -0,0 +1,15 @@ +self.description = "Sync with corrupt database (broken deps)" + +sp1 = pmpkg("pkg1") +sp1.depends = ["pkg2=1.1"] +self.addpkg2db("sync", sp1) + +sp2 = pmpkg("pkg2", "1.0-1") +self.addpkg2db("sync", sp2) + +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 new file mode 100644 index 00000000..e8526b93 --- /dev/null +++ b/pactest/tests/sync301.py @@ -0,0 +1,25 @@ +self.description = "Sysupgrade : pacman needs to be upgraded and has new deps" + +sp = pmpkg("pacman", "1.0-2") +sp.depends = ["dep"] +self.addpkg2db("sync", sp) + +spdep = pmpkg("dep") +self.addpkg2db("sync", spdep) + +sp1 = pmpkg("pkg1", "1.0-2") +self.addpkg2db("sync", sp1) + +lp = pmpkg("pacman", "1.0-1") +self.addpkg2db("local", lp) + +lp1 = pmpkg("pkg1", "1.0-1") +self.addpkg2db("local", lp1) + +self.args = "-Su" + +self.addrule("PACMAN_RETCODE=0") +self.addrule("PKG_EXIST=pacman") +self.addrule("PKG_VERSION=pacman|1.0-2") +self.addrule("PKG_EXIST=dep") +self.addrule("PKG_REQUIREDBY=dep|pacman") diff --git a/pactest/tests/sync400.py b/pactest/tests/sync400.py new file mode 100644 index 00000000..2ee1095d --- /dev/null +++ b/pactest/tests/sync400.py @@ -0,0 +1,25 @@ +self.description = "Install package with dep that conflicts with older version of package" + +sp1 = pmpkg("pkg1", "1.0-2") +sp1.depends = ["pkg2=1.0-2"] +self.addpkg2db("sync", sp1) + +sp2 = pmpkg("pkg2", "1.0-2") +sp2.conflicts = [ "pkg1=1.0-1" ] +self.addpkg2db("sync", sp2) + +lp1 = pmpkg("pkg1", "1.0-1") +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" + +self.addrule("PACMAN_RETCODE=0") +self.addrule("PKG_EXIST=pkg1") +self.addrule("PKG_VERSION=pkg1|1.0-2") +self.addrule("PKG_EXIST=pkg2") +self.addrule("PKG_VERSION=pkg2|1.0-2") diff --git a/pactest/tests/sync401.py b/pactest/tests/sync401.py new file mode 100644 index 00000000..eb816377 --- /dev/null +++ b/pactest/tests/sync401.py @@ -0,0 +1,21 @@ +self.description = "Ensure we choose provider already in target list" + +sp1 = pmpkg("pkg1") +sp1.depends = ["dep"] +self.addpkg2db("sync", sp1) + +sp2 = pmpkg("pkg2") +sp2.provides = ["dep"] +self.addpkg2db("sync", sp2) + +sp3 = pmpkg("pkg3") +sp3.conflicts = ["pkg2"] +sp3.provides = ["dep"] +self.addpkg2db("sync", sp3) + +self.args = "-S pkg1 pkg2" + +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/sync402.py b/pactest/tests/sync402.py new file mode 100644 index 00000000..6d82f735 --- /dev/null +++ b/pactest/tests/sync402.py @@ -0,0 +1,21 @@ +self.description = "Choice between two providers (1)" + +sp1 = pmpkg("pkg1") +sp1.depends = ["dep"] +self.addpkg2db("sync", sp1) + +sp2 = pmpkg("pkg2") +sp2.provides = ["dep"] +self.addpkg2db("sync", sp2) + +sp3 = pmpkg("pkg3") +sp3.conflicts = ["pkg1"] +sp3.provides = ["dep"] +self.addpkg2db("sync", sp3) + +self.args = "-S pkg1" + +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/sync403.py b/pactest/tests/sync403.py new file mode 100644 index 00000000..b8d01016 --- /dev/null +++ b/pactest/tests/sync403.py @@ -0,0 +1,21 @@ +self.description = "Choice between two providers (2)" + +sp1 = pmpkg("pkg1") +sp1.depends = ["dep"] +self.addpkg2db("sync", sp1) + +sp2 = pmpkg("pkg2") +sp2.conflicts = [ "pkg1" ] +sp2.provides = [ "dep" ] +self.addpkg2db("sync", sp2) + +sp3 = pmpkg("pkg3") +sp3.provides = [ "dep" ] +self.addpkg2db("sync", sp3) + +self.args = "-S pkg1" + +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/sync500.py b/pactest/tests/sync500.py new file mode 100644 index 00000000..36364c16 --- /dev/null +++ b/pactest/tests/sync500.py @@ -0,0 +1,10 @@ +self.description = "-S provision" + +sp = pmpkg("pkg1") +sp.provides = ["provision 1.0-1"] +self.addpkg2db("sync", sp) + +self.args = "-S provision" + +self.addrule("PACMAN_RETCODE=0") +self.addrule("PKG_EXIST=pkg1") diff --git a/pactest/tests/sync900.py b/pactest/tests/sync900.py new file mode 100644 index 00000000..f21af06a --- /dev/null +++ b/pactest/tests/sync900.py @@ -0,0 +1,28 @@ +self.description = "Replace one package with another providing it" + +sp = pmpkg("bar") +sp.provides = ["foo"] +sp.conflicts = ["foo"] +self.addpkg2db("sync", sp) + +lp = pmpkg("foo") +lp.requiredby = ["lp1", "lp2"] +self.addpkg2db("local", lp) + +lp1 = pmpkg("pkg1") +lp1.depends = ["foo"] +self.addpkg2db("local", lp1) + +lp2 = pmpkg("pkg2") +lp2.depends = ["foo"] +self.addpkg2db("local", lp2) + +self.args = "-S %s" % sp.name + +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 new file mode 100644 index 00000000..423fe42c --- /dev/null +++ b/pactest/tests/sync901.py @@ -0,0 +1,28 @@ +self.description = "Replace a package providing package with actual package" + +sp = pmpkg("foo") +self.addpkg2db("sync", sp) + +lp = pmpkg("bar") +lp.provides = ["foo"] +lp.conflicts = ["foo"] +lp.requiredby = ["lp1", "lp2"] +self.addpkg2db("local", lp) + +lp1 = pmpkg("pkg1") +lp1.depends = ["foo"] +self.addpkg2db("local", lp1) + +lp2 = pmpkg("pkg2") +lp2.depends = ["foo"] +self.addpkg2db("local", lp2) + +self.args = "-S %s" % sp.name + +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/sync990.py b/pactest/tests/sync990.py index ee6a590b..6ac5a1f6 100644 --- a/pactest/tests/sync990.py +++ b/pactest/tests/sync990.py @@ -7,14 +7,13 @@ sp2 = pmpkg("pkg2") sp3 = pmpkg("pkg3") sp3.conflicts = ["pkg2"] -sp3.provides = ["pkg2"] for p in sp1, sp2, sp3: self.addpkg2db("sync", p) self.args = "-S %s" % " ".join([p.name for p in sp1, sp2]) -self.addrule("PACMAN_RETCODE=0") -self.addrule("PKG_EXIST=pkg1") -self.addrule("PKG_EXIST=pkg2") +self.addrule("PACMAN_RETCODE=1") +self.addrule("!PKG_EXIST=pkg1") +self.addrule("!PKG_EXIST=pkg2") self.addrule("!PKG_EXIST=pkg3") diff --git a/pactest/tests/trans001.py b/pactest/tests/trans001.py new file mode 100644 index 00000000..b9889b14 --- /dev/null +++ b/pactest/tests/trans001.py @@ -0,0 +1,20 @@ +self.description = "fileconflict error cancels the sync transaction after the removal part" + +sp = pmpkg("pkg1") +sp.replaces = ["pkg3"] +sp.files = ["dir/file"] +self.addpkg2db("sync", sp) + +lp1 = pmpkg("pkg3") +self.addpkg2db("local", lp1) + +lp2 = pmpkg("pkg2") +lp2.files = ["dir/file"] +self.addpkg2db("local", lp2) + +self.args = "-Su" + +self.addrule("PACMAN_RETCODE=1") +self.addrule("!PKG_EXIST=pkg1") +self.addrule("PKG_EXIST=pkg2") +self.addrule("PKG_EXIST=pkg3") diff --git a/pactest/tests/type001.py b/pactest/tests/type001.py new file mode 100644 index 00000000..d55dcc11 --- /dev/null +++ b/pactest/tests/type001.py @@ -0,0 +1,17 @@ +self.description = "Check the types of default files in a package" + +p = pmpkg("pkg1") +p.files = ["foo/file1", + "foo/file2", + "foo/dir/", + "foo/symdir -> dir"] +self.addpkg(p) + +self.args = "-U %s" % p.filename() + +self.addrule("PACMAN_RETCODE=0") +self.addrule("FILE_TYPE=foo/|dir") +self.addrule("FILE_TYPE=foo/file1|file") +self.addrule("FILE_TYPE=foo/file2|file") +self.addrule("FILE_TYPE=foo/dir|dir") +self.addrule("FILE_TYPE=foo/symdir|link") diff --git a/pactest/tests/upgrade010.py b/pactest/tests/upgrade010.py index 04f3d816..633ef7e4 100644 --- a/pactest/tests/upgrade010.py +++ b/pactest/tests/upgrade010.py @@ -15,3 +15,4 @@ self.args = "-U %s" % p.filename() 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/upgrade020.py b/pactest/tests/upgrade020.py index ab5fe225..6a7994bb 100644 --- a/pactest/tests/upgrade020.py +++ b/pactest/tests/upgrade020.py @@ -15,3 +15,4 @@ self.args = "-U %s" % p.filename() 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/upgrade021.py b/pactest/tests/upgrade021.py index 1ac0ceb5..b45ea18a 100644 --- a/pactest/tests/upgrade021.py +++ b/pactest/tests/upgrade021.py @@ -15,3 +15,4 @@ self.args = "-U %s" % p.filename() 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/upgrade022.py b/pactest/tests/upgrade022.py index 6bf12c15..dcf7ae01 100644 --- a/pactest/tests/upgrade022.py +++ b/pactest/tests/upgrade022.py @@ -15,3 +15,4 @@ self.args = "-U %s" % p.filename() 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/upgrade023.py b/pactest/tests/upgrade023.py index 68a29df2..d1d2e314 100644 --- a/pactest/tests/upgrade023.py +++ b/pactest/tests/upgrade023.py @@ -15,3 +15,4 @@ self.addrule("PKG_VERSION=dummy|1.1-1") self.addrule("!FILE_MODIFIED=etc/dummy.conf") # Do we want this pacnew or not? self.addrule("FILE_PACNEW=etc/dummy.conf") +self.addrule("!FILE_PACSAVE=etc/dummy.conf") diff --git a/pactest/tests/upgrade024.py b/pactest/tests/upgrade024.py new file mode 100644 index 00000000..ec2f7623 --- /dev/null +++ b/pactest/tests/upgrade024.py @@ -0,0 +1,15 @@ +self.description = "Upgrade a package, with a file leaving 'backup'" + +lp = pmpkg("dummy") +lp.files = ["etc/dummy.conf*"] +lp.backup = ["etc/dummy.conf"] +self.addpkg2db("local", lp) + +p = pmpkg("dummy", "1.0-2") +self.addpkg(p) + +self.args = "-U %s" % p.filename() + +self.addrule("PKG_VERSION=dummy|1.0-2") +self.addrule("FILE_PACSAVE=etc/dummy.conf") +self.addrule("!FILE_EXIST=etc/dummy.conf") diff --git a/pactest/tests/upgrade025.py b/pactest/tests/upgrade025.py new file mode 100644 index 00000000..2c9c06f3 --- /dev/null +++ b/pactest/tests/upgrade025.py @@ -0,0 +1,17 @@ +self.description = "Upgrade a package, with a file leaving 'backup' but staying in the pkg" + +lp = pmpkg("dummy") +lp.files = ["etc/dummy.conf*"] +lp.backup = ["etc/dummy.conf"] +self.addpkg2db("local", lp) + +p = pmpkg("dummy", "1.0-2") +p.files = ["etc/dummy.conf"] +self.addpkg(p) + +self.args = "-U %s" % p.filename() + +self.addrule("PKG_VERSION=dummy|1.0-2") +self.addrule("FILE_PACSAVE=etc/dummy.conf") +self.addrule("!FILE_PACNEW=etc/dummy.conf") +self.addrule("FILE_EXIST=etc/dummy.conf") diff --git a/pactest/tests/upgrade031.py b/pactest/tests/upgrade031.py new file mode 100644 index 00000000..856de983 --- /dev/null +++ b/pactest/tests/upgrade031.py @@ -0,0 +1,19 @@ +self.description = "Install packages non-explicitly" + +lp1 = pmpkg("pkg1") +lp1.reason = 0 +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 --asdeps %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|1") +self.addrule("PKG_REASON=pkg2|1") diff --git a/pactest/tests/upgrade056.py b/pactest/tests/upgrade056.py index 8419731c..b92c38ac 100644 --- a/pactest/tests/upgrade056.py +++ b/pactest/tests/upgrade056.py @@ -11,6 +11,7 @@ self.addpkg2db("local", lp2) lp3 = pmpkg("pkg3") lp3.provides = ["imaginary"] +lp3.requiredby = [ "pkg1" ] self.addpkg2db("local", lp3) p = pmpkg("pkg2", "1.0-2") diff --git a/pactest/tests/upgrade059.py b/pactest/tests/upgrade059.py new file mode 100644 index 00000000..933e4e74 --- /dev/null +++ b/pactest/tests/upgrade059.py @@ -0,0 +1,28 @@ +self.description = "Upgrade packages which would break a multiple-depend" + +lp1 = pmpkg("pkg1") +lp1.depends = ["imaginary"] +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") +self.addpkg(p2) + +p3 = pmpkg("pkg3", "1.0-2") +self.addpkg(p3) + +self.args = "-U %s" % " ".join([p.filename() for p in p2, p3]) + +self.addrule("PACMAN_RETCODE=1") +self.addrule("PKG_EXIST=pkg1") +self.addrule("PKG_VERSION=pkg2|1.0-1") +self.addrule("PKG_VERSION=pkg3|1.0-1") diff --git a/pactest/tests/upgrade060.py b/pactest/tests/upgrade060.py new file mode 100644 index 00000000..dd78bba3 --- /dev/null +++ b/pactest/tests/upgrade060.py @@ -0,0 +1,22 @@ +self.description = "Try to upgrade two packages which would break deps" + +lp1 = pmpkg("pkg1") +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") +p1.depends = ["pkg2=1.0-1"] +self.addpkg(p1) + +p2 = pmpkg("pkg2", "1.1-1") +self.addpkg(p2) + +self.args = "-U %s" % " ".join([p.filename() for p in p1, p2]) + +self.addrule("PACMAN_RETCODE=1") +self.addrule("PKG_VERSION=pkg1|1.0-1") +self.addrule("PKG_VERSION=pkg2|1.0-1") diff --git a/pactest/tests/upgrade061.py b/pactest/tests/upgrade061.py new file mode 100644 index 00000000..0b1ed4e5 --- /dev/null +++ b/pactest/tests/upgrade061.py @@ -0,0 +1,23 @@ +self.description = "Try to upgrade two packages which would break deps" + +lp1 = pmpkg("pkg1", "1.0-1") +lp1.depends = ["imaginary"] +self.addpkg2db("local", lp1) + +lp2 = pmpkg("pkg2", "1.0-1") +lp2.requiredby = [ "pkg1" ] +lp2.provides = ["imaginary"] +self.addpkg2db("local", lp2) + +p1 = pmpkg("pkg1", "1.0-2") +p1.depends = ["imaginary"] +self.addpkg(p1) + +p2 = pmpkg("pkg2", "1.0-2") +self.addpkg(p2) + +self.args = "-U %s" % " ".join([p.filename() for p in p1, p2]) + +self.addrule("PACMAN_RETCODE=1") +self.addrule("PKG_VERSION=pkg1|1.0-1") +self.addrule("PKG_VERSION=pkg2|1.0-1") diff --git a/pactest/util.py b/pactest/util.py index 574a59be..ae203747 100755 --- a/pactest/util.py +++ b/pactest/util.py @@ -27,8 +27,8 @@ import stat # ALPM PM_ROOT = "/" PM_DBPATH = "var/lib/pacman" +PM_LOCK = "var/lib/pacman/db.lck" PM_CACHEDIR = "var/cache/pacman/pkg" -PM_LOCK = "/tmp/pacman.lck" PM_EXT_PKG = ".pkg.tar.gz" PM_EXT_DB = ".db.tar.gz" PM_PACNEW = ".pacnew" @@ -149,6 +149,8 @@ def mkdescfile(filename, pkg): data.append("replaces = %s" % i) for i in pkg.depends: data.append("depend = %s" % i) + for i in pkg.optdepends: + data.append("optdepend = %s" % i) for i in pkg.conflicts: data.append("conflict = %s" % i) for i in pkg.provides: |