Esempio n. 1
0
def main(name=None):
    if name not in ('__main__', None):
        return

    from mozapkpublisher.common import main_logging
    main_logging.init()

    parser = ArgumentParser(
        description="""Update the descriptions of an application (multilang)

        Example for updating beta:
        $ python update_apk_description.py --service-account [email protected] \
        --package-name org.mozilla.firefox_beta --credentials key.p12""",
        formatter_class=argparse.RawDescriptionHelpFormatter,
    )

    googleplay.add_general_google_play_arguments(parser)
    parser.add_argument(
        '--package-name',
        choices=store_l10n.STORE_PRODUCT_DETAILS_PER_PACKAGE_NAME.keys(),
        help='The Google play name of the app',
        required=True)
    parser.add_argument('--force-locale',
                        help='Force to a specific locale (instead of all)')
    config = parser.parse_args()
    update_apk_description(config.package_name, config.force_locale,
                           config.commit, config.service_account,
                           config.google_play_credentials_file,
                           config.contact_google_play)
Esempio n. 2
0
def main(name=None):
    if name not in ('__main__', None):
        return

    from mozapkpublisher.common import main_logging
    main_logging.init()

    GetL10nStrings().run()
Esempio n. 3
0
def main(name=None):
    if name not in ('__main__', None):
        return

    from mozapkpublisher.common import main_logging
    main_logging.init()

    UpdateDescriptionAPK().run()
Esempio n. 4
0
def push_apk(apks,
             service_account,
             google_play_credentials_file,
             track,
             package_names_check,
             google_play_strings=NoGooglePlayStrings(),
             rollout_percentage=None,
             commit=True,
             contact_google_play=True,
             skip_check_ordered_version_codes=False,
             skip_check_multiple_locales=False,
             skip_check_same_locales=False,
             skip_checks_fennec=False):
    """

    Args:
        apks: list of APK files
        service_account: Google Play service account
        google_play_credentials_file: Credentials file to authenticate to Google Play
        track (str): Google Play track to deploy to (e.g.: "nightly"). If "rollout" is chosen, the parameter
            `rollout_percentage` must be specified as well
        package_names_check: Either mozapkpublisher.common.apk.checker.ExpectedPackageNamesCheck
            or mozapkpublisher.common.apk.checker.AnyPackageNamesCheck
        rollout_percentage (int): percentage of users to roll out this update to. Must be a number between [0-100].
            This option is only valid if `track` is set to "rollout"
        google_play_strings: Either `NoGooglePlayStrings`, `StoreGooglePlayStrings` or `FileGooglePlayStrings`
        commit (bool): `False` to do a dry-run
        contact_google_play (bool): `False` to avoid communicating with Google Play. Useful if you're using mock
            credentials.
        skip_checks_fennec (bool): skip Fennec-specific checks
        skip_check_same_locales (bool): skip check to ensure all APKs have the same locales
        skip_check_multiple_locales (bool): skip check to ensure all APKs have more than one locale
        skip_check_ordered_version_codes (bool): skip check to ensure that ensures all APKs have different version codes
            and that the x86 version code > the arm version code

    """
    # We want to tune down some logs, even when push_apk() isn't called from the command line
    main_logging.init()

    if track == 'rollout' and rollout_percentage is None:
        raise WrongArgumentGiven(
            "When using track='rollout', rollout percentage must be provided too"
        )
    if rollout_percentage is not None and track != 'rollout':
        raise WrongArgumentGiven(
            "When using rollout-percentage, track must be set to rollout")

    PushAPK(apks, service_account, google_play_credentials_file, track,
            package_names_check, google_play_strings, rollout_percentage,
            commit, contact_google_play, skip_check_ordered_version_codes,
            skip_check_multiple_locales, skip_check_same_locales,
            skip_checks_fennec).run()
Esempio n. 5
0
def main(name=None):
    if name not in ('__main__', None):
        return

    from mozapkpublisher.common import main_logging
    main_logging.init()

    try:
        PushAPK().run()
    except WrongArgumentGiven as e:
        PushAPK.parser.print_help(sys.stderr)
        sys.stderr.write('{}: error: {}\n'.format(PushAPK.parser.prog, e))
        sys.exit(2)
Esempio n. 6
0
def main():
    from mozapkpublisher.common import main_logging
    main_logging.init()

    parser = ArgumentParser(
        description='Download APKs of Firefox for Android (aka Fennec) from {}'
        .format(FTP_BASE_URL))

    exclusive_group = parser.add_mutually_exclusive_group(required=True)
    exclusive_group.add_argument(
        '--version',
        default=None,
        help='Specify version number to download (e.g. 23.0b7)')
    exclusive_group.add_argument('--latest-nightly',
                                 action='store_true',
                                 default=False,
                                 help='Download the latest nightly version')

    parser.add_argument('--build',
                        type=int,
                        default=1,
                        help='Specify build number (default 1)')
    parser.add_argument(
        '--arch',
        choices=ARCH_VALUES,
        default='all',
        help=
        'Specify which architecture to get the apk for. Will download every architecture if not set.'
    )
    parser.add_argument('--locale',
                        default='multi',
                        help='Specify which locale to get the apk for')
    parser.add_argument(
        '--output-directory',
        dest='download_directory',
        default='apk-download',
        help=
        'Directory in which APKs will be downloaded to. Will be created if needed.'
    )

    config = parser.parse_args()
    myScript = GetAPK(config.version, config.latest_nightly, config.build,
                      config.arch, config.locale, config.download_directory)
    signal.signal(signal.SIGINT, myScript.signal_handler)
    loop = asyncio.get_event_loop()
    loop.run_until_complete(myScript.run())
Esempio n. 7
0
def main():
    parser = argparse.ArgumentParser(
        description=
        'Check set of APKs is valid. These checks are also performed in push_apk.py'
    )

    add_apk_checks_arguments(parser)

    config = parser.parse_args()

    main_logging.init()

    extract_and_check_apks_metadata(
        config.apks,
        config.expected_package_names,
        config.skip_checks_fennec,
        config.skip_check_multiple_locales,
        config.skip_check_same_locales,
        config.skip_check_ordered_version_codes,
    )
def main(name=None):
    if name not in ('__main__', None):
        return

    from mozapkpublisher.common import main_logging
    main_logging.init()

    parser = ArgumentParser(
        description='Download strings from the l10n store ({})'.format(
            store_l10n.L10N_API_URL))

    parser.add_argument(
        '--package-name',
        choices=store_l10n.STORE_PRODUCT_DETAILS_PER_PACKAGE_NAME.keys(),
        help='The APK package name',
        required=True)
    parser.add_argument('--output-file',
                        type=argparse.FileType('w'),
                        help='The file where strings will be saved to',
                        default='l10n_strings.json')

    config = parser.parse_args()
    get_l10n_strings(config.package_name, config.output_file)
Esempio n. 9
0
def _fetch_checksum_from_file(checksum_file, apk_file):
    base_apk_filepath = _take_out_common_path(checksum_file, apk_file)
    with open(checksum_file, 'r') as fh:
        for line in fh:
            m = re.match(
                r"""^(?P<hash>.*) sha512 (?P<filesize>\d+) {}""".format(
                    base_apk_filepath), line)
            if m:
                gd = m.groupdict()
                logger.info("Found hash {}".format(gd['hash']))
                return gd['hash']
    # old style pre-Fennec 53 checksums files
    with open(checksum_file, 'r') as f:
        checksum = f.read()
    checksum = re.sub("\s(.*)", "", checksum.splitlines()[0])
    logger.info("Found hash {}".format(checksum))
    return checksum


def _take_out_common_path(checksum_file, apk_file):
    return os.path.relpath(apk_file, os.path.dirname(checksum_file))


if __name__ == '__main__':
    from mozapkpublisher.common import main_logging
    main_logging.init()

    myScript = GetAPK()
    signal.signal(signal.SIGINT, myScript.signal_handler)
    myScript.run()