[elbe-devel] [PATCH v1 1/2] commands: show: fix pkg-list handling

Holger Dengler holger at hdengler.de
Sun Jul 10 10:35:16 CEST 2022


The <pkg-list> node is optional, so skip the pkg-list output, if the
node is not there.

Signed-off-by: Holger Dengler <holger at hdengler.de>
---
 elbepack/commands/show.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/elbepack/commands/show.py b/elbepack/commands/show.py
index 5d5df3e16..bd00c11e6 100644
--- a/elbepack/commands/show.py
+++ b/elbepack/commands/show.py
@@ -74,8 +74,9 @@ def run_command(argv):
                     print("    deb %s" % url.text("binary").strip())
                 if url.has("source"):
                     print("    deb-src %s" % url.text("source").strip())
-        print("packages:")
-        for pkg in xml.node("./target/pkg-list"):
-            print("    %s" % pkg.et.text)
+        if xml.has("./target/pkg-list"):
+            print("packages:")
+            for pkg in xml.node("./target/pkg-list"):
+                print("    %s" % pkg.et.text)
         print("skip package validation: %s" % xml.has("./project/noauth"))
         print("archive embedded?        %s" % xml.has("./archive"))
-- 
2.36.1



More information about the elbe-devel mailing list