3 # Automate package uploading to bintray.com.
5 # Run in the top-level of a tree, ensuring .bintrayrc is available with
6 # valid user setting (username, email, apikey, distro, gpgphrase).
8 sudo
=`which sudo` # can be cleared via .bintrayrc
17 [ -e "${topdir}/VERSION.pcp" ] || quit
"Not a PCP git tree, missing VERSION.pcp"
18 [ -e "${topdir}/.bintrayrc" ] || quit
"Tree is unconfigured, missing .bintrayrc"
20 .
${topdir}/.bintrayrc
21 .
${topdir}/VERSION.pcp
23 version
=${PACKAGE_MAJOR}.${PACKAGE_MINOR}.${PACKAGE_REVISION}
24 buildversion
=${version}-${PACKAGE_BUILD}
26 [ -z "${user}" ] && quit
"user is not configured (via .bintrayrc)"
27 [ -z "${email}" ] && quit
"email is not configured (via .bintrayrc)"
28 [ -z "${apikey}" ] && quit
"apikey is not configured (via .bintrayrc)"
29 [ -z "${gpgpass}" ] && quit
"passphrase is not configured (via .bintrayrc)"
33 distro
="$1"; file="$2"; vers
="$3"
35 url
="https://api.bintray.com/content/pcp/${distro}/${file}"
36 echo "Uploading ${file} to:" && echo " ${url}"
38 -T ${file} -u ${user}:${apikey} \
39 -H "X-GPG-PASSPHRASE: ${gpgpass}" \
40 "${url};bt_package=pcp;bt_version=${vers};publish=1"
46 distro
="$1"; file="$2"; vers
="$3"; arch
="$4"
48 deb
="deb_distribution=${distro};deb_component=main;deb_architecture=${arch}"
49 url
="https://api.bintray.com/content/pcp/${distro}/${file}"
50 echo "Uploading ${file} to:" && echo " ${url}"
52 -T ${file} -u ${user}:${apikey} \
53 -H "X-GPG-PASSPHRASE: ${gpgpass}" \
54 -H "X-Bintray-Debian-Distribution: ${distro}" \
55 -H "X-Bintray-Debian-Component: main" \
56 "${url};${deb};bt_package=pcp;bt_version=${vers};publish=1"
64 url
="https://api.bintray.com/gpg/pcp/${repo}/pcp/versions/${vers}"
65 echo "Signing version ${repo}/${version} via:" && echo " ${url}"
66 curl
-X POST
-H "X-GPG-PASSPHRASE: ${gpgpass}" -u ${user}:${apikey} \
67 "${url};bt_package
=pcp
;bt_version
=${vers};publish
=1"
69 url="https
://api.bintray.com
/calc_metadata
/pcp
/${repo}"
70 echo "Signing repository
${repo} via
:" && echo " ${url}"
71 curl -X POST -H "X-GPG-PASSPHRASE
: ${gpgpass}" -u ${user}:${apikey} "${url}"
76 path="$1"; file="$2"; vers="$3"
78 docker login -u ${user} -p ${apikey} -e ${email} pcp-docker-pcp.bintray.io
79 $sudo docker tag ${path} \
80 pcp-docker-pcp.bintray.io/${path}:${vers}
81 docker push pcp-docker-pcp.bintray.io/${path}:${vers}
88 test -f "${file}" || return 1
89 # batch mode - if we said yes already, say yes again
90 test "X
${prev}" = "Xyes
" && return 0
91 echo -n "Found
${file}, upload?
(y
/N
) "
93 test "X
${yesno}" = "Xy
" -o "X
${yesno}" = "XY
" && return 0
98 cd ${topdir}/build/tar 2>/dev/null && \
99 verify_asset pcp-${version}.src.tar.gz && \
100 pkg_upload source pcp-${version}.src.tar.gz ${version}
103 cd ${topdir}/pcp-${version}/build/mac 2>/dev/null && \
104 verify_asset pcp-${buildversion}.dmg && \
105 pkg_upload macosx pcp-${buildversion}.dmg ${version}
108 cd ${topdir}/pcp-${version}/build/win 2>/dev/null && \
109 verify_asset pcp-${buildversion}.msi && \
110 pkg_upload windows pcp-${buildversion}.msi ${version}
113 cd ${topdir}/pcp-${version}/build/sun 2>/dev/null && \
114 verify_asset pcp-${version} && \
115 pkg_upload solaris11 pcp-${version} ${version}
118 if cd ${topdir}/pcp-${version}/build/containers 2>/dev/null
123 [ -d ${image} ] || continue
124 cd ${topdir}/pcp-${version}/build/containers/${image}
125 verify_asset ${image}.tgz ${previous} && \
127 container_upload ${image} ${image}.tgz ${version}
132 if cd ${topdir}/pcp-${version}/build/rpm 2>/dev/null
134 # $distro is something like "el7
"
135 [ -z "${distro}" ] && quit "distro is not configured
(via .bintrayrc
)"
137 srcrpm=`echo *.src.rpm`
140 [ "${rpm}" = "${srcrpm}" ] && continue
141 verify_asset ${rpm} ${previous} && \
143 pkg_upload ${distro} ${rpm} ${version}
145 [ $previous = yes ] && sign_repository ${distro} ${version}
149 if cd ${topdir}/build/deb 2>/dev/null
151 # $distro is something like "wheezy
", $arch is like "amd64
" or "i386
"
152 [ -z "${distro}" ] && quit "distro is not configured
(via .bintrayrc
)"
153 [ -z "${arch}" ] && quit "arch is not configured
(via .bintrayrc
)"
155 for deb in *.deb *.tar.gz
157 verify_asset ${deb} ${previous} && \
159 deb_upload ${distro} ${deb} ${version} ${arch}
161 [ $previous = yes ] && sign_repository ${distro} ${version}