summaryrefslogtreecommitdiff
path: root/pactest
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2008-02-07 20:16:16 -0600
committerDan McGee <dan@archlinux.org>2008-02-07 20:16:16 -0600
commitbfc024eab3a1d26ba37620175be815cb2eb59606 (patch)
tree96c1c3d89b0e523364b6b000ef02105ebbd0923e /pactest
parent77c3cf9790472592902183354ea5481cffc01f58 (diff)
parent14ee1be1ef21e09a84f01dc9623e8513218709d4 (diff)
Merge branch 'maint'
Diffstat (limited to 'pactest')
-rwxr-xr-xpactest/pmdb.py13
-rw-r--r--pactest/tests/upgrade045.py16
-rwxr-xr-xpactest/util.py6
3 files changed, 33 insertions, 2 deletions
diff --git a/pactest/pmdb.py b/pactest/pmdb.py
index cc852c2a..af392000 100755
--- a/pactest/pmdb.py
+++ b/pactest/pmdb.py
@@ -119,7 +119,10 @@ class pmdb:
# desc
filename = os.path.join(path, "desc")
- fd = file(filename, "r")
+ if not os.path.isfile(filename):
+ print "invalid db entry found (desc missing) for pkg", pkgname
+ return None
+ fd = open(filename, "r")
while 1:
line = fd.readline()
if not line:
@@ -158,7 +161,10 @@ class pmdb:
# files
filename = os.path.join(path, "files")
- fd = file(filename, "r")
+ if not os.path.isfile(filename):
+ print "invalid db entry found (files missing) for pkg", pkgname
+ return None
+ fd = open(filename, "r")
while 1:
line = fd.readline()
if not line:
@@ -177,6 +183,9 @@ class pmdb:
# depends
filename = os.path.join(path, "depends")
+ if not os.path.isfile(filename):
+ print "invalid db entry found (depends missing) for pkg", pkgname
+ return None
fd = file(filename, "r")
while 1:
line = fd.readline()
diff --git a/pactest/tests/upgrade045.py b/pactest/tests/upgrade045.py
new file mode 100644
index 00000000..b2f81274
--- /dev/null
+++ b/pactest/tests/upgrade045.py
@@ -0,0 +1,16 @@
+self.description = "FS#9235"
+
+lp = pmpkg("foo")
+lp.files = ["etc/foo.cfg -> etc/foo.cfg"]
+lp.backup = ["etc/foo.cfg"]
+self.addpkg2db("local", lp)
+
+p1 = pmpkg("foo", "1.0-2")
+p1.files = ["etc/foo.cfg*"]
+p1.backup = ["etc/foo.cfg"]
+self.addpkg(p1)
+
+self.args = "-U %s" % p1.filename()
+
+self.addrule("PKG_VERSION=foo|1.0-2")
+self.addrule("FILE_EXIST=etc/foo.cfg")
diff --git a/pactest/util.py b/pactest/util.py
index b24bfdcf..2a6ff4e7 100755
--- a/pactest/util.py
+++ b/pactest/util.py
@@ -196,6 +196,9 @@ def mkcfgfile(filename, root, option, db):
def getmd5sum(filename):
"""
"""
+ if not os.path.isfile(filename):
+ print "file %s does not exist!" % filename
+ return ""
fd = open(filename, "rb")
checksum = md5.new()
while 1:
@@ -223,6 +226,9 @@ def mkmd5sum(data):
def getmtime(filename):
"""
"""
+ if not os.path.exists(filename):
+ print "path %s does not exist!" % filename
+ return 0, 0, 0
st = os.stat(filename)
return st[stat.ST_ATIME], st[stat.ST_MTIME], st[stat.ST_CTIME]