summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2010-05-17 18:47:30 -0500
committerDan McGee <dan@archlinux.org>2010-05-17 18:47:30 -0500
commita6ace987a913852af30bb5e3ae6bf145dc9c6157 (patch)
treebab1c477eda951edf1c9ea51103ae3b0f23060f2
parent3a85f83840888cbab09f2413fa3eb7c3b71055e5 (diff)
downloadpacman-a6ace987a913852af30bb5e3ae6bf145dc9c6157.tar.xz
Add some machinery to test the Include directive
After the previous patch that re-enabled its use outside of sync repository sections which we had unintentionally disabled. Signed-off-by: Dan McGee <dan@archlinux.org>
-rwxr-xr-xpactest/pmdb.py1
-rw-r--r--pactest/tests/config001.py17
-rw-r--r--pactest/tests/config002.py12
-rwxr-xr-xpactest/util.py13
4 files changed, 38 insertions, 5 deletions
diff --git a/pactest/pmdb.py b/pactest/pmdb.py
index cfa146bd..8cb1b832 100755
--- a/pactest/pmdb.py
+++ b/pactest/pmdb.py
@@ -85,6 +85,7 @@ class pmdb:
self.treename = treename
self.dbdir = dbdir
self.pkgs = []
+ self.option = {}
def __str__(self):
return "%s" % self.treename
diff --git a/pactest/tests/config001.py b/pactest/tests/config001.py
new file mode 100644
index 00000000..3411433f
--- /dev/null
+++ b/pactest/tests/config001.py
@@ -0,0 +1,17 @@
+self.description = "Quick check for Include being parsed in [options]"
+
+self.option['Include'] = ['/dev/null']
+
+p = pmpkg("foobar")
+p.files = ["bin/foobar"]
+p.desc = "test description"
+p.groups = ["foo"]
+p.url = "http://www.archlinux.org"
+p.license = "GPL2"
+p.arch = "i686"
+
+self.addpkg2db("local", p)
+
+self.args = "-Qi %s" % p.name
+
+self.addrule("PACMAN_RETCODE=0")
diff --git a/pactest/tests/config002.py b/pactest/tests/config002.py
new file mode 100644
index 00000000..8efe5a04
--- /dev/null
+++ b/pactest/tests/config002.py
@@ -0,0 +1,12 @@
+self.description = "Quick check for Include being parsed in [db]"
+
+sp = pmpkg("dummy")
+sp.files = ["bin/dummy",
+ "usr/man/man1/dummy.1"]
+self.addpkg2db("sync", sp)
+
+self.db['sync'].option['Include'] = ['/dev/null']
+
+self.args = "-Si %s" % sp.name
+
+self.addrule("PACMAN_RETCODE=0")
diff --git a/pactest/util.py b/pactest/util.py
index da6d44e3..e01a3b8f 100755
--- a/pactest/util.py
+++ b/pactest/util.py
@@ -178,11 +178,14 @@ def mkcfgfile(filename, root, option, db):
data.extend(["%s = %s" % (key, j) for j in value])
# Repositories
- data.extend(["[%s]\n" \
- "Server = file://%s\n" \
- % (value.treename, \
- os.path.join(root, SYNCREPO, value.treename)) \
- for key, value in db.iteritems() if key != "local"])
+ for key, value in db.iteritems():
+ if key != "local":
+ data.append("[%s]\n" \
+ "Server = file://%s" \
+ % (value.treename,
+ os.path.join(root, SYNCREPO, value.treename)))
+ for optkey, optval in value.option.iteritems():
+ data.extend(["%s = %s" % (optkey, j) for j in optval])
mkfile(os.path.join(root, filename), "\n".join(data))