Closed
Bug 855003
Opened 12 years ago
Closed 12 years ago
Need a build target for packaging the emulator
Categories
(Firefox OS Graveyard :: GonkIntegration, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: jgriffin, Assigned: jgriffin)
References
Details
Attachments
(2 files, 3 obsolete files)
1.04 KB,
patch
|
jhford
:
review+
|
Details | Diff | Splinter Review |
1.01 KB,
patch
|
mwu
:
review+
|
Details | Diff | Splinter Review |
We need to create a B2G build target for packaging up all the emulator files that are needed to run the emulator elsewhere (i.e., the current contents of emulator.zip).
This is needed to allow buildbot to automatically generate these packages for us.
Assignee | ||
Comment 1•12 years ago
|
||
FTW, I said in an IRC conversation with catlee that the build target would be:
./build.sh package-emulator
which would make an emulator.zip file in out/host.
Assignee | ||
Comment 2•12 years ago
|
||
This adds a 'package-emulator' build target to B2G, that will create a standalone emulator.zip package from the build. It codifies logic that currently resides in a couple of different shell scripts in Jenkins.
The package it produces is 121MB, which is quite an improvement over the 500MB+ packages that we currently make.
Attachment #730293 -
Flags: review?(jhford)
Comment 3•12 years ago
|
||
(In reply to Jonathan Griffin (:jgriffin) from comment #2)
> Created attachment 730293 [details] [diff] [review]
> gonk-misc patch to add 'package-emulator' target
>
> This adds a 'package-emulator' build target to B2G, that will create a
> standalone emulator.zip package from the build. It codifies logic that
> currently resides in a couple of different shell scripts in Jenkins.
>
> The package it produces is 121MB, which is quite an improvement over the
> 500MB+ packages that we currently make.
Any reason why this needs to be in gonk-misc/Android.mk? Let's put it as a script in B2G.git/scripts instead. I don't know the frequency with which we'll be running this packaging logic, but we can get a decent performance improvement by using gnu tar's --transform option to avoid staging the files with cp. I'm not sure if infozip has a --transform equivalent or if using zip files is a hard requirement.
Assignee | ||
Comment 4•12 years ago
|
||
It lives in Android.mk so it can access vars like $HOST_OUT and $PRODUCT_OUT, which otherwise we'd have to guess. Is there a reason it shouldn't live in Android.mk?
Comment 5•12 years ago
|
||
(In reply to Jonathan Griffin (:jgriffin) from comment #4)
> It lives in Android.mk so it can access vars like $HOST_OUT and
> $PRODUCT_OUT, which otherwise we'd have to guess. Is there a reason it
> shouldn't live in Android.mk?
It's adding a bunch of variables and scripting to the makefile. Doing so gets messy quickly. You can grab these variables using "get_build_var" from build/envsetup.sh in a script.
~/b2g/B2G $ cat get-variable.sh
#!/bin/bash
set -e
. setup.sh
PRODUCT_OUT=$(get_build_var PRODUCT_OUT)
HOST_OUT=$(get_build_var HOST_OUT)
echo HOST_OUT: $HOST_OUT PRODUCT_OUT: $PRODUCT_OUT
~/b2g/B2G $ ./get-variable.sh
<snip warnings about llvm-gcc, etc>
HOST_OUT: out/host/darwin-x86 PRODUCT_OUT: out/target/product/generic
Is there any other information that you'd need from the build system?
Assignee | ||
Comment 6•12 years ago
|
||
Ah, thanks. I'll rewrite this as a script, then.
Assignee | ||
Comment 7•12 years ago
|
||
Attachment #730293 -
Attachment is obsolete: true
Attachment #730293 -
Flags: review?(jhford)
Attachment #733136 -
Flags: review?(jhford)
Comment 8•12 years ago
|
||
Comment on attachment 733136 [details] [diff] [review]
B2G script to package emulator
master: fc4a2b87306d22d094f3d8114b5b8e903059ffc1
I didn't have an emulator build handy, so I used a shortened list of files which didn't include anything generated by a build, and verified that {PRODUCT,HOST}_OUT worked.
A minor nit, the 'out' directory hard code can be avoided with:
diff --git a/scripts/package-emulator.sh b/scripts/package-emulator.sh
index 96a7e15..2cf713c 100755
--- a/scripts/package-emulator.sh
+++ b/scripts/package-emulator.sh
@@ -5,5 +5,5 @@ cd ..
PRODUCT_OUT=$(get_build_var PRODUCT_OUT)
HOST_OUT=$(get_build_var HOST_OUT)
-TOP=$(pwd)
+OUT_DIR=$(get_abs_build_var OUT_DIR)
EMULATOR_FILES=(\
@@ -26,5 +26,5 @@ EMULATOR_FILES=(\
${PRODUCT_OUT}/hardware-qemu.ini)
-EMULATOR_ARCHIVE="${TOP}/out/emulator.tar.gz"
+EMULATOR_ARCHIVE="${OUT_DIR}/emulator.tar.gz"
echo "Creating emulator archive at $EMULATOR_ARCHIVE"
Attachment #733136 -
Flags: review?(jhford) → review+
Assignee | ||
Comment 10•12 years ago
|
||
Thanks jhford.
Catlee, this adds a 'package-emulator.sh' script to the 'scripts' directory of the B2G repo; you can call this to package up the emulator as out/emulator.tar.gz.
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Comment 11•12 years ago
|
||
doh
why wasn't this moved into a build target? the current implementation means we have to special case packaging for emulators
Assignee | ||
Comment 12•12 years ago
|
||
(In reply to Chris AtLee [:catlee] from comment #11)
> doh
>
> why wasn't this moved into a build target? the current implementation means
> we have to special case packaging for emulators
mwu didn't want it as a build target.
Assignee | ||
Comment 13•12 years ago
|
||
Sorry, it was jhford that axed the build target idea. I'll let him explain the reasoning.
Comment 14•12 years ago
|
||
It's 11:30pm, I'm exhausted and have a flight in 4 hours, so i hope this is coherent.
It added a lot of variables and phony recipes which makes the makefile messier. I'm not seeing any package target definitions anywhere else. Where is the code that is defined for other devices that makes this the emulator a special case?
Comment 15•12 years ago
|
||
'build.sh' produces packages for most targets that are uploadable as the final build artifacts.
In some cases, we need to call specific targets in build.sh to produce specific packages, e.g.
https://hg.mozilla.org/mozilla-central/file/c74f44828165/b2g/config/panda/config.json#l7
means we call 'build.sh boottarball systemtarball userdatatarball package-tests' for panda builds.
having a build.sh target for emulator packages would greatly simply the integration with build automation, we could use the hooks that already exist.
could 'package-emulator' be added as a build.sh target that calls this new script?
Flags: needinfo?(jhford)
Updated•12 years ago
|
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Comment 16•12 years ago
|
||
Mike, :jhford is on PTO this week. Can you provide input on Chris' suggestion in comment #15?
Flags: needinfo?(jhford) → needinfo?(mwu)
Comment 17•12 years ago
|
||
(In reply to Chris AtLee [:catlee] from comment #15)
> could 'package-emulator' be added as a build.sh target that calls this new
> script?
That sounds reasonable. gonk-misc/Android.mk is a good place for the rule to live. It might make life easier if the script is moved from B2G.git to gonk-misc.
It might be worthwhile to adapt the script to optionally be able to use the build system variables passed in as environment variables when invoked from the rule.
Flags: needinfo?(mwu)
Assignee | ||
Comment 18•12 years ago
|
||
If this lands, I'll remove package-emulator.sh from B2G.git.
Attachment #743698 -
Flags: review?(jhford)
Comment 19•12 years ago
|
||
Comment on attachment 743698 [details] [diff] [review]
./build.sh target for package-emulator
Review of attachment 743698 [details] [diff] [review]:
-----------------------------------------------------------------
This looks good, assuming the switch to using OUT_DIR instead of hardcoding $(pwd)/out/...
::: package-emulator.sh
@@ +22,5 @@
> + ${PRODUCT_OUT}/system.img \
> + ${PRODUCT_OUT}/userdata.img \
> + ${PRODUCT_OUT}/ramdisk.img)
> +
> +EMULATOR_ARCHIVE="${TOP}/out/emulator.tar.gz"
Instead of hardcoding the /out/ directory, can you instead use the OUT_DIR build system variable?
e.g.:
EMULATOR_ARCHIVE="${OUT_DIR}/emulator.tar.gz"
Attachment #743698 -
Flags: review?(jhford) → review+
Comment 20•12 years ago
|
||
Comment on attachment 743698 [details] [diff] [review]
./build.sh target for package-emulator
Review of attachment 743698 [details] [diff] [review]:
-----------------------------------------------------------------
This looks like it could be trivially done correctly in Android.mk. The original patch was definitely overcomplicated, but this belongs in a makefile rule if you're only calling tar. Don't use phony for this though - make it dependent on the files that it's sticking into the tarball.
Assignee | ||
Comment 21•12 years ago
|
||
Review comments addressed.
Attachment #743698 -
Attachment is obsolete: true
Attachment #743736 -
Flags: review?(mwu)
Comment 22•12 years ago
|
||
Comment on attachment 743736 [details] [diff] [review]
./build.sh target for package-emulator
Review of attachment 743736 [details] [diff] [review]:
-----------------------------------------------------------------
::: Android.mk
@@ +304,5 @@
> + $(PRODUCT_OUT)/system.img \
> + $(PRODUCT_OUT)/userdata.img \
> + $(PRODUCT_OUT)/ramdisk.img
> +$(EMULATOR_FILES): package-emulator
> +package-emulator:
$(EMULATOR_FILES): package-emulator makes those files dependent on package-emulator.
I think you meant something like:
package-emulator: $(EMULATOR_FILES)
or something like this, which is more "correct":
EMULATOR_ARCHIVE:="$(OUT_DIR)/emulator.tar.gz"
package-emulator: $(EMULATOR_ARCHIVE)
$(EMULATOR_ARCHIVE): $(EMULATOR_FILES)
And if you do this, you can use automatic variables to specify the input and output files. http://www.gnu.org/software/make/manual/html_node/Automatic-Variables.html
Assignee | ||
Comment 23•12 years ago
|
||
Cool, thanks, I'm improving my makefile fu.
Attachment #743736 -
Attachment is obsolete: true
Attachment #743736 -
Flags: review?(mwu)
Attachment #743879 -
Flags: review?(mwu)
Comment 24•12 years ago
|
||
Comment on attachment 743879 [details] [diff] [review]
./build.sh target for package-emulator
Review of attachment 743879 [details] [diff] [review]:
-----------------------------------------------------------------
Looks good. I think this belongs in the emulator device directory rather than gonk-misc, but we can move it later. (we don't currently have a emulator device directory)
::: Android.mk
@@ +307,5 @@
> +EMULATOR_ARCHIVE:="$(OUT_DIR)/emulator.tar.gz"
> +package-emulator: $(EMULATOR_ARCHIVE)
> +$(EMULATOR_ARCHIVE): $(EMULATOR_FILES)
> + echo "Creating emulator archive at $@" && \
> + rm -rf $@ && \
rm -f might be better since we're not expecting emulator.tar.gz to be a directory.
Attachment #743879 -
Flags: review?(mwu) → review+
Assignee | ||
Comment 25•12 years ago
|
||
Status: REOPENED → RESOLVED
Closed: 12 years ago → 12 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•