[elbe-devel] [PATCH 2/5] elbepack: elbeproject: fix optional pbuilder git revision

Thomas Weißschuh thomas.weissschuh at linutronix.de
Thu Aug 22 10:09:44 CEST 2024


attrib[key] raise KeyError, not IndexError.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
 elbepack/elbeproject.py | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/elbepack/elbeproject.py b/elbepack/elbeproject.py
index d0422a038779..5a62d0bfcb73 100644
--- a/elbepack/elbeproject.py
+++ b/elbepack/elbeproject.py
@@ -418,10 +418,9 @@ class ElbeProject:
         logging.info('Retrieve pbuild sources: %s',  src_uri)
         if p.tag == 'git':
             do(['git', 'clone', src_uri, src_path])
-            try:
-                do(['git', 'reset', '--hard', p.et.attrib['revision']], cwd=src_path)
-            except IndexError:
-                pass
+            revision = p.et.get('revision')
+            if revision is not None:
+                do(['git', 'reset', '--hard', revision], cwd=src_path)
         elif p.tag == 'svn':
             do(['svn', 'co', '--non-interactive', src_uri, src_path])
         elif p.tag == 'src-pkg':

-- 
2.46.0



More information about the elbe-devel mailing list