]> diplodocus.org Git - nmh/blob - tools/showbuildenv
mhmisc.c: Indent with "%*s" rather than "%*.*s".
[nmh] / tools / showbuildenv
1 #!/bin/sh
2
3 # Print a description of the build environment. This is here mainly
4 # for the use of the buildbot cluster, allowing developers to see the
5 # build environment on machines they can't login on. It also provides
6 # a history in the build logs that might be useful in catching
7 # regressions.
8 #
9 # This script should *only* report basic information about the build
10 # environment, and only that necessary to reproduce the build
11 # environment.
12 #
13 # The script's exit status must be zero if all went acceptably well as
14 # buildbot checks for this and marks the `environment' stage as failed
15 # otherwise.
16
17 offset () {
18 sed -e '/./s/^/ /' "$@"
19 }
20
21 header () {
22 echo
23 echo "$@"
24 echo
25 }
26
27 # os-release is the new s*stemd standard. Then it's the more unique
28 # ones with redhat-release bringing up the rear because other platforms
29 # also use that to placate broken logic that use its prescence as a
30 # use-RPM test.
31 for f in \
32 /etc/os-release /etc/arch-release /etc/debian_version \
33 /etc/fedora-release /etc/gentoo-release /etc/redhat-release \
34 /etc/lsb-release \
35 ; do
36 test -f $f || continue
37 header $f
38 offset $f
39 break
40 done
41
42 os=`uname`
43
44 for i in a m p r s v; do
45 eval uname_${i}=\'$(uname -${i} 2>/dev/null)\'
46 done
47
48 header Shell Variables:
49 set | sort -d -t= | offset
50
51 case ${os} in
52
53 Darwin)
54 header Compilers:
55 cc -v 2>&1 | offset
56 echo
57 lex --version | offset
58 echo
59 yacc --version | offset
60 ;;
61
62 FreeBSD)
63 header Compilers:
64 cc -v 2>&1 | offset
65
66 header Installed packages:
67 #### pkg(7) or pkg_info(1) might not always be available.
68 (pkg info 2>/dev/null | offset) || true
69 (pkg_info 2>/dev/null | offset) || true
70 ;;
71 esac