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
1=== modified file 'ubuntu-touch-android.sh'
2--- ubuntu-touch-android.sh 2013-03-28 18:35:11 +0000
3+++ ubuntu-touch-android.sh 2013-04-04 20:02:22 +0000
4@@ -1,18 +1,67 @@
5-!#/bin/sh
6-
7-set -e
8-
9-codename=$1
10-builddir=$codename-build
11-
12-[ "$(dpkg --print-architecture)" = "amd64" ] || exit 1
13+#!/bin/bash
14+
15+usage(){
16+ cat <<EOF
17+usage: $(basename $0) <-d DEVICE> [-v VENDORS] [-h] [-j JOBS] [-p BUILD_JOBS] [-c] [-r REFERENCE]
18+
19+Phablet build script
20+
21+Required arguments:
22+ -d DEVICE Target device to build
23+
24+Optional arguments:
25+ -v VENDORS Comma separated list of devices to Setup such as
26+ maguro, manta, mako, grouper
27+ -h HELP Show this help message and exit
28+ -j JOBS Amount of sync jobs
29+ -c CONTINUE Continue a previously started sync
30+ -r REFERENCE Use another dev enviroment as reference for git
31+ -l LOCAL_MANIFEST Local manifest address
32+ -p BUILD_JOBS Amount of build jobs
33+
34+EOF
35+ exit 1
36+}
37+
38+JOBS=""
39+CONTINUE=0
40+REFERENCE=""
41+LOCAL_MANIFEST=""
42+BUILD_JOBS=$(grep processor /proc/cpuinfo | wc -l)
43+
44+while getopts hd:v:j:cr:l:p: opt; do
45+ case $opt in
46+ h) usage;;
47+ d) DEVICE=$OPTARG;;
48+ v) VENDORS=$OPTARG;;
49+ j) JOBS=$OPTARG;;
50+ c) CONTINUE=1;;
51+ r) REFERENCE=$OPTARG;;
52+ l) LOCAL_MANIFEST=$OPTARG;;
53+ p) BUILD_JOBS=$OPTARG;;
54+ *) usage;;
55+ esac
56+done
57+
58+[ "$DEVICE" == "" ] && usage
59+
60+# check if is root
61+if [ "$(id -u)" == "0" ]; then
62+ SUDO=""
63+else
64+ SUDO="sudo"
65+fi
66+
67+builddir=phablet-build-$DEVICE
68+
69+[ "$(dpkg --print-architecture)" == "amd64" ] || exit 1
70
71 # set up multiarch
72 dpkg --print-foreign-architectures | grep -q i386 || dpkg --add-architecture i386
73-apt-get update
74+$SUDO apt-get update
75
76 # add cross build env including the needed i386 packages
77-apt-get -y install git gnupg flex bison gperf build-essential \
78+$SUDO apt-get -y install git gnupg flex bison gperf build-essential \
79 zip bzr curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \
80 libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \
81 libgl1-mesa-dev g++-multilib mingw32 tofrodos phablet-tools \
82@@ -20,17 +69,27 @@
83 openjdk-6-jdk
84
85 # get the git tree
86-phablet-dev-bootstrap -v $codename $builddir
87+[ "$VENDORS" == "" ] || ARGS=" -v $VENDORS"
88+[ "$JOBS" == "" ] || ARGS="$ARGS -j $JOBS"
89+[ "$CONTINUE" == "0" ] || ARGS="$ARGS -c"
90+[ "$REFERENCE" == "" ] || ARGS="$ARGS -r $REFERENCE"
91+phablet-dev-bootstrap $ARGS $builddir
92
93 cd $builddir
94-repo sync
95+repo forall -c 'git reset --hard && git clean -xdf'
96+
97+# get local manifest
98+[ "$LOCAL_MANIFEST" == "" ] || curl -L -o .repo/local_manifest.xml -O -L $LOCAL_MANIFEST
99+
100+[ "$JOBS" == "" ] || JOBS=" -j $JOBS"
101+repo sync $JOBS
102
103 . build/envsetup.sh
104-brunch $codename
105+brunch $DEVICE -j $BUILD_JOBS
106
107 cd -
108-cp $builddir/out/target/product/$codename/*-$codename.zip ./livecd.ubuntu-touch-$codename.zip
109+cp $builddir/out/target/product/$DEVICE/*-*$DEVICE.zip ./livecd.ubuntu-touch-$DEVICE.zip
110 for image in system recovery boot; do
111- cp $builddir/out/target/product/$codename/$image.img ./livecd.ubuntu-touch-$codename.$image.img
112+ cp $builddir/out/target/product/$DEVICE/$image.img ./livecd.ubuntu-touch-$DEVICE.$image.img
113 done
114-rm -rf $buildir
115+#rm -rf $builddir

Subscribers

People subscribed via source and target branches