Merge lp:~joey-jiaojg/livecd-rootfs/trunk into lp:livecd-rootfs

Proposed by Joey Jiao
Status: Rejected
Rejected by: Steve Langasek
Proposed branch: lp:~joey-jiaojg/livecd-rootfs/trunk
Merge into: lp:livecd-rootfs
Diff against target: 115 lines (+75/-16)
1 file modified
ubuntu-touch-android.sh (+75/-16)
To merge this branch: bzr merge lp:~joey-jiaojg/livecd-rootfs/trunk
Reviewer Review Type Date Requested Status
Oliver Grawert Needs Fixing
Ubuntu Installer Team Pending
Review via email: mp+157155@code.launchpad.net

This proposal supersedes a proposal from 2013-04-04.

Description of the change

phablet-dev-bootstrap support only four devices and with this commit, it also supports device still porting.
Meanwhile support multi jobs to build.
Use bash to bypass . build/envsetup.sh error

To post a comment you must log in.
lp:~joey-jiaojg/livecd-rootfs/trunk updated
693. By Joey Jiao

Fix cp for porting device
Reset repo in case builddir not deleted and dirty

Revision history for this message
Joey Jiao (joey-jiaojg) wrote :

Add change 693 which fix some porting devices final zip file not in -$DEVICE.zip format

Revision history for this message
Oliver Grawert (ogra) wrote :

please stick to POSIX shell when supplying patches to shell scripts ("#!/bin/sh" and also "set -e" need to be set and the patch has various bashisms like the usage of == (use the checkbashisms script to verify the script) and see https://wiki.ubuntu.com/DashAsBinSh )

for the automated builds it is important that we do a fresh repo sync (since we are in a virgin chroot when building) so i guess the git reset vs. repo sync need to be conditional

removing the builddir is essntial on a livefs builder so this needs to always happen in automated builds

if only called with an ubuntu supported defined subarch (mako,maguro,grouper etc) the code needs to function the same as it did before the patch (adding -d isnt an option unless the BuildLiveCD script is updated alongside, an RT ticket is filed with the IS team and all the livefs builders are updated to the modified version of BuildLiveCD (which is a manual process that requires a datacenter admin))

review: Needs Fixing
Revision history for this message
Joey Jiao (joey-jiaojg) wrote :

One question:
sh doesn't support source command, but android needs source
build/envsetup.sh, right?

2013/4/9 Oliver Grawert <email address hidden>

> Review: Needs Fixing
>
> please stick to POSIX shell when supplying patches to shell scripts
> ("#!/bin/sh" and also "set -e" need to be set and the patch has various
> bashisms like the usage of == (use the checkbashisms script to verify the
> script) and see https://wiki.ubuntu.com/DashAsBinSh )
>
> for the automated builds it is important that we do a fresh repo sync
> (since we are in a virgin chroot when building) so i guess the git reset
> vs. repo sync need to be conditional
>
> removing the builddir is essntial on a livefs builder so this needs to
> always happen in automated builds
>
> if only called with an ubuntu supported defined subarch
> (mako,maguro,grouper etc) the code needs to function the same as it did
> before the patch (adding -d isnt an option unless the BuildLiveCD script is
> updated alongside, an RT ticket is filed with the IS team and all the
> livefs builders are updated to the modified version of BuildLiveCD (which
> is a manual process that requires a datacenter admin))
> --
> https://code.launchpad.net/~joey-jiaojg/livecd-rootfs/trunk/+merge/157155
> You are the owner of lp:~joey-jiaojg/livecd-rootfs/trunk.
>

--
-Joey Jiao

Revision history for this message
Evan (ev) wrote :

On Fri, Apr 12, 2013 at 9:43 AM, Joey Jiao <email address hidden> wrote:
>
> One question:
> sh doesn't support source command, but android needs source
> build/envsetup.sh, right?

`. build/envsetup.sh` is the POSIX equivalent:

http://pubs.opengroup.org/onlinepubs/009695399/utilities/dot.html

Revision history for this message
Colin Watson (cjwatson) wrote :

"source" is spelled "." in portable sh.

Revision history for this message
Joey Jiao (joey-jiaojg) wrote :

I tried on Ubuntu 12.10 but failed. Any comments
$ echo $SHELL
/bin/bash
$ sh
$ ls
abi build device gdk libnativehelper out
prebuilts vendor
android cts docs hardware log.log packages
sdk
bionic dalvik external kernel Makefile pdk
system
bootable development frameworks libcore ndk prebuilt tools
$ . build/envsetup.sh
sh: 1: build/envsetup.sh: Syntax error: "(" unexpected
$ echo $SHELL
/bin/bash
$ exit

2013/4/12 Colin Watson <email address hidden>

> "source" is spelled "." in portable sh.
>
> --
> https://code.launchpad.net/~joey-jiaojg/livecd-rootfs/trunk/+merge/157155
> You are the owner of lp:~joey-jiaojg/livecd-rootfs/trunk.
>

--
-Joey Jiao

Revision history for this message
Oliver Grawert (ogra) wrote :

> I tried on Ubuntu 12.10 but failed. Any comments
> ...

i tested it myself and there will currently be no easy way around all the bash array usage in the android build system. until this is fixed using #!/bin/bash wont be avoidable, i updated the main branch accordingly (please fix the non POIX bits anyway in your commit).

Revision history for this message
Colin Watson (cjwatson) wrote :

To clarify: this is not due to using '.' (which remains synonymous with
'source'), but because the code in build/envsetup.sh is itself
bash-specific.

Revision history for this message
Dimitri John Ledkov (xnox) wrote :

Do we still need this?

Unmerged revisions

693. By Joey Jiao

Fix cp for porting device
Reset repo in case builddir not deleted and dirty

692. By Joey Jiao

Fix No such file or directory when cp

691. By Joey Jiao

set -e will result in brunch failure

690. By Joey Jiao

Use bash interpreter \
As sh will report sh: 1: build/envsetup.sh: Syntax error: "(" unexpected

689. By Joey Jiao

- Support phablet-dev-bootstrap options
- Support JOBS for sync and build
- Support local_manifest.xml fetch
- Separate VENDORS for phablet-dev-bootstrap and DEVICE for brunch

688. By Joey Jiao

Fix sh interpreter

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'ubuntu-touch-android.sh'
--- ubuntu-touch-android.sh 2013-03-28 18:35:11 +0000
+++ ubuntu-touch-android.sh 2013-04-04 20:02:22 +0000
@@ -1,18 +1,67 @@
1!#/bin/sh1#!/bin/bash
22
3set -e3usage(){
44 cat <<EOF
5codename=$15usage: $(basename $0) <-d DEVICE> [-v VENDORS] [-h] [-j JOBS] [-p BUILD_JOBS] [-c] [-r REFERENCE]
6builddir=$codename-build6
77Phablet build script
8[ "$(dpkg --print-architecture)" = "amd64" ] || exit 18
9Required arguments:
10 -d DEVICE Target device to build
11
12Optional arguments:
13 -v VENDORS Comma separated list of devices to Setup such as
14 maguro, manta, mako, grouper
15 -h HELP Show this help message and exit
16 -j JOBS Amount of sync jobs
17 -c CONTINUE Continue a previously started sync
18 -r REFERENCE Use another dev enviroment as reference for git
19 -l LOCAL_MANIFEST Local manifest address
20 -p BUILD_JOBS Amount of build jobs
21
22EOF
23 exit 1
24}
25
26JOBS=""
27CONTINUE=0
28REFERENCE=""
29LOCAL_MANIFEST=""
30BUILD_JOBS=$(grep processor /proc/cpuinfo | wc -l)
31
32while getopts hd:v:j:cr:l:p: opt; do
33 case $opt in
34 h) usage;;
35 d) DEVICE=$OPTARG;;
36 v) VENDORS=$OPTARG;;
37 j) JOBS=$OPTARG;;
38 c) CONTINUE=1;;
39 r) REFERENCE=$OPTARG;;
40 l) LOCAL_MANIFEST=$OPTARG;;
41 p) BUILD_JOBS=$OPTARG;;
42 *) usage;;
43 esac
44done
45
46[ "$DEVICE" == "" ] && usage
47
48# check if is root
49if [ "$(id -u)" == "0" ]; then
50 SUDO=""
51else
52 SUDO="sudo"
53fi
54
55builddir=phablet-build-$DEVICE
56
57[ "$(dpkg --print-architecture)" == "amd64" ] || exit 1
958
10# set up multiarch59# set up multiarch
11dpkg --print-foreign-architectures | grep -q i386 || dpkg --add-architecture i38660dpkg --print-foreign-architectures | grep -q i386 || dpkg --add-architecture i386
12apt-get update61$SUDO apt-get update
1362
14# add cross build env including the needed i386 packages63# add cross build env including the needed i386 packages
15apt-get -y install git gnupg flex bison gperf build-essential \64$SUDO apt-get -y install git gnupg flex bison gperf build-essential \
16 zip bzr curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \65 zip bzr curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \
17 libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \66 libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \
18 libgl1-mesa-dev g++-multilib mingw32 tofrodos phablet-tools \67 libgl1-mesa-dev g++-multilib mingw32 tofrodos phablet-tools \
@@ -20,17 +69,27 @@
20 openjdk-6-jdk69 openjdk-6-jdk
2170
22# get the git tree71# get the git tree
23phablet-dev-bootstrap -v $codename $builddir72[ "$VENDORS" == "" ] || ARGS=" -v $VENDORS"
73[ "$JOBS" == "" ] || ARGS="$ARGS -j $JOBS"
74[ "$CONTINUE" == "0" ] || ARGS="$ARGS -c"
75[ "$REFERENCE" == "" ] || ARGS="$ARGS -r $REFERENCE"
76phablet-dev-bootstrap $ARGS $builddir
2477
25cd $builddir78cd $builddir
26repo sync79repo forall -c 'git reset --hard && git clean -xdf'
80
81# get local manifest
82[ "$LOCAL_MANIFEST" == "" ] || curl -L -o .repo/local_manifest.xml -O -L $LOCAL_MANIFEST
83
84[ "$JOBS" == "" ] || JOBS=" -j $JOBS"
85repo sync $JOBS
2786
28. build/envsetup.sh87. build/envsetup.sh
29brunch $codename88brunch $DEVICE -j $BUILD_JOBS
3089
31cd -90cd -
32cp $builddir/out/target/product/$codename/*-$codename.zip ./livecd.ubuntu-touch-$codename.zip91cp $builddir/out/target/product/$DEVICE/*-*$DEVICE.zip ./livecd.ubuntu-touch-$DEVICE.zip
33for image in system recovery boot; do92for image in system recovery boot; do
34 cp $builddir/out/target/product/$codename/$image.img ./livecd.ubuntu-touch-$codename.$image.img93 cp $builddir/out/target/product/$DEVICE/$image.img ./livecd.ubuntu-touch-$DEVICE.$image.img
35done94done
36rm -rf $buildir95#rm -rf $builddir

Subscribers

People subscribed via source and target branches