[elbe-devel] [PATCH v2] elbe-dump: remove LOCALMACHINE from sources.list

Christian Teklenborg chris at linutronix.de
Wed Sep 2 12:04:15 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. Remove it so that any apt operation on
the resulting system shall not give any warning or error.

Signed-off-by: Christian Teklenborg <chris at linutronix.de>
---
 elbepack/dump.py | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/elbepack/dump.py b/elbepack/dump.py
index edc6637f..84920e97 100644
--- a/elbepack/dump.py
+++ b/elbepack/dump.py
@@ -164,6 +164,19 @@ def check_full_pkgs(pkgs, fullpkgs, cache):
         validation.info("No Errors found")
 
 
+def clean_apt_sources_list():
+
+    src_path = "../target/etc/apt/sources.list"
+
+    with open(src_path, "r") as f:
+        src_lst = f.read().split('\n')
+
+    src_lst = [src for src in src_lst if "10.0.2.2" not in src]
+
+    with open(src_path, "w") as f:
+        f.write('\n'.join(src_lst) + '\n')
+
+
 def elbe_report(xml, buildenv, cache, targetfs):
 
     # pylint: disable=too-many-arguments
@@ -173,6 +186,8 @@ def elbe_report(xml, buildenv, cache, targetfs):
 
     rfs = buildenv.rfs
 
+    clean_apt_sources_list()
+
     report.info("ELBE Report for Project %s\n\n"
                 "Report timestamp: %s\n"
                 "elbe: %s",
-- 
2.20.1



More information about the elbe-devel mailing list