diff options
Diffstat (limited to 'test')
-rwxr-xr-x | test/pacman/pmdb.py | 115 | ||||
-rwxr-xr-x | test/pacman/pmpkg.py | 7 | ||||
-rwxr-xr-x | test/pacman/pmrule.py | 10 | ||||
-rwxr-xr-x | test/pacman/pmtest.py | 21 | ||||
-rw-r--r-- | test/pacman/tests/database012.py | 8 | ||||
-rw-r--r-- | test/pacman/tests/epoch001.py | 12 | ||||
-rw-r--r-- | test/pacman/tests/epoch002.py | 12 | ||||
-rw-r--r-- | test/pacman/tests/epoch003.py | 12 | ||||
-rw-r--r-- | test/pacman/tests/epoch004.py | 16 | ||||
-rw-r--r-- | test/pacman/tests/epoch010.py | 12 | ||||
-rw-r--r-- | test/pacman/tests/epoch011.py | 12 | ||||
-rw-r--r-- | test/pacman/tests/epoch012.py | 13 | ||||
-rw-r--r-- | test/pacman/tests/ignore001.py | 2 | ||||
-rw-r--r-- | test/pacman/tests/pacman005.py | 8 | ||||
-rw-r--r-- | test/pacman/tests/remove002.py | 12 | ||||
-rw-r--r-- | test/pacman/tests/smoke002.py | 19 | ||||
-rw-r--r-- | test/pacman/tests/sync024.py | 23 | ||||
-rw-r--r-- | test/pacman/tests/sync136.py | 5 | ||||
-rw-r--r-- | test/pacman/tests/sync137.py | 3 | ||||
-rw-r--r-- | test/pacman/tests/sync407.py | 38 | ||||
-rw-r--r-- | test/pacman/tests/upgrade006.py | 18 | ||||
-rwxr-xr-x | test/pacman/util.py | 48 | ||||
-rwxr-xr-x | test/util/vercmptest.sh | 19 |
23 files changed, 281 insertions, 164 deletions
diff --git a/test/pacman/pmdb.py b/test/pacman/pmdb.py index 218e3b58..6329f23d 100755 --- a/test/pacman/pmdb.py +++ b/test/pacman/pmdb.py @@ -79,11 +79,15 @@ class pmdb: """Database object """ - def __init__(self, treename, dbdir): + def __init__(self, treename, root): self.treename = treename - self.dbdir = dbdir self.pkgs = [] self.option = {} + if self.treename == "local": + self.dbdir = os.path.join(root, PM_DBPATH, treename) + else: + self.dbdir = os.path.join(root, PM_SYNCDBPATH, treename) + self.dbfile = os.path.join(root, PM_SYNCDBPATH, treename + ".db") def __str__(self): return "%s" % self.treename @@ -99,7 +103,7 @@ class pmdb: """ """ - path = os.path.join(self.dbdir, self.treename) + path = self.dbdir if not os.path.isdir(path): return None @@ -152,9 +156,14 @@ class pmdb: pkg.md5sum = fd.readline().strip("\n") elif line == "%REPLACES%": pkg.replaces = _getsection(fd) - elif line == "%FORCE%": - fd.readline() - pkg.force = 1 + elif line == "%DEPENDS%": + pkg.depends = _getsection(fd) + elif line == "%OPTDEPENDS%": + pkg.optdepends = _getsection(fd) + elif line == "%CONFLICTS%": + pkg.conflicts = _getsection(fd) + elif line == "%PROVIDES%": + pkg.provides = _getsection(fd) fd.close() pkg.checksum["desc"] = getmd5sum(filename) pkg.mtime["desc"] = getmtime(filename) @@ -181,35 +190,6 @@ class pmdb: pkg.checksum["files"] = getmd5sum(filename) pkg.mtime["files"] = getmtime(filename) - # depends - filename = os.path.join(path, "depends") - if not os.path.isfile(filename): - print "invalid db entry found (depends missing) for pkg", pkgname - return None - fd = file(filename, "r") - while 1: - line = fd.readline() - if not line: - break - line = line.strip("\n") - if line == "%DEPENDS%": - pkg.depends = _getsection(fd) - elif line == "%OPTDEPENDS%": - pkg.optdepends = _getsection(fd) - elif line == "%CONFLICTS%": - pkg.conflicts = _getsection(fd) - elif line == "%PROVIDES%": - pkg.provides = _getsection(fd) - # TODO this was going to be changed, but isn't anymore - #elif line == "%REPLACES%": - # pkg.replaces = _getsection(fd) - #elif line == "%FORCE%": - # fd.readline() - # pkg.force = 1 - fd.close() - pkg.checksum["depends"] = getmd5sum(filename) - pkg.mtime["depends"] = getmtime(filename) - # install filename = os.path.join(path, "install") if os.path.isfile(filename): @@ -225,18 +205,15 @@ class pmdb: """ """ - 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()) + path = os.path.join(self.dbdir, pkg.fullname()) mkdir(path) # desc # for local db entries: name, version, desc, groups, url, license, # arch, builddate, installdate, packager, - # size, reason + # size, reason, depends, conflicts, provides # for sync entries: name, version, desc, groups, csize, md5sum, - # replaces, force + # replaces, force, depends, conflicts, provides data = [_mksection("NAME", pkg.name)] data.append(_mksection("VERSION", pkg.version)) if pkg.desc: @@ -251,6 +228,14 @@ class pmdb: data.append(_mksection("BUILDDATE", pkg.builddate)) if pkg.packager: data.append(_mksection("PACKAGER", pkg.packager)) + if pkg.depends: + data.append(_mksection("DEPENDS", pkg.depends)) + if pkg.optdepends: + data.append(_mksection("OPTDEPENDS", pkg.optdepends)) + if pkg.conflicts: + data.append(_mksection("CONFLICTS", pkg.conflicts)) + if pkg.provides: + data.append(_mksection("PROVIDES", pkg.provides)) if self.treename == "local": if pkg.url: data.append(_mksection("URL", pkg.url)) @@ -264,8 +249,6 @@ class pmdb: data.append(_mksection("FILENAME", pkg.filename())) if pkg.replaces: data.append(_mksection("REPLACES", pkg.replaces)) - if pkg.force: - data.append(_mksection("FORCE", "")) if pkg.csize: data.append(_mksection("CSIZE", pkg.csize)) if pkg.md5sum: @@ -293,30 +276,6 @@ class pmdb: pkg.checksum["files"] = getmd5sum(filename) pkg.mtime["files"] = getmtime(filename) - # depends - # for local db entries: depends, conflicts, provides - # for sync ones: depends, conflicts, provides - data = [] - if pkg.depends: - data.append(_mksection("DEPENDS", pkg.depends)) - if pkg.optdepends: - data.append(_mksection("OPTDEPENDS", pkg.optdepends)) - if pkg.conflicts: - data.append(_mksection("CONFLICTS", pkg.conflicts)) - if pkg.provides: - data.append(_mksection("PROVIDES", pkg.provides)) - #if self.treename != "local": - # if pkg.replaces: - # data.append(_mksection("REPLACES", pkg.replaces)) - # if pkg.force: - # data.append(_mksection("FORCE", "")) - if data: - data.append("") - filename = os.path.join(path, "depends") - mkfile(filename, "\n".join(data)) - pkg.checksum["depends"] = getmd5sum(filename) - pkg.mtime["depends"] = getmtime(filename) - # install if self.treename == "local": empty = 1 @@ -329,30 +288,22 @@ class pmdb: pkg.checksum["install"] = getmd5sum(filename) pkg.mtime["install"] = getmtime(filename) - def gensync(self, path): + def gensync(self): """ """ + if not self.dbfile: + return curdir = os.getcwd() - tmpdir = tempfile.mkdtemp() - os.chdir(tmpdir) - - for pkg in self.pkgs: - mkdescfile(pkg.fullname(), pkg) + os.chdir(self.dbdir) # Generate database archive - mkdir(path) - archive = os.path.join(path, "%s%s" % (self.treename, PM_EXT_DB)) - tar = tarfile.open(archive, "w:gz") - for root, dirs, files in os.walk('.'): - for d in dirs: - tar.add(os.path.join(root, d), recursive=False) - for f in files: - tar.add(os.path.join(root, f)) + tar = tarfile.open(self.dbfile, "w:gz") + for i in os.listdir("."): + tar.add(i) tar.close() os.chdir(curdir) - shutil.rmtree(tmpdir) def ispkgmodified(self, pkg): """ diff --git a/test/pacman/pmpkg.py b/test/pacman/pmpkg.py index 1d55175e..988f4c28 100755 --- a/test/pacman/pmpkg.py +++ b/test/pacman/pmpkg.py @@ -48,9 +48,7 @@ class pmpkg: self.csize = 0 self.reason = 0 self.md5sum = "" # sync only - self.replaces = [] # sync only (will be moved to depends) - self.force = 0 # sync only (will be moved to depends) - # depends + self.replaces = [] self.depends = [] self.optdepends = [] self.conflicts = [] @@ -69,13 +67,11 @@ class pmpkg: } self.checksum = { "desc": "", - "depends": "", "files": "", "install": "" } self.mtime = { "desc": (0, 0, 0), - "depends": (0, 0, 0), "files": (0, 0, 0), "install": (0, 0, 0) } @@ -84,7 +80,6 @@ class pmpkg: s = ["%s" % self.fullname()] s.append("description: %s" % self.desc) s.append("url: %s" % self.url) - s.append("depends: %s" % " ".join(self.depends)) s.append("files: %s" % " ".join(self.files)) s.append("reason: %d" % self.reason) return "\n".join(s) diff --git a/test/pacman/pmrule.py b/test/pacman/pmrule.py index e7c9c44f..89ae3f49 100755 --- a/test/pacman/pmrule.py +++ b/test/pacman/pmrule.py @@ -29,7 +29,9 @@ class pmrule: self.result = 0 def __str__(self): - return "rule = %s" % self.rule + if len(self.rule) <= 40: + return self.rule + return self.rule[:37] + '...' def check(self, root, retcode, localdb, files): """ @@ -76,6 +78,9 @@ class pmrule: elif case == "VERSION": if value != newpkg.version: success = 0 + elif case == "DESC": + if value != newpkg.desc: + success = 0 elif case == "GROUPS": if not value in newpkg.groups: success = 0 @@ -153,7 +158,4 @@ class pmrule: self.result = success return success - -if __name__ != "__main__": - rule = pmrule("PKG_EXIST=dummy") # vim: set ts=4 sw=4 et: diff --git a/test/pacman/pmtest.py b/test/pacman/pmtest.py index f3026f29..c70e41ae 100755 --- a/test/pacman/pmtest.py +++ b/test/pacman/pmtest.py @@ -47,7 +47,7 @@ class pmtest: """ """ if not treename in self.db: - self.db[treename] = pmdb.pmdb(treename, os.path.join(self.root, PM_DBPATH)) + self.db[treename] = pmdb.pmdb(treename, self.root) self.db[treename].pkgs.append(pkg) def addpkg(self, pkg): @@ -73,7 +73,7 @@ class pmtest: self.args = "" self.retcode = 0 self.db = { - "local": pmdb.pmdb("local", os.path.join(self.root, PM_DBPATH)) + "local": pmdb.pmdb("local", self.root) } self.localpkgs = [] self.filesystem = [] @@ -152,9 +152,11 @@ class pmtest: vprint(" Creating sync database archives") for key, value in self.db.iteritems(): if key == "local": continue - archive = value.treename + PM_EXT_DB - vprint("\t" + os.path.join(SYNCREPO, archive)) - value.gensync(os.path.join(syncdir, value.treename)) + vprint("\t" + value.treename) + value.gensync() + serverpath = os.path.join(syncdir, value.treename) + mkdir(serverpath) + shutil.copy(value.dbfile, serverpath) # Filesystem vprint(" Populating file system") @@ -200,7 +202,7 @@ class pmtest: if pacman["gdb"]: cmd.append("libtool execute gdb --args") if pacman["valgrind"]: - cmd.append("valgrind -q --tool=memcheck --leak-check=full --show-reachable=yes") + cmd.append("valgrind -q --tool=memcheck --leak-check=full --show-reachable=yes --suppressions=%s/valgrind.supp" % os.getcwd()) cmd.append("\"%s\" --config=\"%s\" --root=\"%s\" --dbpath=\"%s\" --cachedir=\"%s\"" \ % (pacman["bin"], os.path.join(self.root, PACCONF), @@ -258,11 +260,6 @@ class pmtest: self.result["fail"] += 1 else: msg = "SKIP" - print "\t[%s] %s" % (msg, i.rule) - i.result = success - - -if __name__ == "__main__": - pass + print "\t[%s] %s" % (msg, i) # vim: set ts=4 sw=4 et: diff --git a/test/pacman/tests/database012.py b/test/pacman/tests/database012.py index a1f86980..52813ec6 100644 --- a/test/pacman/tests/database012.py +++ b/test/pacman/tests/database012.py @@ -21,11 +21,5 @@ self.addrule("PACMAN_RETCODE=0") self.addrule("PKG_EXIST=dummy") self.addrule("PKG_VERSION=dummy|2.0-1") for f in lp.files: - self.addrule("!FILE_EXIST=%s" % f) -# TODO: I honestly think the above should NOT delete the original files, it -# should upgrade the DB entry without touching anything on the file system. -# E.g. this test should be the same as: -# pacman -R --dbonly dummy && pacman -U --dbonly dummy.pkg.tar.gz -#for f in lp.files: -# self.addrule("FILE_EXIST=%s" % f) + self.addrule("FILE_EXIST=%s" % f) self.addrule("!FILE_EXIST=bin/dummy2") diff --git a/test/pacman/tests/epoch001.py b/test/pacman/tests/epoch001.py new file mode 100644 index 00000000..ac6c41a6 --- /dev/null +++ b/test/pacman/tests/epoch001.py @@ -0,0 +1,12 @@ +self.description = "Sysupgrade with a sync package having higher epoch" + +sp = pmpkg("dummy", "1:1.0-1") +self.addpkg2db("sync", sp) + +lp = pmpkg("dummy", "1.1-1") +self.addpkg2db("local", lp) + +self.args = "-Su" + +self.addrule("PACMAN_RETCODE=0") +self.addrule("PKG_VERSION=dummy|1:1.0-1") diff --git a/test/pacman/tests/epoch002.py b/test/pacman/tests/epoch002.py new file mode 100644 index 00000000..8ca4afc6 --- /dev/null +++ b/test/pacman/tests/epoch002.py @@ -0,0 +1,12 @@ +self.description = "Sysupgrade with an epoch and ignore on same package" + +lp = pmpkg("dummy", "1.0-1") +self.addpkg2db("local", lp) + +sp = pmpkg("dummy", "1:1.0-2") +self.addpkg2db("sync", sp) + +self.args = "-Su --ignore %s" % lp.name + +self.addrule("PACMAN_RETCODE=0") +self.addrule("PKG_VERSION=dummy|1.0-1") diff --git a/test/pacman/tests/epoch003.py b/test/pacman/tests/epoch003.py new file mode 100644 index 00000000..ac395e30 --- /dev/null +++ b/test/pacman/tests/epoch003.py @@ -0,0 +1,12 @@ +self.description = "Sysupgrade with an epoch package overriding a force package" + +sp = pmpkg("dummy", "2:1.4-1") +self.addpkg2db("sync", sp) + +lp = pmpkg("dummy", "1:2.0-1") +self.addpkg2db("local", lp) + +self.args = "-Su" + +self.addrule("PACMAN_RETCODE=0") +self.addrule("PKG_VERSION=dummy|2:1.4-1") diff --git a/test/pacman/tests/epoch004.py b/test/pacman/tests/epoch004.py new file mode 100644 index 00000000..74b00c2b --- /dev/null +++ b/test/pacman/tests/epoch004.py @@ -0,0 +1,16 @@ +self.description = "Sysupgrade with same version, different epochs" + +sp = pmpkg("dummy", "2:2.0-1") +sp.files = ["bin/dummynew"] +self.addpkg2db("sync", sp) + +lp = pmpkg("dummy", "1:2.0-1") +lp.files = ["bin/dummyold"] +self.addpkg2db("local", lp) + +self.args = "-Su" + +self.addrule("PACMAN_RETCODE=0") +self.addrule("PKG_VERSION=dummy|2:2.0-1") +self.addrule("FILE_EXIST=bin/dummynew") +self.addrule("!FILE_EXIST=bin/dummyold") diff --git a/test/pacman/tests/epoch010.py b/test/pacman/tests/epoch010.py new file mode 100644 index 00000000..03bba273 --- /dev/null +++ b/test/pacman/tests/epoch010.py @@ -0,0 +1,12 @@ +self.description = "usbutils case study: force in new package" + +sp = pmpkg("usbutils", "1:001-1") +self.addpkg2db("sync", sp) + +lp = pmpkg("usbutils", "0.91-4") +self.addpkg2db("local", lp) + +self.args = "-Su" + +self.addrule("PACMAN_RETCODE=0") +self.addrule("PKG_VERSION=usbutils|1:001-1") diff --git a/test/pacman/tests/epoch011.py b/test/pacman/tests/epoch011.py new file mode 100644 index 00000000..bc5ee619 --- /dev/null +++ b/test/pacman/tests/epoch011.py @@ -0,0 +1,12 @@ +self.description = "usbutils case study: force stays, epoch now in local db" + +sp = pmpkg("usbutils", "1:002-1") +self.addpkg2db("sync", sp) + +lp = pmpkg("usbutils", "1:001-1") +self.addpkg2db("local", lp) + +self.args = "-Su" + +self.addrule("PACMAN_RETCODE=0") +self.addrule("PKG_VERSION=usbutils|1:002-1") diff --git a/test/pacman/tests/epoch012.py b/test/pacman/tests/epoch012.py new file mode 100644 index 00000000..2a7a7ac2 --- /dev/null +++ b/test/pacman/tests/epoch012.py @@ -0,0 +1,13 @@ +self.description = "usbutils case study: maintainer screws up and removes force" + +sp = pmpkg("usbutils", "003-1") +self.addpkg2db("sync", sp) + +lp = pmpkg("usbutils", "1:002-1") +self.addpkg2db("local", lp) + +self.args = "-Su" + +self.addrule("PACMAN_RETCODE=0") +# remember, this is how we have to handle this- 003 will not be installed +self.addrule("PKG_VERSION=usbutils|1:002-1") diff --git a/test/pacman/tests/ignore001.py b/test/pacman/tests/ignore001.py index bb3fa59a..e9764bc9 100644 --- a/test/pacman/tests/ignore001.py +++ b/test/pacman/tests/ignore001.py @@ -9,7 +9,7 @@ self.addpkg2db("local", package2) package2up = pmpkg("package2", "2.0-1") self.addpkg2db("sync", package2up) -self.option["IgnorePkg"] = ["irrelavent"] +self.option["IgnorePkg"] = ["irrelevant"] self.args = "-Su" self.addrule("PACMAN_RETCODE=0") diff --git a/test/pacman/tests/pacman005.py b/test/pacman/tests/pacman005.py new file mode 100644 index 00000000..bb21ad4f --- /dev/null +++ b/test/pacman/tests/pacman005.py @@ -0,0 +1,8 @@ +self.description = "Test invalid combination of command line options (-Qy)" + +p = pmpkg("foobar") +self.addpkg2db("local", p) + +self.args = "-Qy" + +self.addrule("PACMAN_RETCODE=1") diff --git a/test/pacman/tests/remove002.py b/test/pacman/tests/remove002.py new file mode 100644 index 00000000..1deffb0d --- /dev/null +++ b/test/pacman/tests/remove002.py @@ -0,0 +1,12 @@ +self.description = "Remove a package with several files" + +p = pmpkg("foo") +p.files = ["usr/share/file_%d" % n for n in range(1000)] +self.addpkg2db("local", p) + +self.args = "-R %s" % p.name + +self.addrule("PACMAN_RETCODE=0") +self.addrule("!PKG_EXIST=foo") +self.addrule("!FILE_EXIST=usr/share/file_0") +self.addrule("!FILE_EXIST=usr/share/file_999") diff --git a/test/pacman/tests/smoke002.py b/test/pacman/tests/smoke002.py new file mode 100644 index 00000000..44f2d0ec --- /dev/null +++ b/test/pacman/tests/smoke002.py @@ -0,0 +1,19 @@ +self.description = "Install packages with huge descriptions" + +p1 = pmpkg("pkg1") +p1.desc = 'A' * 500 * 1024 +self.addpkg(p1) + +p2 = pmpkg("pkg2") +p2.desc = 'A' * 600 * 1024 +self.addpkg(p2) + +self.args = "-U %s %s" % (p1.filename(), p2.filename()) + +# Note that the current cutoff on line length is 512K, so the first package +# will succeed while the second one will fail to record the description. +self.addrule("PACMAN_RETCODE=0") +self.addrule("PKG_EXIST=pkg1") +self.addrule("PKG_DESC=pkg1|%s" % p1.desc) +self.addrule("PKG_EXIST=pkg1") +self.addrule("!PKG_DESC=pkg1|%s" % p2.desc) diff --git a/test/pacman/tests/sync024.py b/test/pacman/tests/sync024.py new file mode 100644 index 00000000..6d1192f0 --- /dev/null +++ b/test/pacman/tests/sync024.py @@ -0,0 +1,23 @@ +self.description = "Install a group from a sync db repo/group syntax" + +sp1 = pmpkg("pkg1") +sp2 = pmpkg("pkg2") +sp3 = pmpkg("pkg3") +newp1 = pmpkg("pkg1", "1.2-1") + +for p in sp1, sp2, sp3, newp1: + setattr(p, "groups", ["grp"]) + +self.addpkg2db("testing", newp1); + +for p in sp1, sp2, sp3: + self.addpkg2db("sync", p); + +self.args = "-S testing/grp" + +self.addrule("PACMAN_RETCODE=0") +for p in sp2, sp3: + self.addrule("!PKG_EXIST=%s" % p.name) +self.addrule("PKG_EXIST=%s" % newp1.name) +# The newer version should still be installed +self.addrule("PKG_VERSION=pkg1|1.2-1") diff --git a/test/pacman/tests/sync136.py b/test/pacman/tests/sync136.py index 58d08eb0..b31aae2c 100644 --- a/test/pacman/tests/sync136.py +++ b/test/pacman/tests/sync136.py @@ -1,7 +1,6 @@ self.description = "Sysupgrade with a sync package forcing a downgrade" -sp = pmpkg("dummy", "1.0-1") -sp.force = 1 +sp = pmpkg("dummy", "1:1.0-1") self.addpkg2db("sync", sp) @@ -12,4 +11,4 @@ self.addpkg2db("local", lp) self.args = "-Su" self.addrule("PACMAN_RETCODE=0") -self.addrule("PKG_VERSION=dummy|1.0-1") +self.addrule("PKG_VERSION=dummy|1:1.0-1") diff --git a/test/pacman/tests/sync137.py b/test/pacman/tests/sync137.py index 94caca70..d76ac49d 100644 --- a/test/pacman/tests/sync137.py +++ b/test/pacman/tests/sync137.py @@ -4,8 +4,7 @@ lp = pmpkg("dummy", "1.0-1") self.addpkg2db("local", lp) -sp = pmpkg("dummy", "1.0-2") -sp.force = 1 +sp = pmpkg("dummy", "1:1.0-2") self.addpkg2db("sync", sp) self.args = "-Su --ignore %s" % lp.name diff --git a/test/pacman/tests/sync407.py b/test/pacman/tests/sync407.py new file mode 100644 index 00000000..a2d30299 --- /dev/null +++ b/test/pacman/tests/sync407.py @@ -0,0 +1,38 @@ +self.description = "FS#7524, versioned dependency resolving with conflict" + +sp1 = pmpkg("compiz-git", "20070626-1") +sp1.depends = ["cairo"] +sp1.groups = ["compiz-fusion"] +self.addpkg2db("sync", sp1) + +sp2 = pmpkg("ccsm-git", "20070626-1") +sp2.depends = ["pygtk"] +sp2.groups = ["compiz-fusion"] +self.addpkg2db("sync", sp2) + +sp3 = pmpkg("pygtk", "2.22.0-1") +sp3.depends = ["pycairo"] +self.addpkg2db("sync", sp3) + +sp4 = pmpkg("pycairo", "1.4.0-2") +sp4.depends = ["cairo>=1.4.6-2"] +self.addpkg2db("sync", sp4) + +sp5 = pmpkg("cairo", "1.4.6-2") +self.addpkg2db("sync", sp5) + +lp1 = pmpkg("cairo-lcd", "1.4.6-1") +lp1.provides = "cairo" +lp1.conflicts = ["cairo"] +self.addpkg2db("local", lp1) + +self.args = "-S compiz-fusion" + +self.addrule("PACMAN_RETCODE=1") +self.addrule("PKG_EXIST=cairo-lcd") +self.addrule("PKG_VERSION=cairo-lcd|1.4.6-1") +self.addrule("!PKG_EXIST=cairo") +self.addrule("!PKG_EXIST=compiz-git") +self.addrule("!PKG_EXIST=ccsm-git") +self.addrule("!PKG_EXIST=pygtk") +self.addrule("!PKG_EXIST=pycairo") diff --git a/test/pacman/tests/upgrade006.py b/test/pacman/tests/upgrade006.py new file mode 100644 index 00000000..5e5173b5 --- /dev/null +++ b/test/pacman/tests/upgrade006.py @@ -0,0 +1,18 @@ +self.description = "Upgrade a package with several files" + +lp = pmpkg("dummy") +lp.files = ["usr/share/file_%d" % n for n in range(250, 750)] +self.addpkg2db("local", lp) + +p = pmpkg("dummy", "1.1-1") +p.files = ["usr/share/file_%d" % n for n in range(600, 1000)] +self.addpkg(p) + +self.args = "-U %s" % p.filename() + +self.addrule("PACMAN_RETCODE=0") +self.addrule("PKG_VERSION=dummy|1.1-1") +self.addrule("!FILE_EXIST=usr/share/file_250") +self.addrule("!FILE_EXIST=usr/share/file_599") +self.addrule("FILE_EXIST=usr/share/file_600") +self.addrule("FILE_EXIST=usr/share/file_999") diff --git a/test/pacman/util.py b/test/pacman/util.py index e01a3b8f..f77da52b 100755 --- a/test/pacman/util.py +++ b/test/pacman/util.py @@ -25,10 +25,10 @@ import stat # ALPM PM_ROOT = "/" PM_DBPATH = "var/lib/pacman" +PM_SYNCDBPATH = "var/lib/pacman/sync" PM_LOCK = "var/lib/pacman/db.lck" PM_CACHEDIR = "var/cache/pacman/pkg" PM_EXT_PKG = ".pkg.tar.gz" -PM_EXT_DB = ".db.tar.gz" PM_PACNEW = ".pacnew" PM_PACORIG = ".pacorig" PM_PACSAVE = ".pacsave" @@ -113,52 +113,6 @@ def mkfile(name, data = ""): if setperms: os.chmod(filename, int(perms, 8)) -def mkdescfile(filename, pkg): - """ - """ - - data = [] - - # desc - #data.append("pkgname = %s" % pkg.name) - #data.append("pkgver = %s" % pkg.version) - if pkg.desc: - data.append("pkgdesc = %s" % pkg.desc) - if pkg.url: - data.append("url = %s" % pkg.url) - if pkg.builddate: - data.append("builddate = %s" % pkg.builddate) - if pkg.packager: - data.append("packager = %s" % pkg.packager) - if pkg.size: - data.append("size = %s" % pkg.size) - if pkg.arch: - data.append("arch = %s" % pkg.arch) - for i in pkg.groups: - data.append("group = %s" % i) - for i in pkg.license: - data.append("license = %s" % i) - if pkg.md5sum: - data.append("md5sum = %s" % pkg.md5sum) - - # depends - for i in pkg.replaces: - 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: - data.append("provides = %s" % i) - for i in pkg.backup: - data.append("backup = %s" % i) - if pkg.force: - data.append("force = 1") - - mkfile(filename, "\n".join(data)) - def mkinstallfile(filename, install): """ """ diff --git a/test/util/vercmptest.sh b/test/util/vercmptest.sh index fca06578..a9ed3b2a 100755 --- a/test/util/vercmptest.sh +++ b/test/util/vercmptest.sh @@ -118,6 +118,25 @@ runtest 1.5.1 1.5.b 1 runtest 1.5.b-1 1.5.b 0 runtest 1.5-1 1.5.b -1 +# epoch included version comparisons +runtest 0:1.0 0:1.0 0 +runtest 0:1.0 0:1.1 -1 +runtest 1:1.0 0:1.0 1 +runtest 1:1.0 0:1.1 1 +runtest 1:1.0 2:1.1 -1 + +# epoch + sometimes present pkgrel +runtest 1:1.0 0:1.0-1 1 +runtest 1:1.0-1 0:1.1-1 1 + +# epoch included on one version +runtest 0:1.0 1.0 0 +runtest 0:1.0 1.1 -1 +runtest 0:1.1 1.0 1 +runtest 1:1.0 1.0 1 +runtest 1:1.0 1.1 1 +runtest 1:1.1 1.1 1 + #END TESTS echo |