commit:     2d45843fd36d1f3b6e0536f9de017a3f59ef2074
Author:     cgzones <cgzones <AT> googlemail <DOT> com>
AuthorDate: Fri Jan  6 18:45:09 2017 +0000
Commit:     Jason Zaman <perfinion <AT> gentoo <DOT> org>
CommitDate: Mon Jan 23 13:08:43 2017 +0000
URL:        
https://gitweb.gentoo.org/proj/hardened-refpolicy.git/commit/?id=2d45843f

use travis cache

cache SELinux userspace build

 .travis.yml | 48 +++++++++++++++++++++++++++++-------------------
 1 file changed, 29 insertions(+), 19 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 58533e6..4848b29 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -41,6 +41,10 @@ sudo: false
 #sudo: required
 #dist: trusty
 
+cache:
+  directories:
+    - ${TRAVIS_BUILD_DIR}/selinux
+
 addons:
   apt:
     packages:
@@ -62,33 +66,39 @@ before_install:
   - python -V
 
 install:
-  # Download current SELinux userspace tools and libraries
-  - curl -sS -L 
https://github.com/SELinuxProject/selinux/archive/20161014.tar.gz | tar xz
-  - mv selinux-20161014 selinux-src
+  - SELINUX_USERSPACE_VERSION=20161014
+
+  - |
+      if [[ "${SELINUX_USERSPACE_VERSION}" != "$(cat 
${TRAVIS_BUILD_DIR}/selinux/travis.version)" ]]; then
+        # Download current SELinux userspace tools and libraries
+        curl -sS -L 
"https://github.com/SELinuxProject/selinux/archive/${SELINUX_USERSPACE_VERSION}.tar.gz";
 | tar xz
+        mv "selinux-${SELINUX_USERSPACE_VERSION}" selinux-src
 
-  # Ubuntu 12.04 coreutils is too old to provide "ln --relative" :(
-  - sed 's/ln -sf --relative /ln -sf /' -i selinux-src/libsepol/src/Makefile
-  - sed 's/ln -sf --relative /ln -sf /' -i selinux-src/libselinux/src/Makefile
+        # Ubuntu 12.04 coreutils is too old to provide "ln --relative" :(
+        sed 's/ln -sf --relative /ln -sf /' -i 
selinux-src/libsepol/src/Makefile
+        sed 's/ln -sf --relative /ln -sf /' -i 
selinux-src/libselinux/src/Makefile
 
-  # Drop secilc to break xmlto dependence (secilc isn't used here anyway)
-  - sed -i -e 's/secilc//' selinux-src/Makefile
+        # Drop secilc to break xmlto dependence (secilc isn't used here anyway)
+        sed -i -e 's/secilc//' selinux-src/Makefile
 
-  # Drop sepolicy to break setools dependence (sepolicy isn't used anyway)
-  - sed -i -e 's/sepolicy//' selinux-src/policycoreutils/Makefile
+        # Drop sepolicy to break setools dependence (sepolicy isn't used 
anyway)
+        sed -i -e 's/sepolicy//' selinux-src/policycoreutils/Makefile
 
-  # Drop restorecond to break glib dependence
-  - sed -i -e 's/ restorecond//' selinux-src/policycoreutils/Makefile
+        # Drop restorecond to break glib dependence
+        sed -i -e 's/ restorecond//' selinux-src/policycoreutils/Makefile
 
-  # Drop sandbox to break libcap-ng dependence
-  - sed -i -e 's/ sandbox//' selinux-src/policycoreutils/Makefile
+        # Drop sandbox to break libcap-ng dependence
+        sed -i -e 's/ sandbox//' selinux-src/policycoreutils/Makefile
 
-  # Compile and install SELinux toolchain into ~/selinux
-  # On Ubuntu 12.04, default CFLAGS make the build fail in libsepol/cil with:
-  #    error: declaration of 'index' shadows a global declarationo
-  - make "DESTDIR=$TRAVIS_BUILD_DIR/selinux" CFLAGS="-O2 -Wall" -C selinux-src 
install
+        # Compile and install SELinux toolchain into ~/selinux
+        # On Ubuntu 12.04, default CFLAGS make the build fail in libsepol/cil 
with:
+        #    error: declaration of 'index' shadows a global declarationo
+        make "DESTDIR=${TRAVIS_BUILD_DIR}/selinux" CFLAGS="-O2 -Wall" -C 
selinux-src install
+        echo "${SELINUX_USERSPACE_VERSION}" > 
"${TRAVIS_BUILD_DIR}/selinux/travis.version"
+      fi
 
   # Use TEST_TOOLCHAIN variable to tell refpolicy Makefile about the installed 
location
-  - export TEST_TOOLCHAIN="$TRAVIS_BUILD_DIR/selinux"
+  - export TEST_TOOLCHAIN="${TRAVIS_BUILD_DIR}/selinux"
 
   # Drop build.conf settings to listen to env vars
   - sed -r -i -e '/(DIRECT_INITRC|MONOLITHIC|TYPE|DISTRO|SYSTEMD)/d' build.conf

Reply via email to