diff options
author | Dan McGee <dan@archlinux.org> | 2011-01-29 18:25:56 +0100 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-01-31 16:37:20 +0100 |
commit | 2d5ec02d7c82bdef1a9fb0565dcb67564968a8c0 (patch) | |
tree | 901eec5061e18339715393126d9e601a3b9c9f36 /test/pacman/pmtest.py | |
parent | ed1aef7bc5caac95358c4827f162a845230051a2 (diff) | |
download | pacman-2d5ec02d7c82bdef1a9fb0565dcb67564968a8c0.tar.gz pacman-2d5ec02d7c82bdef1a9fb0565dcb67564968a8c0.tar.xz |
pactest: allow checking for cache file existence
This will allow some tests to be added for cache cleaning.
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'test/pacman/pmtest.py')
-rwxr-xr-x | test/pacman/pmtest.py | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/test/pacman/pmtest.py b/test/pacman/pmtest.py index 958e2630..82dfda6d 100755 --- a/test/pacman/pmtest.py +++ b/test/pacman/pmtest.py @@ -55,6 +55,22 @@ class pmtest(object): """ self.localpkgs.append(pkg) + def findpkg(self, name, version, allow_local=False): + """Find a package object matching the name and version specified in + either sync databases or the local package collection. The local database + is allowed to match if allow_local is True.""" + for db in self.db.itervalues(): + if db.treename == "local" and not allow_local: + continue + pkg = db.getpkg(name) + if pkg and pkg.version == version: + return pkg + for pkg in self.localpkgs: + if pkg.name == name and pkg.version == version: + return pkg + + return None + def addrule(self, rulename): """ """ @@ -76,6 +92,7 @@ class pmtest(object): "local": pmdb.pmdb("local", self.root) } self.localpkgs = [] + self.createlocalpkgs = False self.filesystem = [] self.description = "" @@ -131,7 +148,7 @@ class pmtest(object): vprint("\t%s" % os.path.join(util.TMPDIR, pkg.filename())) pkg.makepkg(tmpdir) for key, value in self.db.iteritems(): - if key == "local": + if key == "local" and not self.createlocalpkgs: continue for pkg in value.pkgs: vprint("\t%s" % os.path.join(util.PM_CACHEDIR, pkg.filename())) |