-
Notifications
You must be signed in to change notification settings - Fork 5
/
diffcpan
executable file
·16 lines (12 loc) · 896 Bytes
/
diffcpan
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/bash
cpanname=$1
ver1=$2
ver2=$3
#author=$(curl https://fastapi.metacpan.org/dist/$cpanname | jq -r .author)
# TODO: Is there an API for this?
_page=$(curl https://metacpan.org/dist/$cpanname)
oldauthor=$(echo $_page | grep -oP "(?<=value=\"/release/)\w+(?=/$cpanname-$ver1\")" | head -n 1)
author=$(echo $_page | grep -oP "(?<=value=\"/release/)\w+(?=/$cpanname-$ver2\")" | head -n 1)
test -f /tmp/$cpanname.json.$ver1 || curl https://fastapi.metacpan.org/release/$oldauthor/$cpanname-$ver1 | jq -S '.release.dependency | sort | .[] | .module, .phase' > /tmp/$cpanname.json.$ver1
test -f /tmp/$cpanname.json.$ver2 || curl https://fastapi.metacpan.org/release/$author/$cpanname-$ver2 | jq -S '.release.dependency | sort | .[] | .module, .phase' > /tmp/$cpanname.json.$ver2
git diff --ignore-space-change --ignore-blank-lines --text /tmp/$cpanname.json.$ver1 /tmp/$cpanname.json.$ver2