diff options
Diffstat (limited to 'bin/metas/perl.d/cpandists')
-rwxr-xr-x | bin/metas/perl.d/cpandists | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/bin/metas/perl.d/cpandists b/bin/metas/perl.d/cpandists deleted file mode 100755 index 040db77..0000000 --- a/bin/metas/perl.d/cpandists +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/sh - -mirror=${CPANMIRROR:-ftp://cpan.pair.com} -path=/modules/02packages.details.txt.gz - -curl --silent "$mirror$path" | gzip -dc | awk ' -NR < 10 { next } -{ - file = a[split($3, a, "/")] - len = split(file, a, ".") - - if (!match(a[1], /[-_][vV]?[0-9]+$/)) { - #print "error: failed to grok " $3 | "cat 1>&2" - next - } - ver = substr(file, RSTART+1, RLENGTH-1) - dist = substr(file, 1, RSTART-1) - for (i=2; i<=len; i++) { - if (a[i] !~ /^[0-9]/) break - ver = ver "." a[i] - } - sub(/^[vV]/, "", ver) - - # For some reason the newest version of perl had no modules in 02packages - # so I cant just use modules from the newest version of perl. - if(dist == "perl") - coremods = coremods $1 " " $2 "\n" - else - mods[dist,ver] = mods[dist,ver] $1 " " $2 "\n" - - if (lessthan(dists[dist], ver)) { - dists[dist] = ver - paths[dist] = $3 - } -} - -END { - for (dist in dists) { - ver = dists[dist] - print dist, ver, paths[dist] | "sort >cpandists" - } - close("sort >cpandists") - - # Prints modules out in sorted order, too! - while(getline<"cpandists" > 0) { - print $1 "\n" ($1 == "perl" ? coremods : mods[$1,$2]) >"cpanmods" - } -} - -function lessthan (l, r) -{ - return decver(l) < decver(r) -} - -function decver (vs) -{ - pcnt = gsub(/[.]/, ".", vs) - if (pcnt < 2) return vs - - len = split(vs, vc, ".") - dec = vc[1] - for (i=2; i<=len; i++) dec += (10 ^ (-i * 3)) * vc[i] - return dec -} - -' |