From ad84a572aac455dcd3de111dbf8d66c45b20573a Mon Sep 17 00:00:00 2001 From: Andrew Gregory Date: Tue, 19 Jan 2021 10:30:08 -0800 Subject: pmdb: add option to skip populating file:// server Populating a file:// Server prevents any manually registered HTTP servers from ever being used. Signed-off-by: Andrew Gregory Signed-off-by: Allan McRae --- test/pacman/pmdb.py | 1 + test/pacman/pmtest.py | 7 ++++--- test/pacman/util.py | 9 ++++----- 3 files changed, 9 insertions(+), 8 deletions(-) (limited to 'test') diff --git a/test/pacman/pmdb.py b/test/pacman/pmdb.py index 971e28eb..cae51b4e 100644 --- a/test/pacman/pmdb.py +++ b/test/pacman/pmdb.py @@ -54,6 +54,7 @@ class pmdb(object): self.root = root self.pkgs = [] self.option = {} + self.syncdir = True if self.treename == "local": self.dbdir = os.path.join(root, util.PM_DBPATH, treename) self.dbfile = None diff --git a/test/pacman/pmtest.py b/test/pacman/pmtest.py index ed6eab6a..8669f31d 100644 --- a/test/pacman/pmtest.py +++ b/test/pacman/pmtest.py @@ -167,10 +167,11 @@ class pmtest(object): vprint("\t%s" % os.path.join(util.PM_CACHEDIR, pkg.filename())) if self.cachepkgs: pkg.makepkg(cachedir) - else: + elif value.syncdir: pkg.makepkg(os.path.join(syncdir, value.treename)) - pkg.md5sum = util.getmd5sum(pkg.path) - pkg.csize = os.stat(pkg.path)[stat.ST_SIZE] + if pkg.path: + pkg.md5sum = util.getmd5sum(pkg.path) + pkg.csize = os.stat(pkg.path)[stat.ST_SIZE] # Creating sync database archives vprint(" Creating databases") diff --git a/test/pacman/util.py b/test/pacman/util.py index 1e0eb385..2957a020 100644 --- a/test/pacman/util.py +++ b/test/pacman/util.py @@ -122,11 +122,10 @@ def mkcfgfile(filename, root, option, db): for key in sorted(db.keys()): if key != "local": value = db[key] - data.append("[%s]\n" \ - "SigLevel = %s\n" \ - "Server = file://%s" \ - % (value.treename, value.getverify(), \ - os.path.join(root, SYNCREPO, value.treename))) + data.append("[%s]\n" % (value.treename)) + data.append("SigLevel = %s\n" % (value.getverify())) + if value.syncdir: + data.append("Server = file://%s" % (os.path.join(root, SYNCREPO, value.treename))) for optkey, optval in value.option.items(): data.extend(["%s = %s" % (optkey, j) for j in optval]) -- cgit v1.2.3-70-g09d2