diff options
author | Behnam Momeni | 2016-12-03 16:08:07 +0330 |
---|---|---|
committer | Behnam Momeni | 2016-12-03 16:09:13 +0330 |
commit | 3f2ed005d9f4ef325280b9a62154caa47be91651 (patch) | |
tree | b3b9c5eb2443d1b741db2b3d4728f3d5de231146 /download-deps.sh | |
parent | 9bf8a1b417fadacfddd07df53c75d480cc15d130 (diff) | |
download | aur-3f2ed005d9f4ef325280b9a62154caa47be91651.tar.gz |
Updating the download script for the npm version 4.0.3
The --json option cause the npm version 4.0.3 to return a
json array when semver has multiple matches.
Diffstat (limited to 'download-deps.sh')
-rwxr-xr-x | download-deps.sh | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/download-deps.sh b/download-deps.sh index dc80f4c72de0..eb3db8e7a3e8 100755 --- a/download-deps.sh +++ b/download-deps.sh @@ -24,7 +24,11 @@ onlinebestmatch() { local semverspec="$2"; local json="$(npm view --json "$package@$semverspec")" - local version="$(echo "$json" | jq -r '.version')" + if [ $(echo "$json" | jq -r '.version?//"INVALID"') = "INVALID" ]; then + json=$(echo "$json" | jq '.[0]') + fi + local version="$(echo "$json" | jq -r '.version' | head -n1)" + local latestversion="$(echo "$json" | jq '.versions | .[]' | xargs semver -r "$semverspec" | tail -n1)" if [ "$version" != "$latestversion" ]; then json="$(npm view --json "$package@$latestversion")" @@ -92,7 +96,20 @@ createlist() { downloaddeps -createlist source sourcelist > threelists -createlist sha1sums sha1sumslist >> threelists -createlist noextract noextractlist >> threelists +# sorting entries... +cd "$targetdepspath/" +cat sourcelist | gawk '{ n=n+1; print n, $0; }' > a +cat sha1sumslist | gawk '{ n=n+1; print n, $0; }' > b +cat noextractlist | gawk '{ n=n+1; print n, $0; }' > c +cat c | gawk '{ print $2, $1 }' | sort | gawk '{ n=n+1; print $2, n; }' | sort --numeric-sort | gawk '{ print $2 }' > order +paste order a | sort --numeric-sort | gawk '{ print $3 }' > aaa +paste order b | sort --numeric-sort | gawk '{ print $3 }' > bbb +paste order c | sort --numeric-sort | gawk '{ print $3 }' > ccc +createlist source aaa > threelists +createlist sha1sums bbb >> threelists +createlist noextract ccc >> threelists + +#createlist source sourcelist > threelists +#createlist sha1sums sha1sumslist >> threelists +#createlist noextract noextractlist >> threelists |