[elbe-devel] [PATCH v2 2/3] Changes to the preprocessor

Torben Hohn torben.hohn at linutronix.de
Tue Sep 10 12:39:03 CEST 2019


On Tue, Sep 10, 2019 at 11:20:30AM +0200, Akash Satamkar wrote:

the subject is "Changes to the preprocessor"

none of the touched code is executed in the preprocessor.

> Pass a parameter to archive_tmpfile() method, so as to point to
> an <archive> node in src-cdrom which is different from root
> <archive> node.

<src-cdrom> can also contain multiple archives, we want to unpack.

Add a parameter to ElbeXML.archive_tmpfile(), to allow to specify
the archive to unpack.

> 
> Signed-off-by: Akash Satamkar <akash at linutronix.de>
> ---
>  elbepack/dump.py    | 4 ++--
>  elbepack/elbexml.py | 4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/elbepack/dump.py b/elbepack/dump.py
> index 4642ae92..46eed1e2 100644
> --- a/elbepack/dump.py
> +++ b/elbepack/dump.py
> @@ -194,8 +194,8 @@ def elbe_report(xml, buildenv, cache, targetfs):
>  
>      report.info("Archive extract")
>  
> -    if xml.has("archive") and not xml.text("archive") is None:
> -        with xml.archive_tmpfile() as fp:
> +    if xml.has("archive") and xml.text("archive"):

why did you change from "not xml.text("archive") is None"
to xml.text("archive") ? 

xml.text("archive") return None, when there is no "archive" node.
when there is an empty archive node, we should still try to unpack it,
and then have it generate an error, when the archive file is empty.


> +        with xml.archive_tmpfile(xml.node("archive")) as fp:
>              do('tar xvfj "%s" -h -C "%s"' % (fp.name, targetfs.path))
>          mt_index_postarch = targetfs.mtime_snap()
>      else:
> diff --git a/elbepack/elbexml.py b/elbepack/elbexml.py
> index 5972600c..cfd8f80f 100644
> --- a/elbepack/elbexml.py
> +++ b/elbepack/elbexml.py
> @@ -364,9 +364,9 @@ class ElbeXML(object):
>      def append_initvm_pkg(self, aptpkg):
>          self.append_pkg(aptpkg, 'initvmpkgs')
>  
> -    def archive_tmpfile(self):
> +    def archive_tmpfile(self, arch_file):

arch_file is not a good name for this parameter.
its a node or elem: arch_elem, arch or arch_node



>          fp = NamedTemporaryFile()
> -        fp.write(standard_b64decode(self.text("archive")))
> +        fp.write(standard_b64decode(arch_file.et.text))

please use arch_file.text('.') instead of accessing the et node.

>          fp.file.flush()
>          return fp

self is not used anymore. so... this function should no more be a
method. it should be moved to elbepack/archive.py

>  
> -- 
> 2.20.1
> 
> 
> _______________________________________________
> elbe-devel mailing list
> elbe-devel at linutronix.de
> https://lists.linutronix.de/mailman/listinfo/elbe-devel

-- 
Torben Hohn
Linutronix GmbH | Bahnhofstrasse 3 | D-88690 Uhldingen-Mühlhofen
Phone: +49 7556 25 999 18; Fax.: +49 7556 25 999 99

Hinweise zum Datenschutz finden Sie hier (Informations on data privacy 
can be found here): https://linutronix.de/kontakt/Datenschutz.php

Linutronix GmbH | Firmensitz (Registered Office): Uhldingen-Mühlhofen | 
Registergericht (Registration Court): Amtsgericht Freiburg i.Br., HRB700 
806 | Geschäftsführer (Managing Directors): Heinz Egger, Thomas Gleixner



More information about the elbe-devel mailing list