summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2010-10-08 09:53:10 -0500
committerDan McGee <dan@archlinux.org>2010-10-13 23:29:26 -0500
commit8aa7ed5a7e82eaa40c2ee68271226787710f8f08 (patch)
tree854f70ae52b9990905d8b2dd801b5961b23080b8 /test
parent6f37ba61ed79876b23d3328185186d9ac0c3332c (diff)
downloadpacman-8aa7ed5a7e82eaa40c2ee68271226787710f8f08.tar.xz
Add epoch support to pactest
This adds epoch support to pactest, while still producing packages and database entries the same way makepkg and repo-add currently do in a backward compatible fashion (still including the 'force' option). Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'test')
-rwxr-xr-xtest/pacman/pmdb.py18
-rwxr-xr-xtest/pacman/pmpkg.py5
-rwxr-xr-xtest/pacman/util.py4
3 files changed, 14 insertions, 13 deletions
diff --git a/test/pacman/pmdb.py b/test/pacman/pmdb.py
index efd0cc27..af5525cf 100755
--- a/test/pacman/pmdb.py
+++ b/test/pacman/pmdb.py
@@ -158,6 +158,8 @@ class pmdb:
pkg.md5sum = fd.readline().strip("\n")
elif line == "%REPLACES%":
pkg.replaces = _getsection(fd)
+ elif line == "%EPOCH%":
+ pkg.epoch = int(fd.readline().strip("\n"))
elif line == "%FORCE%":
fd.readline()
pkg.force = 1
@@ -206,12 +208,6 @@ class pmdb:
pkg.conflicts = _getsection(fd)
elif line == "%PROVIDES%":
pkg.provides = _getsection(fd)
- # TODO this was going to be changed, but isn't anymore
- #elif line == "%REPLACES%":
- # pkg.replaces = _getsection(fd)
- #elif line == "%FORCE%":
- # fd.readline()
- # pkg.force = 1
fd.close()
pkg.checksum["depends"] = getmd5sum(filename)
pkg.mtime["depends"] = getmtime(filename)
@@ -267,6 +263,11 @@ class pmdb:
data.append(_mksection("FILENAME", pkg.filename()))
if pkg.replaces:
data.append(_mksection("REPLACES", pkg.replaces))
+ if pkg.epoch:
+ data.append(_mksection("EPOCH", pkg.epoch))
+ # for backward compatibility
+ if not pkg.force:
+ data.append(_mksection("FORCE", ""))
if pkg.force:
data.append(_mksection("FORCE", ""))
if pkg.csize:
@@ -308,11 +309,6 @@ class pmdb:
data.append(_mksection("CONFLICTS", pkg.conflicts))
if pkg.provides:
data.append(_mksection("PROVIDES", pkg.provides))
- #if self.treename != "local":
- # if pkg.replaces:
- # data.append(_mksection("REPLACES", pkg.replaces))
- # if pkg.force:
- # data.append(_mksection("FORCE", ""))
if data:
data.append("")
filename = os.path.join(path, "depends")
diff --git a/test/pacman/pmpkg.py b/test/pacman/pmpkg.py
index 1d55175e..aaee28bc 100755
--- a/test/pacman/pmpkg.py
+++ b/test/pacman/pmpkg.py
@@ -48,8 +48,9 @@ class pmpkg:
self.csize = 0
self.reason = 0
self.md5sum = "" # sync only
- self.replaces = [] # sync only (will be moved to depends)
- self.force = 0 # sync only (will be moved to depends)
+ self.replaces = []
+ self.force = 0
+ self.epoch = 0
# depends
self.depends = []
self.optdepends = []
diff --git a/test/pacman/util.py b/test/pacman/util.py
index 802f22ec..0044f21b 100755
--- a/test/pacman/util.py
+++ b/test/pacman/util.py
@@ -154,6 +154,10 @@ def mkdescfile(filename, pkg):
data.append("provides = %s" % i)
for i in pkg.backup:
data.append("backup = %s" % i)
+ if pkg.epoch:
+ data.append("epoch = %d" % pkg.epoch)
+ if not pkg.force:
+ data.append("force = 1")
if pkg.force:
data.append("force = 1")