[pacman-dev] [PATCH 1/2] pmpkg: add missing directories to test packages

Allan McRae allan at archlinux.org
Sun Mar 3 15:18:59 EST 2013


On 03/03/13 14:49, Andrew Gregory wrote:
> Several tests require complete file lists in order to provide accurate
> results.  These can be non-obvious.  Adding missing parent directories
> helps insure the integrity of tests against human error.
> 
> Signed-off-by: Andrew Gregory <andrew.gregory.8 at gmail.com>
> ---

This is FS#30723

See the full_filelist function in the same file for why I think is a
better way of generating the complete list  (very similar...).  Also, I
think that function can be removed if you make this change.

>  test/pacman/pmpkg.py | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/test/pacman/pmpkg.py b/test/pacman/pmpkg.py
> index c0c9f13..a78d5cb 100644
> --- a/test/pacman/pmpkg.py
> +++ b/test/pacman/pmpkg.py
> @@ -153,6 +153,17 @@ def makepkg(self, path):
>              info.size = len(data)
>              tar.addfile(info, StringIO(data))
>  
> +        # Add missing directories
> +        for name in list(self.files):
> +            fileinfo = util.getfileinfo(name)
> +            filename = fileinfo["filename"]
> +            parent = os.path.dirname(filename.rstrip("/"))
> +            while parent and parent != "/":
> +                if parent not in self.files and parent + "/" not in self.files:
> +                    self.files.append(parent + "/")
> +                parent = os.path.dirname(parent)
> +        self.files.sort()
> +
>          # Generate package file system
>          for name in self.files:
>              fileinfo = util.getfileinfo(name)
> 



More information about the pacman-dev mailing list