From 8f3b485517a401ece348a1c5166d951ec4a8a28f Mon Sep 17 00:00:00 2001 From: Allan McRae Date: Sat, 30 Oct 2010 16:01:30 +1000 Subject: Update pactest suite for change in db structure Merging desc and depends files in sync and local db. Signed-off-by: Allan McRae Signed-off-by: Dan McGee --- test/pacman/pmdb.py | 62 +++++++++++++++------------------------------------- test/pacman/pmpkg.py | 4 ---- 2 files changed, 18 insertions(+), 48 deletions(-) diff --git a/test/pacman/pmdb.py b/test/pacman/pmdb.py index af5525cf..7f798192 100755 --- a/test/pacman/pmdb.py +++ b/test/pacman/pmdb.py @@ -163,6 +163,14 @@ class pmdb: 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) @@ -189,29 +197,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) - fd.close() - pkg.checksum["depends"] = getmd5sum(filename) - pkg.mtime["depends"] = getmtime(filename) - # install filename = os.path.join(path, "install") if os.path.isfile(filename): @@ -233,9 +218,9 @@ class pmdb: # 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: @@ -250,6 +235,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)) @@ -297,25 +290,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 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 diff --git a/test/pacman/pmpkg.py b/test/pacman/pmpkg.py index aaee28bc..9ce09783 100755 --- a/test/pacman/pmpkg.py +++ b/test/pacman/pmpkg.py @@ -51,7 +51,6 @@ class pmpkg: self.replaces = [] self.force = 0 self.epoch = 0 - # depends self.depends = [] self.optdepends = [] self.conflicts = [] @@ -70,13 +69,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) } @@ -85,7 +82,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) -- cgit v1.2.3-70-g09d2