[ic] [interchange] Normalize the version returned by the get_dist_version()

Peter peter at pajamian.dhs.org
Fri Nov 3 18:48:56 UTC 2017


On 04/11/17 04:18, David Christensen wrote:
> +	# standardize/handle old tagged REL tags
> +	if ($vers =~ /^REL_(\d+)_(\d+)_(\d+)(-(\d+)-g(\w+))/) {
> +		$vers = "$1.$2.$3";
> +		$vers .= '-devel-' . $6 if $4;

The "if $4" is redundant here, because the regex above won't match at
all without it.  You probably want to make the $4 grouping optional by
following it with a "?" in the regex.

> +	}
> +	elsif ($vers =~ /^(\d+)\.(\d+)\.(\d+)(-(\d+)-g(\w+))/) {
> +		$vers = "$1.$2.$3-devel-$6";
> +	}

In both of the above you're donking the commit counter (the $5 part).
I'd like to go on record saying that I like that part of the version
number because it gives an easily human-readable way to determine if a
particular commit is older or newer.


Peter



More information about the interchange-users mailing list