Closed Bug 1114718 Opened 5 years ago Closed 4 years ago

Extend `mach bootstrap` to create an environment for Firefox for Android development on Arch Linux

Categories

(Firefox Build System :: General, defect)

All
Linux
defect
Not set

Tracking

(firefox44 fixed)

RESOLVED FIXED
mozilla44
Tracking Status
firefox44 --- fixed

People

(Reporter: mcomella, Unassigned)

References

Details

Attachments

(6 files)

Feel free to take this if you're interested in working on it (*cough* Kitching *cough* ;).
Unfortunately, my computer died and I now have a Macbook (heresy, I know!) so I won't be able to complete this bug.
Assignee: michael.l.comella → nobody
Status: ASSIGNED → NEW
The relevant code is all in https://dxr.mozilla.org/mozilla-central/source/python/mozboot/mozboot.

I see support for Desktop already in https://dxr.mozilla.org/mozilla-central/source/python/mozboot/mozboot/archlinux.py; this ticket would be about adding mobile/android support.  There is an example of how this should look in https://dxr.mozilla.org/mozilla-central/source/python/mozboot/mozboot/debian.py.

You'd need to work out the separation between system packages (for doing development), and the browser and mobile/android packages (for Desktop and Fennec, respectively).  Then use the tools in android.py, just like the other examples, to install Android packages and print paths, etc.

This is open-ended but I can provide more guidance as necessary.
To test your changes, you can just run |mach bootstrap|.
(In reply to Michael Comella (:mcomella) from comment #1)
> Unfortunately, my computer died and I now have a Macbook (heresy, I know!)
> so I won't be able to complete this bug.

You managed to kill a ThinkPad?

What *are* you?


I poured a pint of milk into mine last month. It made an exciting fizzing noise and turned off. When I took it apart I found milk in places where milk was not meant to go:
https://www.dropbox.com/s/qjlrtr35ybj5s5k/MILK.jpg?dl=0

... And it was fine when I put it back together.


How did you achieve this?
(In reply to Chris Kitching [:ckitching] from comment #4)
> How did you achieve this?

I could have been clearer - the ThinkPad is alright, I'm no monster! But the ThinkPad must not have liked me ordering a MacBook so it proceeded to kill my hard drive!
Duplicate of this bug: 1202819
Summary: Extend `mach bootstrap` to support Arch Linux systems → Extend `mach bootstrap` to create an environment for Firefox for Android development on Arch Linux
After patching the file and running bootstrap.py I got the following error:


Executing as root: sudo pacman -S --add-architecture i386
pacman: unrecognized option '--add-architecture'
Traceback (most recent call last):
  File "bootstrap.py", line 161, in <module>
    sys.exit(main(sys.argv))
  File "bootstrap.py", line 152, in main
    dasboot.bootstrap()
  File "../mozboot/bootstrap.py", line 137, in bootstrap
    getattr(self.instance, 'install_%s_packages' % application)()
  File "../mozboot/archlinux.py", line 107, in install_mobile_android_packages
    self.run_as_root(['pacman','-S', '--add-architecture', 'i386'])
  File "../mozboot/base.py", line 159, in run_as_root
    subprocess.check_call(command, stdin=sys.stdin)
  File "/usr/lib/python2.7/subprocess.py", line 540, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '[u'sudo', 'pacman', '-S', '--add-architecture', 'i386']' returned non-zero exit status 1


Please help me in proceeding with the bug!
Flags: needinfo?(nalexander)
Comment on attachment 8674422 [details] [diff] [review]
patch.diff ---> is the file that replicates the changes i made in archlinux.py

Review of attachment 8674422 [details] [diff] [review]:
-----------------------------------------------------------------

Great start!  I think my comments should unblock you... thanks for looking at this!

::: python/mozboot/mozboot/archlinux.py
@@ +103,5 @@
> +        # and that conflicts with 64-bit Debian and Ubuntu installations out of
> +        # the box.  The solution is to add the i386 architecture.  See
> +        # "Troubleshooting Ubuntu" at
> +        # http://developer.android.com/sdk/installing/index.html?pkg=tools.
> +        self.run_as_root(['pacman','-S', '--add-architecture', 'i386'])

I doubt you need this -- it's pretty Debian specific.  In fact, Debian probably doesn't need it anymore.  Kill this.

@@ +105,5 @@
> +        # "Troubleshooting Ubuntu" at
> +        # http://developer.android.com/sdk/installing/index.html?pkg=tools.
> +        self.run_as_root(['pacman','-S', '--add-architecture', 'i386'])
> +        # After adding a new arch, the list of packages has to be updated
> +        self.apt_update()

archlinux has `pacman_update` and `pacman_install`, since it doesn't use apt at all.

@@ +127,5 @@
> +
> +        # 3. We expect the |android| tool to at
> +        # ~/.mozbuild/android-sdk-linux/tools/android.
> +        android_tool = os.path.join(self.sdk_path, 'tools', 'android')
> +        android.ensure_android_packages(android_tool=android_tool)      

nit: kill trailing whitespace, remove commented part.

@@ +135,5 @@
> +    
> +    def suggest_mobile_android_mozconfig(self):
> +        import android
> +        android.suggest_mozconfig(sdk_path=self.sdk_path,
> +                                  ndk_path=self.ndk_path)

nit: add trailing newline here.
Attachment #8674422 - Flags: feedback+
This is the patch created after suggested review of patch.diff.
It now runs bootstrap successfully yet there are problems in ./mach build
This file contains build logs of the ./mach build
These logs are generated when I ran the ./mach build a second time
Comment on attachment 8675040 [details]
buildlog -- File containing the execution logs of ./mach build

 2:46.30 /bin/sh: /home/dev/.mozbuild/android-sdk-linux/build-tools/23.0.1/aapt: No such file or directory

That shows you don't actually have the Android SDK correctly installed.  Can you:

1) show me the contents of ~/.mozbuild/android-sdk-linux, to make sure |mach bootstrap| actually populated it;
2) run |mach configure| and show me the output of that command;
3) show me the output of $OBJDIR/config.status as well.

Thanks!
Flags: needinfo?(nalexander) → needinfo?(devendra.y12)
1. Contents of  ~/.mozbuild/android-sdk-linux
add-ons  build-tools  extras  platforms  platform-tools  SDK Readme.txt  temp  tools

2. Output of ./mach configure in the machConfigureLog file
Attached file config.status
3. OBJDIR/config.status file
Flags: needinfo?(devendra.y12)
Bug 1114718 - Add mobile/android builds to Arch Linux bootstrapper. r?gps
Attachment #8675950 - Flags: review?(gps)
Comment on attachment 8675950 [details]
MozReview Request: Bug 1114718 - Add mobile/android builds to Arch Linux bootstrapper. r?gps

Not ready for review quite yet.  Devendra, can you apply this patch and test for me?  Thanks!
Attachment #8675950 - Flags: review?(gps) → feedback?(devendra.y12)
(In reply to Nick Alexander :nalexander from comment #15)
> Comment on attachment 8675950 [details]
> MozReview Request: Bug 1114718 - Add mobile/android builds to Arch Linux
> bootstrapper. r?gps
> 
> Not ready for review quite yet.  Devendra, can you apply this patch and test
> for me?  Thanks!

The patch worked fine. Build successful!
Comment on attachment 8675950 [details]
MozReview Request: Bug 1114718 - Add mobile/android builds to Arch Linux bootstrapper. r?gps

mcomella: Mostly needs a Python sanity check, if you will.  I have a successful tester and gps is on PTO.
Attachment #8675950 - Flags: review?(michael.l.comella)
Attachment #8675950 - Flags: feedback?(devendra.y12)
Attachment #8675950 - Flags: feedback+
Attachment #8675950 - Flags: review?(michael.l.comella) → review+
Comment on attachment 8675950 [details]
MozReview Request: Bug 1114718 - Add mobile/android builds to Arch Linux bootstrapper. r?gps

https://reviewboard.mozilla.org/r/22515/#review20269

Disclaimer to my little knowledge on the bootstrap process, this looks good to me!

::: python/mozboot/mozboot/archlinux.py:68
(Diff revision 1)
> +        'jdk7-openjdk',

What if the user has the non-open JDK installed? Perhaps a follow-up to preserve user preference?

::: python/mozboot/mozboot/archlinux.py:118
(Diff revision 1)
> +            self.ndk_url = 'https://dl.google.com/android/ndk/android-ndk-r10e-linux-x86_64.bin'

It might be more robust to do this with a string format call – mentorable follow-up?

::: python/mozboot/mozboot/archlinux.py:126
(Diff revision 1)
> +    

nit: ws
(In reply to Michael Comella (:mcomella) from comment #18)
> Comment on attachment 8675950 [details]
> MozReview Request: Bug 1114718 - Add mobile/android builds to Arch Linux
> bootstrapper. r?gps
> 
> https://reviewboard.mozilla.org/r/22515/#review20269
> 
> Disclaimer to my little knowledge on the bootstrap process, this looks good
> to me!
> 
> ::: python/mozboot/mozboot/archlinux.py:68
> (Diff revision 1)
> > +        'jdk7-openjdk',
> 
> What if the user has the non-open JDK installed? Perhaps a follow-up to
> preserve user preference?

Not a bad idea: there's an "archlinux-java" option picker, like Debian's system for options.  https://wiki.archlinux.org/index.php/Java#List_compatible_Java_environments_installed

For now, we can force; let's do this if and when somebody cares about it.

> ::: python/mozboot/mozboot/archlinux.py:118
> (Diff revision 1)
> > +            self.ndk_url = 'https://dl.google.com/android/ndk/android-ndk-r10e-linux-x86_64.bin'
> 
> It might be more robust to do this with a string format call – mentorable
> follow-up?

Good idea, and good to unify across operating systems too.

> ::: python/mozboot/mozboot/archlinux.py:126
> (Diff revision 1)
> > +    
> 
> nit: ws

Ta.
https://hg.mozilla.org/integration/fx-team/rev/9b249dc7978b6f96de67ea55b9696fbad3c26c4e
Bug 1114718 - Make |mach bootstrap| support 'mobile/android' builds on Arch Linux. r=mcomella
https://hg.mozilla.org/mozilla-central/rev/9b249dc7978b
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla44
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.