Summary:ASTERISK-21320: fails to parse irregular version strings (such as ~dfsg)
Reporter:Tzafrir Cohen (tzafrir)Labels:
Date Opened:2013-03-26 12:55:01Date Closed:2013-07-13 19:55:56
Versions:Frequency of
Environment:Attachments:( 0) Fix-parsing-a-dfsg-version.patch
Description:I try running the testsuite with the following Asterisk version:

I get the following error:

./runtests.py -v
Traceback (most recent call last):
 File "./runtests.py", line 27, in <module>
   from asterisk.TestConfig import Dependency, TestConfig
 File "lib/python/asterisk/TestConfig.py", line 86, in <module>
   class Dependency:
 File "lib/python/asterisk/TestConfig.py", line 93, in Dependency
   __ast = Asterisk()
 File "lib/python/asterisk/asterisk.py", line 187, in __init__
   self.ast_version = AsteriskVersion()
 File "lib/python/asterisk/version.py", line 58, in __init__
   self.parent) = self._parse_version_string(self.raw_version)
 File "lib/python/asterisk/version.py", line 125, in _parse_version_string
   (parsed_numbers, handled) = self._parse_version(token)
 File "lib/python/asterisk/version.py", line 168, in _parse_version
   parsed_numbers[count] = int(token)
ValueError: invalid literal for int() with base 10: '1~dfsg'

Note that using -v explicitly (as I used here) is still not good enough as the version string is prsed before -v is in effect.

My workaround (which I will attach here) is to fix the parsing so that '~dfsg' would be considered a "feature" string. But I don't suppose this is something you'd like to include.
Comments:By: Matt Jordan (mjordan) 2013-03-26 13:50:41.812-0500

I'm assuming the {{~dfsg}} is a git-ism?

If so, it'd be nice to include it in the version parsing in the same vein and treat it as a team branch.

By: Tzafrir Cohen (tzafrir) 2013-03-26 15:09:17.346-0500

No, it's debianism. When a source tarball needs to be repackaged (normally due to not complying with the DFSG) the repackaged version is labeled with the added '~dfsg[<num>]' .

But the main issue is that a version string can have arbitrary strings added to it by various people.

By: Walter Doekes (wdoekes) 2013-04-09 09:50:38.850-0500

Not that I mind it as a feature. But if we're not using it as such, I'd say: just truncate the version at the tilde.