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

Christian Teklenborg chris at linutronix.de
Mon Aug 31 10:45:28 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 | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/elbepack/dump.py b/elbepack/dump.py
index edc6637f..f8e20220 100644
--- a/elbepack/dump.py
+++ b/elbepack/dump.py
@@ -164,6 +164,24 @@ def check_full_pkgs(pkgs, fullpkgs, cache):
         validation.info("No Errors found")
 
 
+def clean_apt_sources_list():
+
+    fp = open('../target/etc/apt/sources.list', 'r')
+    sources = fp.read().split("\n")
+    fp.close()
+
+    sources_list = ''
+
+    for source in sources:
+        if "10.0.2.2" in source:
+            pass
+        else:
+            sources_list += source + '\n'
+
+    fp = open('../target/etc/apt/sources.list', 'w')
+    fp.write(sources_list)
+    fp.close()
+
 def elbe_report(xml, buildenv, cache, targetfs):
 
     # pylint: disable=too-many-arguments
@@ -173,6 +191,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