[aur-general] Standardized CPAN Package Versions
xyne at archlinux.ca
Sun Feb 6 20:57:59 EST 2011
Kaiting Chen wrote:
> On Sun, Feb 6, 2011 at 7:52 PM, Kaiting Chen <kaitocracy at gmail.com> wrote:
> > I hate to ask but if it's to be official, do you have any unit tests?
> I realize that all it does is hook into the 'version' module and resolves
> some underscore business. But tests make everyone feel better, even though
> no one likes writing them. --Kaiting.
I'm sorry, but I consider this a nonsensical pseudo-technical question.
As mentioned in my other reply, the "version" module is part of the official
Perl distribution (and thus included in the "perl" package). It can therefore
be considered official and it should be stable, and therefor so should its
output when parsing versions.
The function in my script is extremely simple. It does the following:
* checks if the passed version is defined
* checks if the passed version can be parsed by "version"
* converts the version to a pure decimal form with "numify" from version
* replaces the underscore (representing an alpha version) with "a" (see
Pacman's documentation if you do not know how it treats letters in versions)
* inserts a decimal point between the major and minor version numbers, which
formats all versions to x.xxx or x.xxx.xxx
The last two steps are the only extras. Everything else is within the "version"
The replacement of "_" with "a" follows directly from the meaning of "_" on
CPAN and the way Pacman handles letters in versions as alpha releases.
The final step provides a standardized package version that Pacman can
understand and which is the most human-readable.
Both of the final steps are simple linear transformations. Where exactly would
you like to see unit tests for this script?
More information about the aur-general