summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Gu <timothygu99@gmail.com>2014-08-31 02:00:51 (GMT)
committerTimothy Gu <timothygu99@gmail.com>2014-08-31 02:11:47 (GMT)
commit3c462d83e5722ea7617ea835752f4c16031f69b0 (patch)
tree214809609630e4089554af74546fd71e9a677ea0
parentc4b0d617725ca2ede6c291d04a3c54136273dfef (diff)
downloadmxe-3c462d83e5722ea7617ea835752f4c16031f69b0.zip
mxe-3c462d83e5722ea7617ea835752f4c16031f69b0.tar.gz
mxe-3c462d83e5722ea7617ea835752f4c16031f69b0.tar.bz2
s3-fetch-and-sync: Add experimental download failure notification system
-rwxr-xr-xtools/s3-fetch-and-sync23
1 files changed, 22 insertions, 1 deletions
diff --git a/tools/s3-fetch-and-sync b/tools/s3-fetch-and-sync
index 72e3035..6c26ab7 100755
--- a/tools/s3-fetch-and-sync
+++ b/tools/s3-fetch-and-sync
@@ -3,7 +3,28 @@
#ec2-174-129-78-72.compute-1.amazonaws.com
#http://s3tools.org/s3cmd
+# File issue on GitHub if download fails.
+file_issue=true
+
cd ~/mxe && git pull
-cd ~/mxe && make download
+
+# Test downloading without falling back to S3 download server.
+# All log is stored in tmp-download-log.
+if ! ( \
+ cd ~/mxe && \
+ make download -k MXE_NO_BACKUP_DL=true MXE_VERBOSE=true \
+ 2>&1 >tmp-download-log \
+) && $file_issue; then
+ # If one or more download process fails, upload log to sprunge.us (a
+ # pastebin-like text storage service). Store the returned URL in tmp-url.
+ cat ~/mxe/tmp-download-log | curl -F 'sprunge=<-' http://sprunge.us \
+ >~/mxe/tmp-url
+
+ # Use a fake "editor" to format the issue
+ EDITOR=~/mxe/tools/fake-editor ghi open -- TimothyGu/tmp
+ # EDITOR=~/mxe/tools/fake-editor ghi open -- mxe/mxe
+fi
+
cd ~/mxe && make clean-junk
s3cmd sync --acl-public ~/mxe/pkg/* s3://mxe-pkg/
+rm -f ~/mxe/tmp-download-log ~/mxe/tmp-url \ No newline at end of file