diff options
author | Dan McGee <dan@archlinux.org> | 2011-06-22 22:05:53 +0200 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-06-24 08:36:48 +0200 |
commit | f15cce1d414cb497ee804d50c25c6d3d717240bd (patch) | |
tree | ac2db9dc2eb519dd592ad0e898d54a944d2e253e /test/pacman/pmdb.py | |
parent | 3ace8ceb2343621ada4a72fc60e8e03a570fd389 (diff) | |
download | pacman-f15cce1d414cb497ee804d50c25c6d3d717240bd.tar.gz pacman-f15cce1d414cb497ee804d50c25c6d3d717240bd.tar.xz |
pactest: move filelist/backup generation into package object
These are definite methods that operate on a package, so move them there
which cleans up util a bit more.
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'test/pacman/pmdb.py')
-rw-r--r-- | test/pacman/pmdb.py | 29 |
1 files changed, 2 insertions, 27 deletions
diff --git a/test/pacman/pmdb.py b/test/pacman/pmdb.py index cff3358f..72f6dc45 100644 --- a/test/pacman/pmdb.py +++ b/test/pacman/pmdb.py @@ -22,31 +22,6 @@ import tarfile import pmpkg import util -def _mkfilelist(files): - """Generate a list of files from the list supplied as an argument. - - Each path is decomposed to generate the list of all directories leading - to the file. - - Example with 'usr/local/bin/dummy': - The resulting list will be - usr/ - usr/local/ - usr/local/bin/ - usr/local/bin/dummy - """ - file_set = set() - for f in files: - name = util.getfilename(f) - file_set.add(name) - while "/" in name: - name, tmp = name.rsplit("/", 1) - file_set.add(name + "/") - return sorted(file_set) - -def _mkbackuplist(backup): - return ["%s\t%s" % (util.getfilename(i), util.mkmd5sum(i)) for i in backup] - def _getsection(fd): i = [] while 1: @@ -244,8 +219,8 @@ class pmdb(object): # files and install if self.is_local: data = [] - make_section(data, "FILES", _mkfilelist(pkg.files)) - make_section(data, "BACKUP", _mkbackuplist(pkg.backup)) + make_section(data, "FILES", pkg.full_filelist()) + make_section(data, "BACKUP", pkg.local_backup_entries()) filename = os.path.join(path, "files") util.mkfile(filename, "\n".join(data)) |