[devscripts] 01/01: uscan: check if match found

James McCoy jamessan at debian.org
Sun Oct 4 14:28:33 UTC 2015


On Sun, Oct 04, 2015 at 01:33:06PM +0000, Osamu Aoki wrote:
> diff --git a/scripts/uscan.pl b/scripts/uscan.pl
> index 4736177..277bd86 100755
> --- a/scripts/uscan.pl
> +++ b/scripts/uscan.pl
> @@ -3446,9 +3446,9 @@ sub newest_dir ($$$$$) {
>      if (defined $download_version) {
>  	print STDERR "$progname debug: download version requested: $download_version\n" if $debug;
>  	if ($download_version =~ m/^([-~\+\w]+)(\.[-~\+\w]+)?(\.[-~\+\w]+)?(\.[-~\+\w]+)?$/) {
> -	    $download_version_short1 = "$1";
> -	    $download_version_short2 = "$1$2";
> -	    $download_version_short3 = "$1$2$3";
> +	    $download_version_short1 = "$1" if defined $1;
> +	    $download_version_short2 = "$1$2" if defined $2;
> +	    $download_version_short3 = "$1$2$3" if defined $3;

What about something like this?

	if ($download_version =~ m/^[-~+\w]+(?:\.[-~+\w]+){0,3}$/) {
	    ($download_version_short1,
	     $download_version_short2,
	     $download_version_short3) = split(/\./, $download_version);
	}

Cheers,
-- 
James
GPG Key: 4096R/331BA3DB 2011-12-05 James McCoy <jamessan at debian.org>



More information about the devscripts-devel mailing list