system-tests: improve lava slave ssh capability
[lttng-ci.git] / scripts / common / print.sh
CommitLineData
51c9c62d
MJ
1#!/bin/bash
2#
3# Copyright (C) 2020 Michael Jeanson <mjeanson@efficios.com>
4#
5# This program is free software: you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation, either version 3 of the License, or
8# (at your option) any later version.
9#
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13# GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18set -exu
19
20COLOR_BLUE='\033[0;34m'
21COLOR_NONE='\033[0m' # No Color
22
23print_blue() {
24 echo -e "${COLOR_BLUE}$1${COLOR_NONE}"
25}
26
27print_os() {
28 set +ex
29
30 print_blue "Operating System Details"
31
32 if [ -f "/etc/os-release" ]; then
33 (. "/etc/os-release"; echo "Version: $NAME $VERSION")
34 elif [ -f "/etc/release" ]; then
35 echo "Version: $(head -n1 /etc/release)"
36 elif command -v sw_vers >/dev/null 2>&1; then
37 # For MacOS
38 echo "Version: $(sw_vers -productName) $(sw_vers -productVersion)"
39 fi
40
41 echo -n "Kernel: "
42 uname -a
43
44 set -ex
45}
46
47print_pkgconfig_mod() {
48 local mod=$1
49 if pkg-config --exists "${mod}"; then
50 print_blue "$mod version"
51 pkg-config --modversion "${mod}"
52 fi
53}
54
55print_tooling() {
56 set +ex
57
58 print_blue "Selected CC version"
59 ${CC:-cc} --version | head -n1
60
61 print_blue "Default gcc version"
62 gcc --version | head -n1
63 gcc -dumpmachine
64
65 if command -v clang >/dev/null 2>&1; then
66 print_blue "Default clang version"
67 clang --version
68 fi
69
70 print_blue "git version"
71 git --version
72
73 print_blue "bash version"
74 bash --version | head -n1
75
76 print_blue "make version"
77 ${MAKE:-make} --version | head -n1
78
79 if command -v cmake >/dev/null 2>&1; then
80 print_blue "cmake version"
81 cmake --version
82 fi
83
84 print_blue "automake version"
85 automake --version | head -n1
86
87 print_blue "autoconf version"
88 autoconf --version | head -n1
89
90 print_blue "libtool version"
91 if libtool --version >/dev/null 2>&1; then
92 libtool --version | head -n1
93 else
94 # Thanks Apple!
95 libtool -V
96 fi
97
98 print_blue "bison version"
99 ${BISON:-bison} --version | head -n1
100
101 print_blue "flex version"
102 ${FLEX:-flex} --version
103
104 print_blue "swig version"
105 swig -version | ${GREP:-grep} SWIG
106
107 print_blue "tar version"
108 ${TAR:-tar} --version | head -n1
109
110 print_blue "Selected python version"
4688a6cd 111 ${PYTHON:-python} --version
51c9c62d
MJ
112
113 if command -v "${PYTHON2:-python2}" >/dev/null 2>&1; then
114 print_blue "python2 version"
115 ${PYTHON2:-python2} --version
116 fi
117
118 if command -v "${PYTHON3:-python3}" >/dev/null 2>&1; then
119 print_blue "python3 version"
120 ${PYTHON3:-python3} --version
121 fi
122
123 print_blue "java version"
124 java -version
125
126 print_blue "javac version"
127 javac -version
128
129 if command -v asciidoc >/dev/null 2>&1; then
130 print_blue "asciidoc version"
131 asciidoc --version
132 fi
133
134 if command -v xmlto >/dev/null 2>&1; then
135 print_blue "xmlto version"
136 xmlto --version
137 fi
138
139 if command -v openssl >/dev/null 2>&1; then
140 print_blue "openssl version"
141 openssl version
142 fi
143
144 if command -v pkg-config >/dev/null 2>&1; then
145 print_blue "pkg-config version"
146 pkg-config --version
147
148 #print_blue "pkg-config modules installed"
149 #pkg-config --list-all
150
151 print_pkgconfig_mod glib-2.0
152 print_pkgconfig_mod libdw
153 print_pkgconfig_mod libelf
154 print_pkgconfig_mod libxml-2.0
155 print_pkgconfig_mod msgpack
156 print_pkgconfig_mod popt
157 print_pkgconfig_mod uuid
158 print_pkgconfig_mod zlib
159 fi
160
161 set -ex
162}
This page took 0.028123 seconds and 4 git commands to generate.