Skip to contentSkip to conversation

metadata_scm: Avoid crashing on new svn version layouts

PATCH In review Richard Purdie 2 participants 3 messages Nov 22, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 metadata_scm: Avoid crashing on new svn version layouts

This avoids crashing on newer svn layouts where the entries files don't contain three lines. If someone wants to fix this to get the right version on newer subversion checkouts, patches welcome but this at least stops things crashing.

[YOCTO #5363]

---

meta/classes/metadata_scm.bbclass +3 -1
index 8d3988a..ba0edf9 100644
@@ -54,11 +54,13 @@ def base_get_metadata_monotone_revision(path, d):
     return monotone_revision
 
 def base_get_metadata_svn_revision(path, d):
+    # This only works with older subversion. For newer versions 
+    # this function will need to be fixed by someone interested
     revision = "<unknown>"
     try:
         with open("%s/.svn/entries" % path) as f:
             revision = f.readlines()[3].strip()
-    except IOError:
+    except IOError, IndexError:
         pass
     return revision
 
#1 lore raw
Quoted 8 lines · Richard Purdie

This avoids crashing on newer svn layouts where the entries files don't contain three lines. If someone wants to fix this to get the right version on newer subversion checkouts, patches welcome but this at least stops things crashing.

[YOCTO #5363]

Does not seem right to 'workaround' this; it'd be better to fix it properly.

Signature · 3 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
#2 lore raw
Quoted 7 lines · Otavio Salvador
Quoted 5 lines · Richard Purdie

This avoids crashing on newer svn layouts where the entries files don't contain three lines. If someone wants to fix this to get the right version on newer subversion checkouts, patches welcome but this at least stops things crashing.

Quoted 5 lines
Quoted 3 lines

[YOCTO #5363]

Does not seem right to 'workaround' this; it'd be better to fix it properly.

Its bad the system completely crashes and this patch improves/removes that particular problem.

Equally, I don't have any inclination to figure out the svn changes, I also don't know anyone with any interest in figuring out svn changes. This has been broken long enough that I don't think many people can be using it. If people are, they will fix it...

Cheers,

Richard