[pacman-dev] [PATCH 5/7] pmdb: add option to skip populating file:// server

Andrew Gregory andrew.gregory.8 at gmail.com
Tue Jan 19 18:30:08 UTC 2021


Populating a file:// Server prevents any manually registered HTTP
servers from ever being used.

Signed-off-by: Andrew Gregory <andrew.gregory.8 at gmail.com>
---
 test/pacman/pmdb.py   | 1 +
 test/pacman/pmtest.py | 7 ++++---
 test/pacman/util.py   | 9 ++++-----
 3 files changed, 9 insertions(+), 8 deletions(-)

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 @@ def __init__(self, treename, root):
         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 @@ def generate(self, pacman):
                 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])
 
-- 
2.30.0


More information about the pacman-dev mailing list