qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 16/22] tests/functional: add common deb_extract helper


From: Daniel P . Berrangé
Subject: Re: [PATCH 16/22] tests/functional: add common deb_extract helper
Date: Mon, 2 Dec 2024 12:08:51 +0000
User-agent: Mutt/2.2.13 (2024-03-09)

On Mon, Dec 02, 2024 at 11:14:16AM +0100, Thomas Huth wrote:
> On 29/11/2024 18.31, Daniel P. Berrangé wrote:
> > This mirrors the existing archive_extract, cpio_extract and zip_extract
> > helpers
> > 
> > Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> > ---
> >   tests/functional/qemu_test/linuxkernel.py | 15 +++++----------
> >   tests/functional/qemu_test/utils.py       | 13 +++++++++++++
> >   2 files changed, 18 insertions(+), 10 deletions(-)
> > 
> > diff --git a/tests/functional/qemu_test/linuxkernel.py 
> > b/tests/functional/qemu_test/linuxkernel.py
> > index a6525f9dd6..fb6a158d36 100644
> > --- a/tests/functional/qemu_test/linuxkernel.py
> > +++ b/tests/functional/qemu_test/linuxkernel.py

> > +def deb_extract(archive, dest_dir, member=None):
> > +    cwd = os.getcwd()
> > +    os.chdir(dest_dir)
> > +    try:
> > +        (stdout, stderr, ret) = run_cmd(['ar', 't', archive])
> > +        file_path = stdout.split()[2]
> > +        run_cmd(['ar', 'x', archive, file_path])
> > +        archive_extract(file_path, dest_dir, member)
> > +    finally:
> > +        os.chdir(cwd)
> 
> Not sure whether we really need this ... extracting .deb files is very
> specific to running Linux kernels in the guest, so IMHO it should be
> sufficient to have it in linuxkernel.py.

You've probably seen the motivation in later patches now - the desire is
to have a standardized "archive_extract" method that handles all types
of archive, automatically setting the dest_dir to 'workdir'. I didn't
want deb_extract to remain an exception to the pattern, because it is
used quite widely.


> Anyway, if we add more and more *_extract functions, we should maybe
> consider to move the extraction functions out of utils.py into an archive.py
> file, what do you think?

Yeah, good point. I temporarily forgot my general rule that files / dirs
called 'util' end up being a general "dumping ground" for unrelated stuff,
and more specialized files are a better idea.

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




reply via email to

[Prev in Thread] Current Thread [Next in Thread]