From b3eae237e0a921714af1e78fabe8813c873da433 Mon Sep 17 00:00:00 2001
From: Andreas Kloeckner <inform@tiker.net>
Date: Fri, 29 Jan 2016 18:00:08 -0600
Subject: [PATCH] Binary build fixes

---
 .gitlab-ci.yml                                 |  9 +++++++++
 build-helpers/loopy.spec                       |  9 ++++++++-
 build-helpers/make-linux-build-docker-inner.sh |  2 +-
 build-helpers/make-linux-build-docker.sh       | 12 +++++++++++-
 requirements.txt                               |  3 +++
 5 files changed, 32 insertions(+), 3 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index e371192f9..1ac95d35e 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -77,3 +77,12 @@ Python 2.7 with legacy PyOpenCL:
 #   - amd-cl-cpu
 #   except:
 #   - tags
+
+CentOS binary:
+  script:
+  - (cd build-helpers; make-linux-build-docker.sh --nodate)
+  artifacts:
+    paths:
+    - build-helpers/loopy-centos6
+  tags:
+  - docker
diff --git a/build-helpers/loopy.spec b/build-helpers/loopy.spec
index 31162a2c6..14116ec53 100644
--- a/build-helpers/loopy.spec
+++ b/build-helpers/loopy.spec
@@ -10,9 +10,16 @@ debug = False
 
 from os.path import expanduser
 
+import packaging # pip install packaging to add
+
 a = Analysis(['../bin/loopy'],
              pathex=[expanduser('~/src/loopy')],
-             hiddenimports=["appdirs"],
+             hiddenimports=[
+                "appdirs",
+                "packaging.markers",
+                "packaging.specifiers",
+                "packaging.version",
+                ],
              hookspath=None,
              runtime_hooks=None,
              excludes=["hedge", "meshpy", "pyopencl", "PIL"]
diff --git a/build-helpers/make-linux-build-docker-inner.sh b/build-helpers/make-linux-build-docker-inner.sh
index 6b72639e0..830cf1b1b 100755
--- a/build-helpers/make-linux-build-docker-inner.sh
+++ b/build-helpers/make-linux-build-docker-inner.sh
@@ -22,7 +22,7 @@ source .env/bin/activate
 curl -k https://ssl.tiker.net/software/ez_setup.py | python -
 curl -k https://gitlab.tiker.net/inducer/pip/raw/7.0.3/contrib/get-pip.py | python -
 
-pip install pyinstaller
+pip install pyinstaller packaging
 git clone --recursive git://github.com/inducer/loopy
 cd loopy
 
diff --git a/build-helpers/make-linux-build-docker.sh b/build-helpers/make-linux-build-docker.sh
index 90684a267..fb0cfb587 100755
--- a/build-helpers/make-linux-build-docker.sh
+++ b/build-helpers/make-linux-build-docker.sh
@@ -2,9 +2,19 @@
 
 # should be run in this directory (build-helpers)
 
+if test "$1" = "--nodate"; then
+  TGT_NAME=loopy-centos6
+else
+  TGT_NAME=loopy-centos6-$(date +"%Y-%m-%d")
+fi
+
+echo "Generating $TGT_NAME..."
+
 set -e
 set -x
 
+docker pull centos:6
+
 CNT=$(docker create -t -v $(pwd):/mnt centos:6 /mnt/make-linux-build-docker-inner.sh)
 echo "working in container $CNT"
 
@@ -12,7 +22,7 @@ docker start -i $CNT
 
 docker cp $CNT:/tmp/build/loopy/dist/loopy $(pwd) || true
 
-mv loopy loopy-centos6-$(date +"%Y-%m-%d")
+mv loopy $TGT_NAME
 
 docker rm $CNT
 
diff --git a/requirements.txt b/requirements.txt
index df54704f8..5dbc4b050 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -8,3 +8,6 @@ hg+https://bitbucket.org/inducer/f2py
 
 # Optional, needed for using the C preprocessor on Fortran
 ply>=3.6
+
+# This is needed for the pyinstaller executable to be usable.
+packaging
-- 
GitLab