index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Chantry Xavier <shiningxc@gmail.com> | 2008-04-17 09:02:11 +0200 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2008-04-17 14:29:08 -0500 |
commit | c465d9e848b19b495259c7021a583c29fba92b44 (patch) | |
tree | 3860d73280a51a812f9625f5269f4e97b8093240 /pactest | |
parent | 5e375aa9d387b2ef703dd35f60df1daad6a40237 (diff) |
-rwxr-xr-x | pactest/pmdb.py | 9 | ||||
-rwxr-xr-x | pactest/pmpkg.py | 23 |
diff --git a/pactest/pmdb.py b/pactest/pmdb.py index e0f328ef..cfa146bd 100755 --- a/pactest/pmdb.py +++ b/pactest/pmdb.py @@ -19,6 +19,7 @@ import os import tempfile import shutil +import tarfile import pmpkg from util import * @@ -343,7 +344,13 @@ class pmdb: # Generate database archive mkdir(path) archive = os.path.join(path, "%s%s" % (self.treename, PM_EXT_DB)) - os.system("tar zcf %s *" % archive) + tar = tarfile.open(archive, "w:gz") + for root, dirs, files in os.walk('.'): + for d in dirs: + tar.add(os.path.join(root, d), recursive=False) + for f in files: + tar.add(os.path.join(root, f)) + tar.close() os.chdir(curdir) shutil.rmtree(tmpdir) diff --git a/pactest/pmpkg.py b/pactest/pmpkg.py index 3ee58156..48d79a35 100755 --- a/pactest/pmpkg.py +++ b/pactest/pmpkg.py @@ -20,6 +20,7 @@ import os import tempfile import stat import shutil +import tarfile from util import * @@ -153,25 +154,25 @@ class pmpkg: for i in self.backup: data.append("backup = %s" % i) mkfile(".PKGINFO", "\n".join(data)) - targets = ".PKGINFO" # .INSTALL - empty = 1 if len(self.install.values()) > 0: - empty = 0 - if not empty: mkinstallfile(".INSTALL", self.install) - targets += " .INSTALL" - # package files - if self.files: - targets += " *" - - #safely create the dir + # safely create the dir mkdir(os.path.dirname(self.path)) # Generate package archive - os.system("tar zcf %s %s" % (self.path, targets)) + tar = tarfile.open(self.path, "w:gz") + + # package files + for root, dirs, files in os.walk('.'): + for d in dirs: + tar.add(os.path.join(root, d), recursive=False) + for f in files: + tar.add(os.path.join(root, f)) + + tar.close() os.chdir(curdir) shutil.rmtree(tmpdir) |