summaryrefslogtreecommitdiff
path: root/cpan2cruxPorts/p5-unix-processors/lastVersion.sh
blob: 34943e7227f7e286e2f6310405460def1640384d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/bash

url=$(
  sed -n '
    /^source=([^)]*$/,/)/ p
    /^source=(.*)$/ p
  ' "$(dirname "$0")/Pkgfile" \
  | sed -n '
    s/^.*(//
    s/).*$//
    \@^https://cpan\.metacpan\.org/@p
  '
)
name="${url##*/}"

wget --output-document=- "${url%/*}/" 2>/dev/null | \
  tr '"' '\n' | \
  sed '
    s/^'"${name%\$version.*}"'\([0-9.]\+\)\.tar\.gz$/\1/
    t
    d
  ' | \
  sort -V | \
  tail -n1