4 # Copyright (c) 2013 Vojtech Horky
7 # Redistribution and use in source and binary forms, with or without
8 # modification, are permitted provided that the following conditions
11 # - Redistributions of source code must retain the above copyright
12 # notice, this list of conditions and the following disclaimer.
13 # - Redistributions in binary form must reproduce the above copyright
14 # notice, this list of conditions and the following disclaimer in the
15 # documentation and/or other materials provided with the distribution.
16 # - The name of the author may not be used to endorse or promote products
17 # derived from this software without specific prior written permission.
19 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20 # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 HSCT_HOME
=`which -- "$0" 2>/dev/null`
37 # Maybe, we are running Bash
38 [ -z "$HSCT_HOME" ] && HSCT_HOME
=`which -- "$BASH_SOURCE" 2>/dev/null`
39 HSCT_HOME
=`dirname -- "$HSCT_HOME"`
40 HSCT
="$HSCT_HOME/hsct.sh"
53 tail -n 5 "$1" |
sed 's#.*# !!! &#'
59 echo "1..$2" >"$TAP_FILENAME"
63 echo "ok $TAP_COUNTER $1" >>"$TAP_FILENAME"
64 TAP_COUNTER
=$
(( $TAP_COUNTER + 1 ))
68 echo "not ok $TAP_COUNTER $1" >>"$TAP_FILENAME"
69 if [ -n "$2$3" ]; then
74 echo " ------ Last 10 lines of $2 -------"
77 |
sed 's/^\([\t ]*\)#/\1\\#/'
84 TAP_COUNTER
=$
(( $TAP_COUNTER + 1 ))
88 if [ "$1" -eq 0 ]; then
95 arch_human_readable
() {
96 _arch
=`echo "$1" | cut '-d-' -f 1`
97 _machine
=`echo "$1" | cut '-d-' -f 2-`
98 [ "$_machine" = "$_arch" ] && _machine
="";
99 echo "<span class=\"arch\">"
103 amd64
) echo "AMD 64";;
104 arm32
) echo "ARM 32";;
105 mips32
) echo "MIPS 32";;
106 mips64
) echo "MIPS 64";;
107 ppc32
) echo "PowerPC 32";;
108 sparc32
) echo "SPARC 32";;
109 sparc64
) echo "SPARC 64";;
113 if [ -z "$_machine" ]; then
116 echo "<br /><span class=\"machine\">"
119 beagleboardxm
) echo "BeagleBoard-xM";;
120 beaglebone
) echo "BeagleBone";;
121 gta02
) echo "GTA02";;
122 integratorcp
) echo "Integrator/CP";;
123 raspberrypi
) echo "Raspberry Pi";;
124 malta-be
) echo "Malta (BE)";;
125 malta-le
) echo "Malta (LE)";;
127 i460gx
) echo "i460GX";;
128 leon3
) echo "LEON3";;
130 *) echo "$_machine";;
132 [ -z "$_machine" ] ||
echo "</span>"
136 # Resolve correct ordering of all harbours
139 # Allow hide harbours temporarily by prefixing them with e.g. _underscore
140 ALL_HARBOURS
=`ls $HSCT_HOME/[a-zA-Z]*/HARBOUR | sed 's#.*/\([^/]*\)/HARBOUR$#\1#'`
142 # Export dependencies to HARBOUR_DEPS_{harbour_name}
143 for harbour
in $ALL_HARBOURS; do
144 deps
=`cd $HSCT_HOME/$harbour/; . ./HARBOUR ; echo $shiptugs`
145 eval HARBOUR_DEPS_
$harbour="\"$deps\""
149 # Determine the correct ordering
150 ALL_HARBOURS_CORRECT_ORDER
=""
151 HARBOURS_NOT_RESOLVED
="$ALL_HARBOURS"
153 while [ -n "$HARBOURS_NOT_RESOLVED" ]; do
155 sed_remove
="-e s:x:x:"
157 for harbour
in $HARBOURS_NOT_RESOLVED; do
158 deps
=`eval echo \\$HARBOUR_DEPS_$harbour`
159 if [ -z "$deps" ]; then
160 ALL_HARBOURS_CORRECT_ORDER
="$ALL_HARBOURS_CORRECT_ORDER $harbour";
161 sed_remove
="$sed_remove -e s:$harbour::g"
164 not_resolved_yet
="$not_resolved_yet $harbour";
167 for harbour
in $ALL_HARBOURS; do
168 deps
=`eval echo \\$HARBOUR_DEPS_$harbour | sed $sed_remove`
169 eval HARBOUR_DEPS_
$harbour="\"$deps\""
171 HARBOURS_NOT_RESOLVED
="$not_resolved_yet"
172 if ! $found_one; then
173 echo "There is circular dependency!"
178 ALL_HARBOURS
="$ALL_HARBOURS_CORRECT_ORDER"
180 # -- End of correct ordering resolving
184 if [ -z "$HELENOS_ROOT" ]; then
194 [ -z "$ARCHITECTURES" ] && exit 1
195 [ -z "$HARBOURS" ] && exit 1
197 if [ "$ARCHITECTURES" == "all" ]; then
198 ARCHITECTURES
="amd64 arm32/beagleboardxm arm32/beaglebone arm32/gta02 arm32/integratorcp arm32/raspberrypi ia32 ia64/i460GX ia64/ski mips32/malta-be mips32/malta-le mips32/msim ppc32 sparc32/leon3 sparc64/niagara sparc64/ultra"
200 if [ "$HARBOURS" == "all" ]; then
201 HARBOURS
="$ALL_HARBOURS"
202 # We know that the ordering is correct, i.e. we build dependent
204 # This speeds-up the build if a dependent package fails as we
205 # do not try to rebuild it with each package that depends on
207 BUILD_OPTS
="--no-deps"
211 msg
"Harbour status matrix generator."
213 msg2
"HelenOS root is at $HELENOS_ROOT."
215 msg2
"Coastline builder is at $HSCT."
218 msg
"Matrix generation started."
219 msg2
"Removing old results..."
228 # Count number of harbours to produce correct TAP plans
230 for HARBOUR
in $HARBOURS; do
231 HARBOUR_COUNT
=$
(( $HARBOUR_COUNT + 1 ))
235 echo $ARCHITECTURES |
(
236 read ARCH OTHERS_IGNORED_XXX
239 echo "root = $HELENOS_ROOT" >hsct.conf
240 echo "arch = ia32" >>hsct.conf
241 echo "sources = ../mirror/" >>hsct.conf
242 # We can expect we build matrix on a machine with a
243 # reasonable network connection.
244 echo "wget_opts = -T 30 -t 3" >>hsct.conf
246 msg
"Downloading all the sources..."
247 tap_init ..
/tap
/00-fetch.tap
$HARBOUR_COUNT
248 for HARBOUR
in $HARBOURS; do
249 msg2
"Fetching for $HARBOUR..."
250 $HSCT fetch
$HARBOUR >>$HARBOUR.fetch.log
2>&1
251 tap_test
"$?" "$HARBOUR (fetch)" "$HARBOUR.fetch.log"
255 for ARCH
in $ARCHITECTURES; do
256 ARCH_FILENAME
="`echo $ARCH | tr '/' '-'`"
257 ARCH_DIR
="build-$ARCH_FILENAME"
258 TARBALL_DIR
="matrix/$ARCH_FILENAME"
260 msg
"Building for $ARCH (into $ARCH_DIR)."
263 mkdir
-p "$TARBALL_DIR"
267 tap_init ..
/tap
/$ARCH_FILENAME.tap $
(( $HARBOUR_COUNT + 1 ))
269 if ! [ -r hsct.conf
]; then
272 msg2
"Preparing for first build..."
273 $HSCT init
"$HELENOS_ROOT" "$ARCH" build
&>init.log
274 echo "parallel = $PARALLELISM" >>hsct.conf
275 echo "sources = ../mirror/" >>hsct.conf
278 tap_test
$RC "initialization ($ARCH)" "init.log"
279 if [ $RC -ne 0 ]; then
281 for HARBOUR
in $HARBOURS; do
282 tap_fail
"$HARBOUR ($ARCH)" "" "Initialization failed."
288 for HARBOUR
in $HARBOURS; do
292 echo -n "" >build
/$HARBOUR.log
294 msg2
"Building $HARBOUR..."
295 $HSCT build
--no-fetch $BUILD_OPTS $HARBOUR >build
/$HARBOUR.log
2>&1
298 $HSCT package
$HARBOUR >>build
/$HARBOUR.log
2>&1
300 msg3
"Creating the tarball..."
301 $HSCT archive
$HARBOUR >>build
/$HARBOUR.log
2>&1
303 cp archives
/$HARBOUR.
tar.xz ..
/$TARBALL_DIR/$ARCH_FILENAME-$HARBOUR.
tar.xz
306 tap_test
$RC "$HARBOUR ($ARCH)" "build/$HARBOUR.log"
307 if [ $RC -ne 0 ]; then
308 log_tail build
/$HARBOUR.log
310 msg3
"Cleaning the build directory..."
311 rm -rf build
/$HARBOUR/
312 cp build
/$HARBOUR.log ..
/$TARBALL_DIR/$HARBOUR.txt
319 msg
"Generating HTML results page."
320 ARCHS
=`find matrix/* -type d | cut '-d/' -f 2-`
321 BUILD_HARBOURS
=`find matrix/* -name '*.txt' | cut '-d/' -f 3 | cut '-d.' -f 1 | sort | uniq | paste '-sd '`
322 BUILD_HARBOURS_COUNT
=`echo $BUILD_HARBOURS | wc -w`
323 COL_WIDTH
=$
(( 100 / ( $BUILD_HARBOURS_COUNT + 1 ) ))
324 FIRST_COL_WIDTH
=$
(( 100 - $BUILD_HARBOURS_COUNT * $COL_WIDTH ))
326 BUILD_HARBOURS_ORDERED
=""
327 for HARBOUR
in $ALL_HARBOURS; do
328 if ! echo " $BUILD_HARBOURS " |
grep " $HARBOUR " -q; then
331 BUILD_HARBOURS_ORDERED
="$BUILD_HARBOURS_ORDERED $HARBOUR"
333 BUILD_HARBOURS
="$BUILD_HARBOURS_ORDERED"
335 cat <<EOF_HTML_HEADER
339 <meta charset="utf-8">
340 <title>HelenOS coastline status matrix</title>
341 <style type="text/css">
343 font-family: Verdana,Arial,sans-serif;
361 TABLE.coastline, TABLE.coastline TH, TABLE.coastline TD {
363 border: 1px solid black;
364 border-collapse: collapse;
369 vertical-align: middle;
371 TABLE.coastline TH.package .version {
374 TABLE.coastline TD.ok {
377 TABLE.coastline TD.fail {
389 TABLE.coastline A:link, TABLE.coastline A:visited {
392 TABLE.coastline A:hover {
399 <h1>HelenOS coastline status matrix</h1>
401 This matrix summarizes status of porting various packages to
402 <a href="http://www.helenos.org">HelenOS</a>
404 <a href="https://github.com/vhotspur/coastline">Coastline</a>.
405 The results here come from completely
406 <a href="http://vh.alisma.cz/blog/2013/03/30/introducing-helenos-coastline/">automated
408 and it is possible that some failed packages <i>can</i> be installed through some
412 <table class="coastline">
414 <col width="$FIRST_COL_WIDTH%" />
415 <col span="$ARCH_COUNT" width="$COL_WIDTH%" />
420 for HARBOUR
in $BUILD_HARBOURS; do
421 echo "<th class=\"package\">"
422 echo "$HARBOUR <br />"
423 VERSION
=`sed -n 's#^[ \t]*shipversion=\(.*\)$#\1#p' <$HSCT_HOME/$HARBOUR/HARBOUR 2>/dev/null | tr -d "'\""`
424 echo "<span class=\"version\">$VERSION</span>"
429 for ARCH
in $ARCHS; do
433 arch_human_readable
"$ARCH"
435 for HARBOUR
in $BUILD_HARBOURS; do
436 if [ -e matrix
/$ARCH/$ARCH-$HARBOUR.
tar.xz
]; then
439 TD_LINK
="$ARCH/$ARCH-$HARBOUR.tar.xz"
440 TD_LINK_TEXT
="Tarball"
444 TD_LINK
="$ARCH/$HARBOUR.txt"
447 echo "<td class=\"$TD_CLASS\">"
448 echo "<span class=\"msg\">$TD_MSG</span><br />"
449 echo "<a href=\"$TD_LINK\">$TD_LINK_TEXT</a>"
453 echo "</tr><!-- $ARCH -->"
455 cat <<EOF_HTML_FOOTER