summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorJoshua Watt <jpewhacker@gmail.com>2018-04-10 21:21:54 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-04-13 16:58:07 +0100
commit57ca83dac13c3dbac734fcd8c20fec222c5cb70f (patch)
tree5d4aa5e27929a74129e2dc98faa41905c59005e4 /meta
parentf91523b22ffe3e8662d24fcdcd9fdde62b9485c4 (diff)
downloadpoky-57ca83dac13c3dbac734fcd8c20fec222c5cb70f.tar.gz
icecc-create-env: Allow logging to a file
Modifies the icecc-create-env script so that it can log output to a log file. In addition, a --debug flag is added that allows verbose logging. Finally, the silent flag was removed since it was never used in icecc.bbclass (From OE-Core rev: 3d0bd786fd79967cf8754d022044df311dd8ad3e) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rwxr-xr-xmeta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env74
1 files changed, 49 insertions, 25 deletions
diff --git a/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env b/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env
index 537e38a9ba..074c7675c0 100755
--- a/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env
+++ b/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env
@@ -7,6 +7,24 @@
7target_paths= 7target_paths=
8target_aliases= 8target_aliases=
9 9
10# Always prints, optionally to a log file
11print_output ()
12{
13 if test -n "$log_path"; then
14 echo "$@" | tee -a "$log_path"
15 else
16 echo "$@"
17 fi
18}
19
20# Only prints if the debug flag is specified
21print_debug ()
22{
23 if test -n "$debug"; then
24 print_output "$@"
25 fi
26}
27
10is_dynamic_elf () 28is_dynamic_elf ()
11{ 29{
12 # Is the file an dynamically linked ELF executable? 30 # Is the file an dynamically linked ELF executable?
@@ -54,6 +72,7 @@ add_alias ()
54 *" $alias "*) 72 *" $alias "*)
55 ;; 73 ;;
56 *) 74 *)
75 print_debug "Adding alias '$2' -> '$1'"
57 target_aliases="$target_aliases $alias" 76 target_aliases="$target_aliases $alias"
58 ;; 77 ;;
59 esac 78 esac
@@ -123,17 +142,23 @@ add_file ()
123 fi 142 fi
124} 143}
125 144
126# backward compat 145while test -n "$1"; do
127if test "$1" = "--respect-path"; then 146 case "$1" in
128 shift 147 --respect-path)
129fi 148 # Ignore for backward compatability
130 149 ;;
131#add a --silent switch to avoid "broken pipe" errors when calling this scipt from within OE 150 --debug)
132if test "$1" = "--silent"; then 151 debug=1
133 silent=1 152 ;;
153 --log)
154 do_log=1
155 ;;
156 *)
157 break
158 ;;
159 esac
134 shift 160 shift
135fi 161done
136
137 162
138added_gcc=$1 163added_gcc=$1
139shift 164shift
@@ -143,6 +168,11 @@ added_as=$1
143shift 168shift
144archive_name=$1 169archive_name=$1
145 170
171if test -n "$do_log"; then
172 log_path="$archive_name.log"
173 rm -f "$log_path"
174fi
175
146if test -z "$PATCHELF"; then 176if test -z "$PATCHELF"; then
147 PATCHELF=`which patchelf 2> /dev/null` 177 PATCHELF=`which patchelf 2> /dev/null`
148fi 178fi
@@ -150,22 +180,22 @@ if test -z "$PATCHELF"; then
150 PATCHELF=`which patchelf-uninative 2> /dev/null` 180 PATCHELF=`which patchelf-uninative 2> /dev/null`
151fi 181fi
152if test -z "$PATCHELF"; then 182if test -z "$PATCHELF"; then
153 echo "patchelf is required" 183 print_output "patchelf is required"
154 exit 1 184 exit 1
155fi 185fi
156 186
157if test -z "$added_gcc" || test -z "$added_gxx" ; then 187if test -z "$added_gcc" || test -z "$added_gxx" ; then
158 echo "usage: $0 <gcc_path> <g++_path>" 188 print_output "usage: $0 <gcc_path> <g++_path>"
159 exit 1 189 exit 1
160fi 190fi
161 191
162if ! test -x "$added_gcc" ; then 192if ! test -x "$added_gcc" ; then
163 echo "'$added_gcc' is no executable." 193 print_output "'$added_gcc' is not executable."
164 exit 1 194 exit 1
165fi 195fi
166 196
167if ! test -x "$added_gxx" ; then 197if ! test -x "$added_gxx" ; then
168 echo "'$added_gcc' is no executable." 198 print_output "'$added_gcc' is not executable."
169 exit 1 199 exit 1
170fi 200fi
171 201
@@ -178,7 +208,7 @@ if test -z "$added_as" ; then
178 add_file /usr/bin/as /usr/bin/as 208 add_file /usr/bin/as /usr/bin/as
179else 209else
180 if ! test -x "$added_as" ; then 210 if ! test -x "$added_as" ; then
181 echo "'$added_as' is no executable." 211 print_output "'$added_as' is not executable."
182 exit 1 212 exit 1
183 fi 213 fi
184 214
@@ -206,7 +236,7 @@ if test -x /bin/true; then
206elif test -x /usr/bin/true; then 236elif test -x /usr/bin/true; then
207 add_file /usr/bin/true /bin/true 237 add_file /usr/bin/true /bin/true
208else 238else
209 echo "'true' not found" 239 print_output "'true' not found"
210 exit 1 240 exit 1
211fi 241fi
212 242
@@ -266,9 +296,7 @@ if test -z "$archive_name"; then
266 296
267 #calculate md5 and use it as the archive name 297 #calculate md5 and use it as the archive name
268 archive_name=`for i in $target_files; do test -f $tempdir/$i && $md5sum $tempdir/$i; done | sed -e 's/ .*$//' | $md5sum | sed -e 's/ .*$//'`.tar.gz || { 298 archive_name=`for i in $target_files; do test -f $tempdir/$i && $md5sum $tempdir/$i; done | sed -e 's/ .*$//' | $md5sum | sed -e 's/ .*$//'`.tar.gz || {
269 if test -z "$silent"; then 299 print_output "Couldn't compute MD5 sum."
270 echo "Couldn't compute MD5 sum."
271 fi
272 exit 2 300 exit 2
273 } 301 }
274 mydir=`pwd` 302 mydir=`pwd`
@@ -283,9 +311,7 @@ else
283 fi 311 fi
284fi 312fi
285 313
286if test -z "$silent"; then 314print_output "creating $archive_name"
287 echo "creating $archive_name"
288fi
289 315
290cd $tempdir 316cd $tempdir
291# Add everything in the temp directory. Tar doesn't like to be given files with 317# Add everything in the temp directory. Tar doesn't like to be given files with
@@ -293,9 +319,7 @@ cd $tempdir
293# the path prefix past the offending "..". This makes the archive generate 319# the path prefix past the offending "..". This makes the archive generate
294# incorrectly 320# incorrectly
295tar -czf "$mydir/$archive_name" . || { 321tar -czf "$mydir/$archive_name" . || {
296 if test -z "$silent"; then 322 print_output "Couldn't create archive"
297 echo "Couldn't create archive"
298 fi
299 exit 3 323 exit 3
300} 324}
301cd .. 325cd ..