diff options
Diffstat (limited to 'test/pacman/pmpkg.py')
-rwxr-xr-x | test/pacman/pmpkg.py | 45 |
1 files changed, 9 insertions, 36 deletions
diff --git a/test/pacman/pmpkg.py b/test/pacman/pmpkg.py index 1d55175e..73156ab2 100755 --- a/test/pacman/pmpkg.py +++ b/test/pacman/pmpkg.py @@ -22,10 +22,9 @@ import stat import shutil import tarfile -from util import * +import util - -class pmpkg: +class pmpkg(object): """Package object. Object holding data from an ArchLinux package. @@ -48,9 +47,7 @@ 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) - # depends + self.replaces = [] self.depends = [] self.optdepends = [] self.conflicts = [] @@ -67,24 +64,11 @@ class pmpkg: "pre_upgrade": "", "post_upgrade": "" } - self.checksum = { - "desc": "", - "depends": "", - "files": "", - "install": "" - } - self.mtime = { - "desc": (0, 0, 0), - "depends": (0, 0, 0), - "files": (0, 0, 0), - "install": (0, 0, 0) - } def __str__(self): s = ["%s" % self.fullname()] s.append("description: %s" % self.desc) s.append("url: %s" % self.url) - s.append("depends: %s" % " ".join(self.depends)) s.append("files: %s" % " ".join(self.files)) s.append("reason: %d" % self.reason) return "\n".join(s) @@ -101,14 +85,7 @@ class pmpkg: Returns a string formatted as follows: "pkgname-pkgver.PKG_EXT_PKG". """ - return "%s%s" % (self.fullname(), PM_EXT_PKG) - - def install_files(self, root): - """Install files in the filesystem located under "root". - - Files are created with content generated automatically. - """ - [mkfile(os.path.join(root, f), f) for f in self.files] + return "%s%s" % (self.fullname(), util.PM_EXT_PKG) def makepkg(self, path): """Creates an ArchLinux package archive. @@ -124,8 +101,8 @@ class pmpkg: # Generate package file system for f in self.files: - mkfile(f, f) - self.size += os.stat(getfilename(f))[stat.ST_SIZE] + util.mkfile(f, f) + self.size += os.stat(util.getfilename(f))[stat.ST_SIZE] # .PKGINFO data = ["pkgname = %s" % self.name] @@ -153,14 +130,14 @@ class pmpkg: data.append("provides = %s" % i) for i in self.backup: data.append("backup = %s" % i) - mkfile(".PKGINFO", "\n".join(data)) + util.mkfile(".PKGINFO", "\n".join(data)) # .INSTALL if len(self.install.values()) > 0: - mkinstallfile(".INSTALL", self.install) + util.mkinstallfile(".INSTALL", self.install) # safely create the dir - mkdir(os.path.dirname(self.path)) + util.mkdir(os.path.dirname(self.path)) # Generate package archive tar = tarfile.open(self.path, "w:gz") @@ -171,8 +148,4 @@ class pmpkg: os.chdir(curdir) shutil.rmtree(tmpdir) - -if __name__ == "__main__": - pkg = pmpkg("dummy") - print pkg # vim: set ts=4 sw=4 et: |