From 847d112aaf9c5f402815caff6dbb70b814ba9469 Mon Sep 17 00:00:00 2001
From: Ben Smith <binjimin@gmail.com>
Date: Wed, 25 Jul 2018 14:38:27 -0700
Subject: Some fixes for binary releases (#879)

* Create the artifacts before they are packaged (`before_deploy` happens
afterward)
* MacOS doesn't have sha256, so use python
---
 scripts/appveyor-after-test.bat | 20 ++++++++++++++++++++
 scripts/sha256sum.py            | 39 +++++++++++++++++++++++++++++++++++++++
 scripts/travis-before-deploy.sh |  2 +-
 3 files changed, 60 insertions(+), 1 deletion(-)
 create mode 100644 scripts/appveyor-after-test.bat
 create mode 100755 scripts/sha256sum.py

(limited to 'scripts')

diff --git a/scripts/appveyor-after-test.bat b/scripts/appveyor-after-test.bat
new file mode 100644
index 00000000..5451f977
--- /dev/null
+++ b/scripts/appveyor-after-test.bat
@@ -0,0 +1,20 @@
+REM Copyright 2018 WebAssembly Community Group participants
+REM
+REM Licensed under the Apache License, Version 2.0 (the "License");
+REM you may not use this file except in compliance with the License.
+REM You may obtain a copy of the License at
+REM
+REM     http://www.apache.org/licenses/LICENSE-2.0
+REM
+REM Unless required by applicable law or agreed to in writing, software
+REM distributed under the License is distributed on an "AS IS" BASIS,
+REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+REM See the License for the specific language governing permissions and
+REM limitations under the License.
+
+REM Set up the artifact for this build, but only if this is a tag build.
+
+IF "%APPVEYOR_REPO_TAG%" == "true" (
+  ren "%APPVEYOR_BUILD_FOLDER%\\bin" "wabt-%APPVEYOR_REPO_TAG_NAME%"
+  7z a %DEPLOY_NAME% "%APPVEYOR_BUILD_FOLDER%\\wabt-%APPVEYOR_REPO_TAG_NAME%\\*.exe"
+)
diff --git a/scripts/sha256sum.py b/scripts/sha256sum.py
new file mode 100755
index 00000000..ff457d7a
--- /dev/null
+++ b/scripts/sha256sum.py
@@ -0,0 +1,39 @@
+#!/usr/bin/env python
+#
+# Copyright 2018 WebAssembly Community Group participants
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+from __future__ import print_function
+import argparse
+import hashlib
+import sys
+
+
+def main(args):
+  parser = argparse.ArgumentParser()
+  parser.add_argument('file', nargs='?')
+  options = parser.parse_args(args)
+
+  if options.file is None:
+    parser.error('Expected a file')
+
+  m = hashlib.sha256()
+  with open(options.file, 'rb') as f:
+    m.update(f.read())
+  print('%s  %s' % (m.hexdigest(), options.file))
+  return 0
+
+
+if __name__ == '__main__':
+  sys.exit(main(sys.argv[1:]))
diff --git a/scripts/travis-before-deploy.sh b/scripts/travis-before-deploy.sh
index 15618dc2..5b9b2d1b 100755
--- a/scripts/travis-before-deploy.sh
+++ b/scripts/travis-before-deploy.sh
@@ -28,5 +28,5 @@ if [[ -n ${WABT_DEPLOY:-} ]]; then
   PKGNAME="wabt-${TRAVIS_TAG}-${TRAVIS_OS_NAME}"
   mv bin wabt-${TRAVIS_TAG}
   tar -czf ${PKGNAME}.tar.gz wabt-${TRAVIS_TAG}
-  sha256sum ${PKGNAME}.tar.gz > ${PKGNAME}.tar.gz.sha256
+  ${SCRIPT_DIR}/sha256sum.py ${PKGNAME}.tar.gz > ${PKGNAME}.tar.gz.sha256
 fi
-- 
cgit v1.2.3