From f15cce1d414cb497ee804d50c25c6d3d717240bd Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Wed, 22 Jun 2011 15:05:53 -0500 Subject: 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 --- test/pacman/pmdb.py | 29 ++--------------------------- 1 file changed, 2 insertions(+), 27 deletions(-) (limited to 'test/pacman/pmdb.py') 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)) -- cgit v1.2.3