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"
63 url
="https://api.bintray.com/calc_metadata/pcp/${repo}"
64 echo "Signing repository ${repo} via:" && echo " ${url}"
65 curl
-X POST
-H "X-GPG-PASSPHRASE: ${gpgpass}" -u ${user}:${apikey} "${url}"
70 path
="$1"; file="$2"; vers
="$3"
72 docker login
-u ${user} -p ${apikey} -e ${email} pcp-docker-pcp.bintray.io
73 $sudo docker tag
${path} \
74 pcp-docker-pcp.bintray.io
/${path}:${vers}
75 docker push pcp-docker-pcp.bintray.io
/${path}:${vers}
83 test -f "${file}" ||
return 1
84 # batch mode - if we said yes already, say yes again
85 test "X${prev}" = "Xyes" && return 0
86 echo -n "Found ${file}, upload? (y/N) "
88 test "X${yesno}" = "Xy" -o "X${yesno}" = "XY" && return 0
93 cd ${topdir}/build
/tar 2>/dev
/null
&& \
94 verify_asset pcp-
${version}.src.
tar.gz
&& \
95 pkg_upload
source pcp-
${version}.src.
tar.gz
${version}
98 cd ${topdir}/pcp-
${version}/build
/mac
2>/dev
/null
&& \
99 verify_asset pcp-
${buildversion}.dmg
&& \
100 pkg_upload macosx pcp-
${buildversion}.dmg
${version}
103 cd ${topdir}/pcp-
${version}/build
/win
2>/dev
/null
&& \
104 verify_asset pcp-
${buildversion}.msi
&& \
105 pkg_upload windows pcp-
${buildversion}.msi
${version}
108 cd ${topdir}/pcp-
${version}/build
/sun
2>/dev
/null
&& \
109 verify_asset pcp-
${version} && \
110 pkg_upload solaris11 pcp-
${version} ${version}
113 if cd ${topdir}/pcp-
${version}/build
/containers
2>/dev
/null
118 [ -d ${image} ] ||
continue
119 cd ${topdir}/pcp-${version}/build/containers/${image}
120 verify_asset
${image}.tgz
${previous} && \
122 container_upload
${image} ${image}.tgz ${version}
127 if cd ${topdir}/pcp-
${version}/build
/rpm
2>/dev
/null
129 # $distro is something like "el7"
130 [ -z "${distro}" ] && quit
"distro is not configured (via .bintrayrc)"
132 srcrpm
=`echo *.src.rpm`
135 [ "${rpm}" = "${srcrpm}" ] && continue
136 verify_asset
${rpm} ${previous} && \
138 pkg_upload
${distro} ${rpm} ${version}
140 [ $previous = yes ] && sign_repository
${distro}
144 if cd ${topdir}/build
/deb
2>/dev
/null
146 # $distro is something like "wheezy", $arch is like "amd64" or "i386"
147 [ -z "${distro}" ] && quit
"distro is not configured (via .bintrayrc)"
148 [ -z "${arch}" ] && quit
"arch is not configured (via .bintrayrc)"
150 for deb
in *.deb
*.
tar.gz
152 verify_asset
${deb} ${previous} && \
154 deb_upload
${distro} ${deb} ${version} ${arch}
156 [ $previous = yes ] && sign_repository
${distro}