[elbe-devel] [PATCH v3] elbe-finetuning: add rm_apt_source finetuning method
Christian Teklenborg
chris at linutronix.de
Fri Sep 4 15:52:05 CEST 2020
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>
---
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
More information about the elbe-devel
mailing list