From 87ffe25318fb38ec9cc45c317f4c0440194b5b2c Mon Sep 17 00:00:00 2001
From: "R.K.Garcia" <rkgarcia@wisc.edu>
Date: Mon, 21 Sep 2020 16:15:56 +0000
Subject: [PATCH] add zarr and its dependencies

---
 Docker/shellb3-cspp-py38.Dockerfile         |  2 ++
 ShellB3/shallbethree.sh                     | 20 ++++++++++++++++++--
 ShellB3/src/optional/asciitree-0.3.3.tar.gz |  3 +++
 ShellB3/src/optional/fasteners-0.15.tar.gz  |  3 +++
 ShellB3/src/optional/monotonic-1.5.tar.gz   |  3 +++
 ShellB3/src/optional/numcodecs-0.7.2.tar.gz |  3 +++
 ShellB3/src/optional/zarr-2.4.0.tar.gz      |  3 +++
 7 files changed, 35 insertions(+), 2 deletions(-)
 create mode 100644 ShellB3/src/optional/asciitree-0.3.3.tar.gz
 create mode 100644 ShellB3/src/optional/fasteners-0.15.tar.gz
 create mode 100644 ShellB3/src/optional/monotonic-1.5.tar.gz
 create mode 100644 ShellB3/src/optional/numcodecs-0.7.2.tar.gz
 create mode 100644 ShellB3/src/optional/zarr-2.4.0.tar.gz

diff --git a/Docker/shellb3-cspp-py38.Dockerfile b/Docker/shellb3-cspp-py38.Dockerfile
index e77a7df0..82fc0b9f 100644
--- a/Docker/shellb3-cspp-py38.Dockerfile
+++ b/Docker/shellb3-cspp-py38.Dockerfile
@@ -17,6 +17,8 @@ ENV MAKEFLAGS=-j24
 RUN ./shallbethree.sh mk_gcc8
 ARG LINUXCPUFLAGS="-march=ivybridge -fPIC"
 ENV LINUXCPUFLAGS="${LINUXCPUFLAGS}"
+# numcodecs will break on avx2 build when ivybridge arch is forced
+ENV DISABLE_NUMCODECS_AVX2=correctamundo
 RUN ./shallbethree.sh mk_${TRIM}
 WORKDIR /work
 RUN echo export HOSTNAME=$(perl -ne '/.*"HOSTNAME": "(\w+)",/ && print "$1";' </opt/shellb3-cspp-py38/ShellB3/build/.build_env.json) >/etc/profile.d/99-build-host.sh
diff --git a/ShellB3/shallbethree.sh b/ShellB3/shallbethree.sh
index 8896109c..9679bd4d 100755
--- a/ShellB3/shallbethree.sh
+++ b/ShellB3/shallbethree.sh
@@ -1069,6 +1069,13 @@ export GDALVER=2.3.1
 export SODIUMVER=1.0.17
 export PYTESTVER=5.4.3
 
+# zarr and dependencies
+export ZARRVER=2.4.0
+export ASCIITREEVER=0.3.3
+export FASTENERSVER=0.15
+export MONOTONICVER=1.5
+export NUMCODECSVER=0.7.2
+
 export OPENH264VER=1.8.0
 export LIBAVVER=12.3
 
@@ -1503,7 +1510,7 @@ _decompress_in_build(){
       tarball="src/downloaded/${buildir}.tar.xz"
       #| xzcat - | tar xf - -C build || oops "could not unpack xz-ed ${name} from ${tarball}"
     fi
-    xzcat "${tarball}" | tar xf - -C build || oops "could not unpack xz-ed ${name} from ${tarball}"
+    xzcat "${tarball}" | tar xf - -C build --no-same-owner || oops "could not unpack xz-ed ${name} from ${tarball}"
   else
     if [ "$(echo ${tarball} | cut -c-4)" == "http" ] ; then
       mkdir -p src/downloaded
@@ -1515,7 +1522,7 @@ _decompress_in_build(){
       tarball="src/downloaded/${buildir}.tar"
       #| xzcat - | tar xf - -C build || oops "could not unpack xz-ed ${name} from ${tarball}"
     fi
-    tar xf "${tarball}" -C build || oops "could not unpack ${name} from ${tarball}"
+    tar xf "${tarball}" -C build --no-same-owner || oops "could not unpack ${name} from ${tarball}"
   fi
   if [ -e build/${buildir} ] ; then
     echo -n
@@ -6813,6 +6820,14 @@ mk_dask(){
   _setup_build_install dask src/optional/dask-${DASKVER}.tar.* dask-${DASKVER} || oops "dask failed to install"
 }
 
+mk_zarr() {
+  simple_py_install src/optional/asciitree-${ASCIITREEVER}.tar* || oops "asciitree failed to install"
+  simple_py_install src/optional/monotonic-${MONOTONICVER}.tar* || oops "monotonic failed to install"
+  simple_py_install src/optional/fasteners-${FASTENERSVER}.tar* || oops "fasteners failed to install"
+  simple_py_install src/optional/numcodecs-${NUMCODECSVER}.tar* || oops "numcodecs failed to install"
+  simple_py_install src/optional/zarr-${ZARRVER}.tar* || oops "zarr failed to install"
+}
+
 mk_aerocalc() { 
   resume_tracker && return 0
 
@@ -11028,6 +11043,7 @@ mk_cspp() {
     && mk_requests \
     && mk_metpy \
     && mk_dask \
+    && mk_zarr \
     && mk_patchelf --bindir=${BASE}/bin
     echo cspp >>trim
 }
diff --git a/ShellB3/src/optional/asciitree-0.3.3.tar.gz b/ShellB3/src/optional/asciitree-0.3.3.tar.gz
new file mode 100644
index 00000000..7aa1faa0
--- /dev/null
+++ b/ShellB3/src/optional/asciitree-0.3.3.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:4aa4b9b649f85e3fcb343363d97564aa1fb62e249677f2e18a96765145cc0f6e
+size 3951
diff --git a/ShellB3/src/optional/fasteners-0.15.tar.gz b/ShellB3/src/optional/fasteners-0.15.tar.gz
new file mode 100644
index 00000000..5338dc2d
--- /dev/null
+++ b/ShellB3/src/optional/fasteners-0.15.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:3a176da6b70df9bb88498e1a18a9e4a8579ed5b9141207762368a1017bf8f5ef
+size 17898
diff --git a/ShellB3/src/optional/monotonic-1.5.tar.gz b/ShellB3/src/optional/monotonic-1.5.tar.gz
new file mode 100644
index 00000000..a28fcafc
--- /dev/null
+++ b/ShellB3/src/optional/monotonic-1.5.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:23953d55076df038541e648a53676fb24980f7a1be290cdda21300b3bc21dfb0
+size 7525
diff --git a/ShellB3/src/optional/numcodecs-0.7.2.tar.gz b/ShellB3/src/optional/numcodecs-0.7.2.tar.gz
new file mode 100644
index 00000000..b90672e6
--- /dev/null
+++ b/ShellB3/src/optional/numcodecs-0.7.2.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:4a038064d5604e6181a64db668d7b700d9ae87e4041984c04cbf0042469664b0
+size 3947349
diff --git a/ShellB3/src/optional/zarr-2.4.0.tar.gz b/ShellB3/src/optional/zarr-2.4.0.tar.gz
new file mode 100644
index 00000000..e8ae9351
--- /dev/null
+++ b/ShellB3/src/optional/zarr-2.4.0.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:53aa21b989a47ddc5e916eaff6115b824c0864444b1c6f3aaf4f6cf9a51ed608
+size 3308727
-- 
GitLab