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 URL_PREFIX_RAW=https://storage.googleapis.com
48 readonly URL_PREFIX_ARCHIVE="${URL_PREFIX_RAW}/${DIR_ARCHIVE}"
49 readonly URL_PREFIX_TRYBOT="${URL_PREFIX_RAW}/${DIR_TRYBOT}"
51 readonly GS_PREFIX_ARCHIVE="gs://${DIR_ARCHIVE}"
52 readonly GS_PREFIX_TRYBOT="gs://${DIR_TRYBOT}"
54 readonly URL_PREFIX_UI="http://gsdview.appspot.com"
55 ######################################################################
57 ######################################################################
59 # Note: this is tricky to make work on win/linux/mac
60 du -k $1 | egrep -o "^[0-9]+"
65 local size_kb=$(GetFileSizeK $1)
66 echo "uploading: $2 (${size_kb}kB)"
68 echo "@@@STEP_LINK@download (${size_kb}kB)@${URL_PREFIX_UI}/${path}@@@"
69 ${GS_UTIL} cp -a public-read $1 $2
73 if [[ $1 != toolchain/* &&
74 $1 != between_builders/* &&
75 $1 != canned_nexe/* ]] ; then
76 echo "ERROR: Bad component name: $1"
86 Upload ${tarball} ${GS_PREFIX_ARCHIVE}/${path}
94 curl -L ${URL_PREFIX_ARCHIVE}/${path} -o ${tarball}
102 Upload ${tarball} ${GS_PREFIX_TRYBOT}/${path}
110 curl -L ${URL_PREFIX_TRYBOT}/${path} -o ${tarball}
114 # on mac we do not have sha1sum so we fall back to openssl
115 if which sha1sum >/dev/null ; then
116 echo "$(SHA1=$(sha1sum -b $1) ; echo ${SHA1:0:40})"
117 elif which openssl >/dev/null ; then
118 echo "$(SHA1=$(openssl sha1 $1) ; echo ${SHA1/* /})"
121 echo "ERROR: do not know how to compute SHA1"
126 ######################################################################
128 ######################################################################
130 UploadArmTrustedToolchain() {
134 UploadArchive toolchain/${rev}/naclsdk_linux_arm-trusted.tgz ${tarball}
137 DownloadArmTrustedToolchain() {
140 DownloadArchive toolchain/${rev}/naclsdk_linux_arm-trusted.tgz ${tarball}
143 ShowRecentArmTrustedToolchains() {
144 local url=${GS_PREFIX_ARCHIVE}/toolchain/*/naclsdk_linux_arm-trusted.tgz
145 local recent=$(${GS_UTIL} ls ${url} | tail -5)
146 for url in ${recent} ; do
147 if ${GS_UTIL} ls -L "${url}" ; then
153 ######################################################################
155 ######################################################################
157 #@ label should be in :
163 UploadToolchainTarball() {
168 ComputeSha1 ${tarball} > ${tarball}.sha1hash
169 UploadArchive toolchain/${rev}/naclsdk_${label}.tgz.sha1hash ${tarball}.sha1hash
171 # NOTE: only the last link is shown on the waterfall so this should come last
172 UploadArchive toolchain/${rev}/naclsdk_${label}.tgz ${tarball}
175 DownloadPnaclToolchains() {
180 DownloadArchive toolchain/${rev}/naclsdk_${label}.tgz ${tarball}
183 ShowRecentPnaclToolchains() {
185 local url="${GS_PREFIX_ARCHIVE}/toolchain/*/naclsdk_${label}.tgz"
187 local recent=$(${GS_UTIL} ls ${url} | tail -5)
188 for url in ${recent} ; do
189 if ${GS_UTIL} ls -L "${url}" ; then
195 ######################################################################
196 # Nexes for regression/speed tests
197 ######################################################################
199 UploadArchivedNexes() {
201 local label="archived_nexes_$2.tar.bz2"
204 # TODO(robertm,bradn): find another place to store this and
205 # negotiate long term storage guarantees
206 UploadArchive canned_nexe/${rev}/${label} ${tarball}
209 DownloadArchivedNexes() {
211 local label="archived_nexes_$2.tar.bz2"
214 DownloadArchive canned_nexe/${rev}/${label} ${tarball}
217 ######################################################################
218 # Pexes for bitcode stability testing
219 ######################################################################
221 UploadArchivedPexes() {
223 local label="archived_pexes_$2.tar.bz2"
226 # TODO(robertm,bradn): find another place to store this and
227 # negotiate long term storage guarantees
228 # Note, we store the pexes with the toolchain rev for now
229 UploadArchive toolchain/${rev}/${label} ${tarball}
232 DownloadArchivedPexes() {
234 local label="archived_pexes_$2.tar.bz2"
236 DownloadArchive toolchain/${rev}/${label} ${tarball}
239 UploadArchivedPexesSpec2k() {
240 UploadArchivedPexes $1 "spec2k" $2
243 DownloadArchivedPexesSpec2k() {
244 DownloadArchivedPexes $1 "spec2k" $2
246 ######################################################################
248 ######################################################################
250 UploadArmBinariesForHWBots() {
253 UploadArchive between_builders/${name}/$(basename ${tarball}) ${tarball}
257 DownloadArmBinariesForHWBots() {
260 DownloadArchive between_builders/${name}/$(basename ${tarball}) ${tarball}
263 ######################################################################
264 # ARM BETWEEN BOTS TRY
265 ######################################################################
267 UploadArmBinariesForHWBotsTry() {
270 UploadTrybot between_builders/${name}/$(basename ${tarball}) ${tarball}
274 DownloadArmBinariesForHWBotsTry() {
277 DownloadTrybot between_builders/${name}/$(basename ${tarball}) ${tarball}
280 ######################################################################
282 ######################################################################
285 if [[ $# -eq 0 ]] ; then
286 echo "you must specify a mode on the commandline:"
290 elif [[ "$(type -t $1)" != "function" ]]; then
291 echo "ERROR: unknown function '$1'." >&2
292 echo "For help, try:"