Gentoo Archives: gentoo-commits

From: Mike Frysinger <vapier@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/pax-utils:master commit in: /, travis/
Date: Thu, 17 Dec 2015 03:24:46
Message-Id: 1450306829.edfd404ac6079b16b144fde5165e2e0dccd35ced.vapier@gentoo
1 commit: edfd404ac6079b16b144fde5165e2e0dccd35ced
2 Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
3 AuthorDate: Wed Dec 16 23:00:29 2015 +0000
4 Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
5 CommitDate: Wed Dec 16 23:00:29 2015 +0000
6 URL: https://gitweb.gentoo.org/proj/pax-utils.git/commit/?id=edfd404a
7
8 enable travis build support
9
10 .travis.yml | 31 +++++++++++++++++++++++++++++++
11 autogen.sh | 5 +++--
12 travis/autotools.tar.xz | Bin 0 -> 9208 bytes
13 travis/lib.sh | 38 ++++++++++++++++++++++++++++++++++++++
14 travis/main.sh | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
15 5 files changed, 120 insertions(+), 2 deletions(-)
16
17 diff --git a/.travis.yml b/.travis.yml
18 new file mode 100644
19 index 0000000..4f5f843
20 --- /dev/null
21 +++ b/.travis.yml
22 @@ -0,0 +1,31 @@
23 +# Travis build integration.
24 +# https://docs.travis-ci.com/
25 +
26 +language: c
27 +compiler:
28 + - clang
29 + - gcc
30 +
31 +sudo: false
32 +
33 +os:
34 + - linux
35 +# Travis currently runs on OS X 10.9 which does not include *at funcs.
36 +# Disable until they update or we include autotools support.
37 + - osx
38 +
39 +# Travis currently uses Ubuntu 12.04 (Precise) which is too old: it does
40 +# not include pyelftools. Disable until they update.
41 +env:
42 + - USE_PYTHON=no
43 +# Note: OS X deps are maintained in .travis.sh until Travis supports it here.
44 +addons:
45 + apt:
46 + packages:
47 + - autoconf-archive
48 + - gnulib
49 + - xmlto
50 + - python-pyelftools
51 + - python3-pyelftools
52 +
53 +script: ./travis/main.sh
54
55 diff --git a/autogen.sh b/autogen.sh
56 index 622ab16..3d49418 100755
57 --- a/autogen.sh
58 +++ b/autogen.sh
59 @@ -1,6 +1,6 @@
60 #!/bin/bash -e
61
62 -v() { echo "$@"; "$@"; }
63 +. "${0%/*}"/travis/lib.sh
64
65 m4dir="autotools/m4"
66
67 @@ -33,12 +33,13 @@ mods="
68 utimensat
69 vasprintf-posix
70 "
71 -v gnulib-tool \
72 +v --fold="gnulib-tool" gnulib-tool \
73 --source-base=autotools/gnulib --m4-base=autotools/m4 \
74 --import \
75 ${mods}
76
77 # not everyone has sys-devel/autoconf-archive installed
78 +v tar xf travis/autotools.tar.xz
79 for macro in $(grep -o '\<AX[A-Z_]*\>' configure.ac | sort -u) ; do
80 if m4=$(grep -rl "\[${macro}\]" /usr/share/aclocal/) ; then
81 v cp $m4 ${m4dir}/
82
83 diff --git a/travis/autotools.tar.xz b/travis/autotools.tar.xz
84 new file mode 100644
85 index 0000000..1c0c854
86 Binary files /dev/null and b/travis/autotools.tar.xz differ
87
88 diff --git a/travis/lib.sh b/travis/lib.sh
89 new file mode 100644
90 index 0000000..687ed41
91 --- /dev/null
92 +++ b/travis/lib.sh
93 @@ -0,0 +1,38 @@
94 +#!/bin/bash
95 +# Common funcs for working w/Travis.
96 +
97 +travis_fold() {
98 + if [[ -n ${TRAVIS_OS_NAME} ]] ; then
99 + printf 'travis_fold:%s:%s\r\n' "$@" | sed 's: :_:g'
100 + fi
101 +}
102 +
103 +if [[ -n ${TRAVIS_OS_NAME} ]] ; then
104 + whitebg=$(tput setab 7)
105 + blackfg=$(tput setaf 0)
106 + normal=$(tput sgr0)
107 +else
108 + whitebg=
109 + blackbg=
110 + normal=
111 +fi
112 +v() {
113 + local fold=""
114 + case $1 in
115 + --fold=*) fold=${1:7}; shift;;
116 + esac
117 + if [[ -n ${fold} ]] ; then
118 + travis_fold start "${fold}"
119 + echo "\$ $*"
120 + "$@"
121 + travis_fold end "${fold}"
122 + else
123 + echo "${whitebg}${blackfg}\$ $*${normal}"
124 + "$@"
125 + fi
126 +}
127 +
128 +ncpus=$(getconf _NPROCESSORS_ONLN)
129 +m() {
130 + v make -j${ncpus} "$@"
131 +}
132
133 diff --git a/travis/main.sh b/travis/main.sh
134 new file mode 100755
135 index 0000000..58b4ddf
136 --- /dev/null
137 +++ b/travis/main.sh
138 @@ -0,0 +1,48 @@
139 +#!/bin/bash -e
140 +
141 +. "${0%/*}"/lib.sh
142 +
143 +main() {
144 + if [[ ${TRAVIS_OS_NAME} == "osx" ]] ; then
145 + # Note: Linux deps are maintained in .travis.yml.
146 + v --fold="brew_update" brew update
147 + v --fold="brew_install" brew install xmlto xz
148 + fi
149 +
150 + # See if we have to bootstrap gnulib. This is the case on OS X, and on
151 + # Linux until they whitelist the package:
152 + # https://github.com/travis-ci/apt-package-whitelist/issues/727
153 + if ! gnulib-tool --version >&/dev/null ; then
154 + if [[ ! -d ../gnulib ]] ; then
155 + v --fold="git_clone_gnulib" \
156 + git clone --depth=1 https://github.com/coreutils/gnulib.git ../gnulib
157 + else
158 + pushd ../gnulib
159 + v --fold="git_pull_gnulib" git pull
160 + popd
161 + fi
162 + export PATH="${PATH}:${PWD}/../gnulib"
163 + fi
164 +
165 + if [[ ${TRAVIS_OS_NAME} == "linux" ]] ; then
166 + # Standard optimized build.
167 + m
168 + m check
169 +
170 + # Debug build w/ASAN and such enabled.
171 + m debug
172 + m check
173 + fi
174 +
175 + # Autotools based build.
176 + v ./autogen.sh
177 + if [[ ${TRAVIS_OS_NAME} == "linux" ]] ; then
178 + v --fold="configure" ./configure
179 + m V=1 distcheck
180 + else
181 + # ELF checks don't work on OS X -- no ELFs!
182 + v ./configure
183 + m V=1
184 + fi
185 +}
186 +main "$@"