Merge lp:~dooferlad/linaro-android-build-tools/add_ext_tarball into lp:linaro-android-build-tools

Proposed by James Tunnicliffe
Status: Merged
Merged at revision: 401
Proposed branch: lp:~dooferlad/linaro-android-build-tools/add_ext_tarball
Merge into: lp:linaro-android-build-tools
Diff against target: 57 lines (+39/-0)
2 files modified
build-scripts/build-android (+4/-0)
build-scripts/helpers (+35/-0)
To merge this branch: bzr merge lp:~dooferlad/linaro-android-build-tools/add_ext_tarball
Reviewer Review Type Date Requested Status
Paul Sokolovsky Approve
Review via email: mp+90287@code.launchpad.net

Description of the change

A list of external tarballs specified by the $EXTERNAL_TARBALL environment variable are unpacked into $BUILD_SCRIPT_ROOT/../../build/external_tarballs (/mnt/jenkins/workspace/<build name>/build/external_tarballs).

To post a comment you must log in.
Revision history for this message
Paul Sokolovsky (pfalcon) wrote :

This looks nice. Some comments (not worth fixing as such): I try to avoid using pushd in scripts as produces (apparently not suppressible) output which looks strange in bigger context. Also, there is get_url_basename() function, might make sense to use it.

One bigger point which I raised right when request for this feature was made - how would you use contents of such tarball in a build? Its full path would be different for each build, so you couldn't have nice static path to specify in build config for example. The BP should be recording my proposal of making a symlink /tmp/<tarball_basename> -> /mnt/jenkins/workspace/<build name>/build/external_tarballs/<tarball_basename> to facilitate this.

review: Needs Information
Revision history for this message
James Tunnicliffe (dooferlad) wrote :

On 30 January 2012 10:01, Paul Sokolovsky <email address hidden> wrote:
> Review: Needs Information
>
> This looks nice. Some comments (not worth fixing as such): I try to avoid
> using pushd in scripts as produces (apparently not suppressible) output
> which looks strange in bigger context. Also, there is get_url_basename()
> function, might make sense to use it.

Good point - I will use get_url_basename(). Not sure if it is worth
replacing pushd / popd since the script produces a lot of output
anyway and they are useful.

> One bigger point which I raised right when request for this feature was
> made - how would you use contents of such tarball in a build? Its full
> path would be different for each build, so you couldn't have nice static
> path to specify in build config for example. The BP should be recording my
> proposal of making a symlink /tmp/<tarball_basename> ->
> /mnt/jenkins/workspace/<build name>/build/external_tarballs/<tarball_basename>
> to facilitate this.

ext_tarball_dir=$BUILD_SCRIPT_ROOT/../../build/external_tarballs is
where I unpack to. I could export this variable (but capitalised) for
the build scripts to use. Using an environment variable seems cleaner
than a fixed path.

What do you think?

--
James Tunnicliffe

Revision history for this message
Paul Sokolovsky (pfalcon) wrote :

On Tue, 31 Jan 2012 12:07:26 -0000
James Tunnicliffe <email address hidden> wrote:

> On 30 January 2012 10:01, Paul Sokolovsky
> <email address hidden> wrote:
> > Review: Needs Information
> >
> > This looks nice. Some comments (not worth fixing as such): I try to
> > avoid using pushd in scripts as produces (apparently not
> > suppressible) output which looks strange in bigger context. Also,
> > there is get_url_basename() function, might make sense to use it.
>
> Good point - I will use get_url_basename(). Not sure if it is worth
> replacing pushd / popd since the script produces a lot of output
> anyway and they are useful.
>
> > One bigger point which I raised right when request for this feature
> > was made - how would you use contents of such tarball in a build?
> > Its full path would be different for each build, so you couldn't
> > have nice static path to specify in build config for example. The
> > BP should be recording my proposal of making a
> > symlink /tmp/<tarball_basename> -> /mnt/jenkins/workspace/<build
> > name>/build/external_tarballs/<tarball_basename> to facilitate this.
>
> ext_tarball_dir=$BUILD_SCRIPT_ROOT/../../build/external_tarballs is
> where I unpack to. I could export this variable (but capitalised) for
> the build scripts to use. Using an environment variable seems cleaner
> than a fixed path.
>
> What do you think?
>

Maybe cleaner, but more complicated (as in "more complicated than
something not complicated at all"). I'm not sure defining var in a
build script would be transparent, we want to have explicit config in
a build config, so it all was easily reproducible w/o android-build
(e.g., locally). Original usecase from Android team was to using
a separate toolchain for a specific component. My solution: they define
a make var (FOO_COMPONENT_GCC) with sensible default, then in build
config may override it with
FOO_COMPONENT_GCC=/tmp/some-toolchain/bin/gcc . Your solution?

Anyway, I don't pledge, fairly speaking, they requested ability to
expand tarball into build, requested it some time ago and didn't bump
priority, so this patch can go as is, and if they have additional
reqs, that can be done later.

--
Best Regards,
Paul

Linaro.org | Open source software for ARM SoCs
Follow Linaro: http://www.facebook.com/pages/Linaro
http://twitter.com/#!/linaroorg - http://www.linaro.org/linaro-blog

Revision history for this message
Paul Sokolovsky (pfalcon) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'build-scripts/build-android'
2--- build-scripts/build-android 2012-01-06 11:21:23 +0000
3+++ build-scripts/build-android 2012-01-26 16:51:30 +0000
4@@ -80,6 +80,10 @@
5 unpack_overlays "$SOURCE_OVERLAY"
6 fi
7
8+if [ -n "$EXTERNAL_TARBALL" ]; then
9+ unpack_external_tarball "$EXTERNAL_TARBALL"
10+fi
11+
12 if [ -x "${TARGET_TOOLS_PREFIX}gcc" ]; then
13 ${TARGET_TOOLS_PREFIX}gcc -v
14 fi
15
16=== modified file 'build-scripts/helpers'
17--- build-scripts/helpers 2012-01-16 21:02:08 +0000
18+++ build-scripts/helpers 2012-01-26 16:51:30 +0000
19@@ -83,3 +83,38 @@
20 done
21 IFS="$ifs_save"
22 }
23+
24+unpack_external_tarball () {
25+ ext_tarball_dir=$BUILD_SCRIPT_ROOT/../../build/external_tarballs
26+
27+ # Always start clean
28+ if [[ -d $ext_tarball_dir ]]; then
29+ rm -rf $ext_tarball_dir
30+ fi
31+
32+ mkdir -p $ext_tarball_dir
33+ pushd $ext_tarball_dir
34+
35+ local ifs_save="$IFS"
36+ IFS=";"
37+ for p in $1; do
38+ regex_is_http="^https?://"
39+ regex_file=".*/(.*?)$"
40+
41+ if [[ $p =~ $regex_is_http ]]; then
42+ # File is on a remote web server, wget it
43+ wget --quiet $p
44+ fi
45+
46+ if [[ $p =~ $regex_file ]]; then
47+ filename=${BASH_REMATCH[1]}
48+ tar -x -a -f "$filename" -C $ext_tarball_dir
49+ else
50+ echo "Fatal Error: $p - file name can not be determined"
51+ exit 1
52+ fi
53+ done
54+ IFS="$ifs_save"
55+ popd
56+}
57+

Subscribers

People subscribed via source and target branches