Browse code

helps to commit the file doing the log too

Nat! authored on 20-09-2017 19:36:55
Showing 2 changed files
... ...
@@ -31,7 +31,7 @@
31 31
 #
32 32
 MULLE_EXECUTABLE_VERSION_MAJOR=3
33 33
 MULLE_EXECUTABLE_VERSION_MINOR=13
34
-MULLE_EXECUTABLE_VERSION_PATCH=1
34
+MULLE_EXECUTABLE_VERSION_PATCH=2
35 35
 
36 36
 MULLE_EXECUTABLE_VERSION="${MULLE_EXECUTABLE_VERSION_MAJOR}.${MULLE_EXECUTABLE_VERSION_MINOR}.${MULLE_EXECUTABLE_VERSION_PATCH}"
37 37
 
38 38
new file mode 100644
... ...
@@ -0,0 +1,139 @@
1
+#! /usr/bin/env bash
2
+#
3
+#   Copyright (c) 2017 Nat! - Mulle kybernetiK
4
+#   All rights reserved.
5
+#
6
+#   Redistribution and use in source and binary forms, with or without
7
+#   modification, are permitted provided that the following conditions are met:
8
+#
9
+#   Redistributions of source code must retain the above copyright notice, this
10
+#   list of conditions and the following disclaimer.
11
+#
12
+#   Redistributions in binary form must reproduce the above copyright notice,
13
+#   this list of conditions and the following disclaimer in the documentation
14
+#   and/or other materials provided with the distribution.
15
+#
16
+#   Neither the name of Mulle kybernetiK nor the names of its contributors
17
+#   may be used to endorse or promote products derived from this software
18
+#   without specific prior written permission.
19
+#
20
+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+#   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+#   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23
+#   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
24
+#   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25
+#   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26
+#   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27
+#   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28
+#   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29
+#   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30
+#   POSSIBILITY OF SUCH DAMAGE.
31
+#
32
+MULLE_BOOTSTRAP_LOG_SH="included"
33
+
34
+
35
+log_usage()
36
+{
37
+    cat <<EOF >&2
38
+Usage:
39
+   ${MULLE_EXECUTABLE} log [options] <dependency>
40
+
41
+   Show build logs for a dependency.
42
+
43
+Options:
44
+   -l : list log files, don't cat them
45
+
46
+EOF
47
+  exit 1
48
+}
49
+
50
+
51
+
52
+log_main()
53
+{
54
+   log_debug ":log_main:"
55
+
56
+   local OPTION_LIST="NO"
57
+
58
+   while [ $# -ne 0 ]
59
+   do
60
+      case "$1" in
61
+         -h|-help|--help)
62
+            log_usage
63
+         ;;
64
+
65
+         -l|--l)
66
+            OPTION_LIST="YES"
67
+         ;;
68
+
69
+         -*)
70
+            log_error "${MULLE_EXECUTABLE_FAIL_PREFIX}: Unknown option $1"
71
+            log_usage
72
+         ;;
73
+
74
+         *)
75
+            break
76
+         ;;
77
+      esac
78
+
79
+      shift
80
+   done
81
+
82
+   [ -z "${MULLE_BOOTSTRAP_COMMON_SETTINGS_SH}" ] && . mulle-bootstrap-common-settings.sh
83
+
84
+   [ $# -ne 1 ] && log_usage
85
+
86
+   dependency="$1"
87
+
88
+   build_complete_environment
89
+
90
+   [ -z "${CLONESBUILD_DIR}" ] && internal_fail "CLONESBUILD_DIR is empty"
91
+   [ -z "${BUILDLOGS_DIR}" ] && internal_fail "BUILDLOGS_DIR is empty"
92
+
93
+   if [ ! -d "${CLONESBUILD_DIR}" ]
94
+   then
95
+      log_info "Nothing has been built yet"
96
+      return 0
97
+   fi
98
+
99
+   local something
100
+   local filename
101
+   local tool
102
+   local configuration
103
+   local sdk
104
+   local info
105
+   local i
106
+
107
+   something="NO"
108
+   IFS="
109
+"
110
+   for i in `ls -1 "${BUILDLOGS_DIR}/${dependency}"-*.log`
111
+   do
112
+      IFS="${DEFAULTIFS}"
113
+      something="YES"
114
+
115
+      if [ "${OPTION_LIST}" = "YES" ]
116
+      then
117
+         log_info "${i}"
118
+      else
119
+         filename="`basename -- "${i}" .log`"
120
+         tool="${filename##*.}"
121
+         info="${filename%.*}"
122
+         info="$(sed s'/^.*--\(.*\)/\1/' <<< "${info}")"
123
+         configuration="$(cut -d'-' -f 1 <<< "${info}")"
124
+         sdk="$(cut -d'-' -f 2 <<< "${info}")"
125
+
126
+         log_info "Log of ${C_RESET_BOLD}${tool:-unknown tool}${C_INFO} for \
127
+${C_MAGENTA}${C_BOLD}${configuration:-Release}${C_INFO} build with SDK \
128
+${C_MAGENTA}${C_BOLD}${sdk:-Default}${C_INFO} in \"${CLONESBUILD_DIR}/${dependency}\" ..."
129
+         cat "$i"
130
+      fi
131
+   done
132
+   IFS="${DEFAULTIFS}"
133
+
134
+   if [ "${something}" = "NO" ]
135
+   then
136
+      log_info "${dependency} has not been built yet (or maybe  you mistyped the name ?)"
137
+      return 0
138
+   fi
139
+}
0 140
\ No newline at end of file