[elbe-devel] [PATCH v3] elbe-finetuning: add rm_apt_source finetuning method

Torben Hohn torben.hohn at linutronix.de
Wed Sep 16 13:17:18 CEST 2020


On Fri, Sep 04, 2020 at 03:52:05PM +0200, Christian Teklenborg wrote:
> When LOCALMACHINE is used within an Elbe XML, a line 'deb ... http://10.0.2.2'
> is appended to /etc/apt/sources.list. This could cause a warning or error if
> any apt operation is done on the resulting system. Thus add rm_apt_source method
> to finetuning in order to make it possible to remove specified lines from the
> sources.list on the target.
> 
> Addresses to GitHub issue #235.
> 
> Signed-off-by: Christian Teklenborg <chris at linutronix.de>

Reviewed-by: Torben Hohn <torben.hohn at linutronix.de>

> ---
>  elbepack/finetuning.py | 17 +++++++++++++++++
>  schema/dbsfed.xsd      |  7 +++++++
>  2 files changed, 24 insertions(+)
> 
> diff --git a/elbepack/finetuning.py b/elbepack/finetuning.py
> index 853723e4..b2fdf070 100644
> --- a/elbepack/finetuning.py
> +++ b/elbepack/finetuning.py
> @@ -726,6 +726,23 @@ class TestSuites(FinetuningAction):
>          TestSuite.to_file(output, tss)
>  
>  
> + at FinetuningAction.register("rm_apt_source")
> +class RmAptSource(FinetuningAction):
> +
> +    def execute(self, buildenv, _target):
> +
> +        src_path = "%s/../target/etc/apt/sources.list" % buildenv.path
> +
> +        with open(src_path, "r") as f:
> +            src_lst = f.read().split("\n")
> +
> +        rm_src = self.node.et.text.replace("LOCALMACHINE", "10.0.2.2")
> +        src_lst = [src for src in src_lst if rm_src not in src]
> +
> +        with open(src_path, "w") as f:
> +            f.write("\n".join(src_lst))
> +
> +
>  def do_finetuning(xml, buildenv, target):
>  
>      if not xml.has('target/finetuning'):
> diff --git a/schema/dbsfed.xsd b/schema/dbsfed.xsd
> index c1f72c8a..1556eaeb 100644
> --- a/schema/dbsfed.xsd
> +++ b/schema/dbsfed.xsd
> @@ -2124,6 +2124,13 @@
>            </documentation>
>          </annotation>
>        </element>
> +      <element name="rm_apt_source" type="rfs:string" minOccurs="0">
> +        <annotation>
> +          <documentation>
> +            remove the specified source from the sources.list on the target
> +          </documentation>
> +        </annotation>
> +      </element>
>      </choice>
>    </group>
>  
> -- 
> 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