From 2dc84873baf86f9b12f56f543ce344e0079d741c Mon Sep 17 00:00:00 2001 From: Justin Davis Date: Sun, 18 Aug 2013 10:45:16 +0000 Subject: Bugfix for fetchcpan. Changed the dist/version splitting algorithm. We split on hyphens and underscores and choose the last element for the version string. The earlier algorithm was mistaking the 3D in GD-3DBarcode for a version string. --- preps/perl.d/fetchcpan | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/preps/perl.d/fetchcpan b/preps/perl.d/fetchcpan index dff7873..b59c293 100755 --- a/preps/perl.d/fetchcpan +++ b/preps/perl.d/fetchcpan @@ -7,17 +7,13 @@ curl --silent "$mirror$path" | zcat 2>/dev/null | awk ' NR < 10 { next } { file = a[split($3, a, "/")] - - if (!match(file, /[-_][vV]?[0-9]+/)) { - #print "error: failed to grok " $3 | "cat 1>&2" - next - } - ver = substr(file, RSTART+1) - dist = substr(file, 1, RSTART-1) + ver = a[split(file, a, "[-_]")] + dist = substr(file, 1, length(file) - length(ver) - 1) + if(!dist) next # ignore dists with no versions sub(/[.]tar[.].*$|[.]zip$/, "", ver) sub(/^[vV]/, "", ver) - sub(/[.]pm$/, "", dist) + sub(/[.]pm$/, "", dist) # srsly? if(dist == "perl") next -- cgit v1.2.3-24-g4f1b