Support --no-interactive in |mach bootstrap| for mobile/android

RESOLVED FIXED in Firefox 56

Status

enhancement
RESOLVED FIXED
2 years ago
2 years ago

People

(Reporter: nalexander, Assigned: nalexander)

Tracking

unspecified
mozilla56

Firefox Tracking Flags

(firefox56 fixed)

Details

Attachments

(2 attachments)

Right now |mach bootstrap --no-interactive| will prompt to accept Android SDK licenses, which makes it hard to run the bootstrapper during docker image creation.  This ticket tracks trying to work around the isssue.

There are two main ways to achieve this:

- using a "yes"-like Python program to push "y" at stdin
- writing certain magic files to disk with "license hashes" in them.

The former is robust but seems difficult to get "just right" in Python.  The latter will fall out of date (eventually) but is easy to get correct.
Comment on attachment 8889986 [details]
Bug 1384202 - Add --no-interactive bootstrap support for Android SDK and NDK.

https://reviewboard.mozilla.org/r/161048/#review166410

::: python/mozboot/mozboot/android.py:144
(Diff revision 1)
>      ndk_path = os.environ.get('ANDROID_NDK_HOME',
>                                os.path.join(mozbuild_path, 'android-ndk-r11c'))
>      return (mozbuild_path, sdk_path, ndk_path)
>  
>  
> -def ensure_android(os_name, artifact_mode):
> +def ensure_dir(dir):

This could go in the utils module, but then you'd have to import it, so probably not worthwhile until we need it in more than one place.

::: python/mozboot/mozboot/android.py:189
(Diff revision 1)
> +            'android-sdk-preview-license': '84831b9409646a918e30573bab4c9c91346d8abd',
> +        }
> +        for license, tag in licenses.items():
> +            lname = os.path.join(path, license)
> +            if not os.path.isfile(lname):
> +                open(lname, 'wt').write('\n{}\n'.format(tag))

What does the `t` in the `open` mode do? Text with native line endings is the default in Python. Something about msys?

::: python/mozboot/mozboot/android.py:277
(Diff revision 1)
>      import platform
>  
>      parser = optparse.OptionParser()
>      parser.add_option('-a', '--artifact-mode', dest='artifact_mode', action='store_true',
>                        help='If true, install only the Android SDK (and not the Android NDK).')
> +    parser.add_option('--no-interactive', dest='no_interactive', action='store_true',

Would it be better to call this something like `--accept-licenses`? I guess `--no-interactive` often means "say yes to prompts" and it matches the higher-level command.
Attachment #8889986 - Flags: review?(giles) → review+
Comment on attachment 8889985 [details]
Bug 1384202 - Pre: Make mozboot/android.py an executable script.

https://reviewboard.mozilla.org/r/161046/#review166422
Attachment #8889985 - Flags: review?(giles) → review+
Comment on attachment 8889986 [details]
Bug 1384202 - Add --no-interactive bootstrap support for Android SDK and NDK.

https://reviewboard.mozilla.org/r/161048/#review166410

> This could go in the utils module, but then you'd have to import it, so probably not worthwhile until we need it in more than one place.

That was my thinking.

> What does the `t` in the `open` mode do? Text with native line endings is the default in Python. Something about msys?

I'm just in the habit of always specifying 'wt' or 'wb'.  I'll drop the 't'.

> Would it be better to call this something like `--accept-licenses`? I guess `--no-interactive` often means "say yes to prompts" and it matches the higher-level command.

Yeah, I wanted to match the high-level command.
Pushed by nalexander@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/bcfce9e21f29
Pre: Make mozboot/android.py an executable script. r=rillian
https://hg.mozilla.org/integration/autoland/rev/95b831898973
Add --no-interactive bootstrap support for Android SDK and NDK. r=rillian
https://hg.mozilla.org/mozilla-central/rev/bcfce9e21f29
https://hg.mozilla.org/mozilla-central/rev/95b831898973
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla56
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.