2 # Copyright (c) 2012 The Native Client Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
6 #@ This script for up/downloading native client toolchains, etc..
7 #@ To manually inspect what is on the store servers point your
9 #@ http://gsdview.appspot.com/nativeclient-archive2/
15 ######################################################################
17 ######################################################################
20 echo "######################################################################"
22 echo "######################################################################"
27 egrep "^#@" $0 | cut --bytes=3-
31 Banner "Sanity Checks"
32 if [[ $(basename $(pwd)) != "native_client" ]] ; then
33 echo "ERROR: run this script from the native_client/ dir"
38 ######################################################################
40 ######################################################################
42 readonly GS_UTIL=${GS_UTIL:-buildbot/gsutil.sh}
44 readonly DIR_ARCHIVE=nativeclient-archive2
45 readonly DIR_TRYBOT=nativeclient-trybot
47 readonly GS_PREFIX_ARCHIVE="gs://${DIR_ARCHIVE}"
48 readonly GS_PREFIX_TRYBOT="gs://${DIR_TRYBOT}"
50 readonly URL_PREFIX_UI="http://gsdview.appspot.com"
51 ######################################################################
53 ######################################################################
55 # Note: this is tricky to make work on win/linux/mac
56 du -k $1 | egrep -o "^[0-9]+"
61 local size_kb=$(GetFileSizeK $1)
62 echo "uploading: $2 (${size_kb}kB)"
64 echo "@@@STEP_LINK@download (${size_kb}kB)@${URL_PREFIX_UI}/${path}@@@"
65 ${GS_UTIL} cp -a public-read $1 $2
69 if [[ $1 != toolchain/* &&
70 $1 != between_builders/* &&
71 $1 != canned_nexe/* ]] ; then
72 echo "ERROR: Bad component name: $1"
82 Upload ${tarball} ${GS_PREFIX_ARCHIVE}/${path}
89 echo "@@@STEP_LINK@download@${URL_PREFIX_UI}/${path}@@@"
90 ${GS_UTIL} cp ${GS_PREFIX_ARCHIVE}/${path} ${tarball}
98 Upload ${tarball} ${GS_PREFIX_TRYBOT}/${path}
105 echo "@@@STEP_LINK@download@${URL_PREFIX_UI}/${path}@@@"
106 ${GS_UTIL} cp ${GS_PREFIX_TRYBOT}/${path} ${tarball}
110 # on mac we do not have sha1sum so we fall back to openssl
111 if which sha1sum >/dev/null ; then
112 echo "$(SHA1=$(sha1sum -b $1) ; echo ${SHA1:0:40})"
113 elif which openssl >/dev/null ; then
114 echo "$(SHA1=$(openssl sha1 $1) ; echo ${SHA1/* /})"
117 echo "ERROR: do not know how to compute SHA1"
122 ######################################################################
124 ######################################################################
126 UploadArmTrustedToolchain() {
130 UploadArchive toolchain/${rev}/naclsdk_linux_arm-trusted.tgz ${tarball}
133 DownloadArmTrustedToolchain() {
136 DownloadArchive toolchain/${rev}/naclsdk_linux_arm-trusted.tgz ${tarball}
139 ShowRecentArmTrustedToolchains() {
140 local url=${GS_PREFIX_ARCHIVE}/toolchain/*/naclsdk_linux_arm-trusted.tgz
141 local recent=$(${GS_UTIL} ls ${url} | tail -5)
142 for url in ${recent} ; do
143 if ${GS_UTIL} ls -L "${url}" ; then
149 ######################################################################
151 ######################################################################
153 #@ label should be in :
159 UploadToolchainTarball() {
164 ComputeSha1 ${tarball} > ${tarball}.sha1hash
165 UploadArchive toolchain/${rev}/naclsdk_${label}.tgz.sha1hash ${tarball}.sha1hash
167 # NOTE: only the last link is shown on the waterfall so this should come last
168 UploadArchive toolchain/${rev}/naclsdk_${label}.tgz ${tarball}
171 DownloadPnaclToolchains() {
176 DownloadArchive toolchain/${rev}/naclsdk_${label}.tgz ${tarball}
179 ShowRecentPnaclToolchains() {
181 local url="${GS_PREFIX_ARCHIVE}/toolchain/*/naclsdk_${label}.tgz"
183 local recent=$(${GS_UTIL} ls ${url} | tail -5)
184 for url in ${recent} ; do
185 if ${GS_UTIL} ls -L "${url}" ; then
191 ######################################################################
192 # Nexes for regression/speed tests
193 ######################################################################
195 UploadArchivedNexes() {
197 local label="archived_nexes_$2.tar.bz2"
200 # TODO(robertm,bradn): find another place to store this and
201 # negotiate long term storage guarantees
202 UploadArchive canned_nexe/${rev}/${label} ${tarball}
205 DownloadArchivedNexes() {
207 local label="archived_nexes_$2.tar.bz2"
210 DownloadArchive canned_nexe/${rev}/${label} ${tarball}
213 ######################################################################
214 # Pexes for bitcode stability testing
215 ######################################################################
217 UploadArchivedPexes() {
219 local label="archived_pexes_$2.tar.bz2"
222 # TODO(robertm,bradn): find another place to store this and
223 # negotiate long term storage guarantees
224 # Note, we store the pexes with the toolchain rev for now
225 UploadArchive toolchain/${rev}/${label} ${tarball}
228 DownloadArchivedPexes() {
230 local label="archived_pexes_$2.tar.bz2"
232 DownloadArchive toolchain/${rev}/${label} ${tarball}
235 UploadArchivedPexesSpec2k() {
236 UploadArchivedPexes $1 "spec2k" $2
239 DownloadArchivedPexesSpec2k() {
240 DownloadArchivedPexes $1 "spec2k" $2
242 ######################################################################
244 ######################################################################
246 UploadArmBinariesForHWBots() {
249 UploadArchive between_builders/${name}/$(basename ${tarball}) ${tarball}
253 DownloadArmBinariesForHWBots() {
256 DownloadArchive between_builders/${name}/$(basename ${tarball}) ${tarball}
259 ######################################################################
260 # ARM BETWEEN BOTS TRY
261 ######################################################################
263 UploadArmBinariesForHWBotsTry() {
266 UploadTrybot between_builders/${name}/$(basename ${tarball}) ${tarball}
270 DownloadArmBinariesForHWBotsTry() {
273 DownloadTrybot between_builders/${name}/$(basename ${tarball}) ${tarball}
276 ######################################################################
278 ######################################################################
281 if [[ $# -eq 0 ]] ; then
282 echo "you must specify a mode on the commandline:"
286 elif [[ "$(type -t $1)" != "function" ]]; then
287 echo "ERROR: unknown function '$1'." >&2
288 echo "For help, try:"