index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
-rwxr-xr-x | test/pacman/pmdb.py | 10 | ||||
-rwxr-xr-x | test/pacman/pmpkg.py | 1 | ||||
-rw-r--r-- | test/pacman/tests/sign001.py | 9 | ||||
-rw-r--r-- | test/pacman/tests/sign002.py | 10 | ||||
-rw-r--r-- | test/pacman/tests/smoke004.py | 11 | ||||
-rwxr-xr-x | test/pacman/util.py | 3 | ||||
-rwxr-xr-x | test/util/vercmptest.sh | 2 |
diff --git a/test/pacman/pmdb.py b/test/pacman/pmdb.py index b31498a7..1af24ae9 100755 --- a/test/pacman/pmdb.py +++ b/test/pacman/pmdb.py @@ -89,6 +89,12 @@ class pmdb(object): def __str__(self): return "%s" % self.treename + def getverify(self): + for value in "Always","Never","Optional": + if value in self.treename: + return value + return "Never" + def getpkg(self, name): """ """ @@ -150,6 +156,8 @@ class pmdb(object): pkg.size = int(fd.readline().strip("\n")) elif line == "%MD5SUM%": pkg.md5sum = fd.readline().strip("\n") + elif line == "%PGPSIG%": + pkg.pgpsig = fd.readline().strip("\n") elif line == "%REPLACES%": pkg.replaces = _getsection(fd) elif line == "%DEPENDS%": @@ -241,6 +249,8 @@ class pmdb(object): data.append(_mksection("CSIZE", pkg.csize)) if pkg.md5sum: data.append(_mksection("MD5SUM", pkg.md5sum)) + if pkg.pgpsig: + data.append(_mksection("PGPSIG", pkg.pgpsig)) if data: data.append("") filename = os.path.join(path, "desc") diff --git a/test/pacman/pmpkg.py b/test/pacman/pmpkg.py index 73156ab2..ec51e5d4 100755 --- a/test/pacman/pmpkg.py +++ b/test/pacman/pmpkg.py @@ -47,6 +47,7 @@ class pmpkg(object): self.csize = 0 self.reason = 0 self.md5sum = "" # sync only + self.pgpsig = "" # sync only self.replaces = [] self.depends = [] self.optdepends = [] diff --git a/test/pacman/tests/sign001.py b/test/pacman/tests/sign001.py new file mode 100644 index 00000000..0ae417b7 --- /dev/null +++ b/test/pacman/tests/sign001.py @@ -0,0 +1,9 @@ +self.description = "Add a signature to a package DB" + +sp = pmpkg("pkg1") +sp.pgpsig = "asdfasdfsdfasdfsdafasdfsdfasd" +self.addpkg2db("sync+Always", sp) + +self.args = "-Ss" + +self.addrule("PACMAN_RETCODE=0") diff --git a/test/pacman/tests/sign002.py b/test/pacman/tests/sign002.py new file mode 100644 index 00000000..b55f331e --- /dev/null +++ b/test/pacman/tests/sign002.py @@ -0,0 +1,10 @@ +self.description = "Verify a signature in a sync DB (failure)" + +sp = pmpkg("pkg1") +sp.pgpsig = "iEYEABECAAYFAkhMOggACgkQXC5GoPU6du2WVQCffVxF8GKXJIY4juJBIw/ljLrQxygAnj2QlvsUd7MdFekLX18+Ov/xzgZ1" +self.addpkg2db("sync+Always", sp) + +self.args = "-S %s" % sp.name + +self.addrule("PACMAN_RETCODE=1") +self.addrule("!PKG_EXIST=pkg1") diff --git a/test/pacman/tests/smoke004.py b/test/pacman/tests/smoke004.py new file mode 100644 index 00000000..1f9b883d --- /dev/null +++ b/test/pacman/tests/smoke004.py @@ -0,0 +1,11 @@ +self.description = "Read a package DB with several PGP signatures" + +for i in range(1000): + sp = pmpkg("pkg%03d" % i) + sp.desc = "test description for package %d" % i + sp.pgpsig = "asdfasdfsdfasdfsdafasdfsdfasd" + self.addpkg2db("sync", sp) + +self.args = "-Ss" + +self.addrule("PACMAN_RETCODE=0") diff --git a/test/pacman/util.py b/test/pacman/util.py index b771a345..47255923 100755 --- a/test/pacman/util.py +++ b/test/pacman/util.py @@ -132,8 +132,9 @@ def mkcfgfile(filename, root, option, db): if key != "local": value = db[key] data.append("[%s]\n" \ + "VerifySig = %s\n" \ "Server = file://%s" \ - % (value.treename, + % (value.treename, value.getverify(), \ os.path.join(root, SYNCREPO, value.treename))) for optkey, optval in value.option.iteritems(): data.extend(["%s = %s" % (optkey, j) for j in optval]) diff --git a/test/util/vercmptest.sh b/test/util/vercmptest.sh index a9ed3b2a..0e799789 100755 --- a/test/util/vercmptest.sh +++ b/test/util/vercmptest.sh @@ -62,7 +62,7 @@ runtest() { # use first arg as our binary if specified [ -n "$1" ] && bin="$1" -if [ ! $(type -p "$bin") ]; then +if ! type -p "$bin"; then echo "vercmp binary ($bin) could not be located" exit 1 fi |