Merge branch 'master' of git://git.pcp.io/lberk/pcp into lberk-merge
[pcp.git] / scripts / bintray-version
bloba1cc0551387211bc46d338367fc5efb2de56e7b4
1 #!/bin/sh
2 #
3 # Automate updating package version metadata on bintray.com.
4 # This script should only be run run *after* binary uploads.
7 # Run in the top-level of a tree, ensuring .bintrayrc is available with
8 # valid user setting (username, email, apikey, distro, gpgphrase).
10 topdir=`pwd`
12 quit()
14 echo $*
15 exit 1
18 [ -e "${topdir}/VERSION.pcp" ] || quit "Not a PCP git tree, missing VERSION.pcp"
19 [ -e "${topdir}/.bintrayrc" ] || quit "Tree is unconfigured, missing .bintrayrc"
21 . ${topdir}/.bintrayrc
22 . ${topdir}/VERSION.pcp
24 version=${PACKAGE_MAJOR}.${PACKAGE_MINOR}.${PACKAGE_REVISION}
25 date=`date "+%Y-%m-%dT00:00:00.000Z"`
27 [ -z "${user}" ] && quit "user is not configured (via .bintrayrc)"
28 [ -z "${email}" ] && quit "email is not configured (via .bintrayrc)"
29 [ -z "${apikey}" ] && quit "apikey is not configured (via .bintrayrc)"
30 [ -z "${gpgpass}" ] && quit "passphrase is not configured (via .bintrayrc)"
32 version_update()
34 distro="$1"; desc=`lookup_description "$1"`
36 url="https://api.bintray.com/packages/pcp/${distro}/pcp/versions/${version}"
37 echo "Updating ${distro} information for ${version}:" && echo " ${url}"
38 curl \
39 -u ${user}:${apikey} \
40 -H "X-GPG-PASSPHRASE: ${gpgpass}" \
41 -H "Content-Type:application/json" \
42 -H "Accept: application/json" \
43 --request PATCH \
44 --data "{\"desc\":\"$desc\",\"vcs_tag\":\"$version\",\"released\":\"$date\"}" \
45 "${url};bt_package=pcp;bt_version=${version};publish=1"
46 echo
49 lookup_description()
51 distro="$1"
53 awk </dev/null '
54 BEGIN {
55 table["source"] = "Performance Co-Pilot source code, gzipped tarball"
56 table["el5"] = "Performance Co-Pilot builds for EL5"
57 table["el6"] = "Performance Co-Pilot builds for EL6"
58 table["el7"] = "Performance Co-Pilot builds for EL7"
59 table["f21"] = "Performance Co-Pilot builds for Fedora 21"
60 table["f22"] = "Performance Co-Pilot builds for Fedora 22"
61 table["f23"] = "Performance Co-Pilot builds for Fedora 23"
62 table["jessie"] = "Performance Co-Pilot builds for Debian 7 (jessie)"
63 table["wheezy"] = "Performance Co-Pilot builds for Debian 8 (wheezy)"
64 table["precise"] = "Performance Co-Pilot builds for Ubuntu 12.04 (precise pangolin)"
65 table["raring"] = "Performance Co-Pilot builds for Ubuntu 13.04 (raring ringtail)"
66 table["trusty"] = "Performance Co-Pilot builds for Ubuntu 14.04 (trusty tahr)"
67 table["vivid"] = "Performance Co-Pilot builds for Ubuntu 15.04 (vivid vervet)"
68 table["wily"] = "Performance Co-Pilot builds for Ubuntu 15.10 (wily werewolf)"
69 table["xenial"] = "Performance Co-Pilot builds for Ubuntu 16.04 (xenial xerus)"
70 table["macosx"] = "Performance Co-Pilot builds for Mac OS X"
71 table["opensuse13"] = "Performance Co-Pilot builds for OpenSUSE 13"
72 table["solaris11"] = "Performance Co-Pilot builds for Solaris 11"
73 } END {
74 print(table["'$distro'"])
78 debian="jessie wheezy"
79 ubuntu="precise raring trusty vivid wily xenial"
80 macosx="macosx"
81 redhat="el5 el6 el7 f21 f22 f23"
82 solaris="solaris11"
83 suse="opensuse13"
85 distributions="source $redhat $debian $ubuntu $macosx $solaris"
86 [ $# -ge 1 ] && distributions="$@"
88 for distro in $distributions
90 version_update $distro
91 done