Exemplo n.º 1
0
    def upload_repacks(self):
        c = self.config
        dirs = self.query_abs_dirs()
        locales = self.query_locales()
        make = self.query_exe("make")
        base_package_name = self.query_base_package_name()
        version = self.query_version()
        upload_env = self.query_upload_env()
        success_count = total_count = 0
        buildnum = None
        if c.get('release_config_file'):
            rc = self.query_release_config()
            buildnum = rc['buildnum']
        for locale in locales:
            if self.query_failure(locale):
                self.warning("Skipping previously failed locale %s." % locale)
                continue
            total_count += 1
            if c.get('base_post_upload_cmd'):
                upload_env['POST_UPLOAD_CMD'] = c['base_post_upload_cmd'] % {'version': version, 'locale': locale, 'buildnum': str(buildnum), 'post_upload_extra': ' '.join(c.get('post_upload_extra', []))}
            output = self.get_output_from_command_m(
                # Ugly hack to avoid |make upload| stderr from showing up
                # as get_output_from_command errors
                "%s upload AB_CD=%s 2>&1" % (make, locale),
                cwd=dirs['abs_locales_dir'],
                env=upload_env,
                silent=True
            )
            parser = OutputParser(config=self.config, log_obj=self.log_obj,
                                  error_list=MakefileErrorList)
            parser.add_lines(output)
            if parser.num_errors:
                self.add_failure(locale, message="%s failed in make upload!" % (locale))
                continue
            package_name = base_package_name % {'locale': locale}
            r = re.compile("(http.*%s)" % package_name)
            for line in output.splitlines():
                m = r.match(line)
                if m:
                    self.upload_urls[locale] = m.groups()[0]
                    self.info("Found upload url %s" % self.upload_urls[locale])

            # XXX Move the files to a SIMPLE_NAME format until we can enable
            #     Simple names in the build system
            if self.config.get("simple_name_move"):
                # Assume an UPLOAD PATH
                upload_target = self.config["upload_env"]["UPLOAD_PATH"]
                target_path = os.path.join(upload_target, locale)
                self.mkdir_p(target_path)
                glob_name = "*.%s.android-arm.*" % locale
                for f in glob.glob(os.path.join(upload_target, glob_name)):
                    glob_extension = f[f.rfind('.'):]
                    self.move(os.path.join(f),
                              os.path.join(target_path, "target%s" % glob_extension))
                self.log("Converted uploads for %s to simple names" % locale)
            success_count += 1
        self.summarize_success_count(success_count, total_count,
                                     message="Make Upload for %d of %d locales successful.")
Exemplo n.º 2
0
 def upload_repacks(self):
     c = self.config
     dirs = self.query_abs_dirs()
     locales = self.query_locales()
     make = self.query_exe("make")
     base_package_name = self.query_base_package_name()
     version = self.query_version()
     upload_env = self.query_upload_env()
     success_count = total_count = 0
     buildnum = None
     if c.get('release_config_file'):
         rc = self.query_release_config()
         buildnum = rc['buildnum']
     for locale in locales:
         if self.query_failure(locale):
             self.warning("Skipping previously failed locale %s." % locale)
             continue
         total_count += 1
         if c.get('base_post_upload_cmd'):
             upload_env['POST_UPLOAD_CMD'] = c['base_post_upload_cmd'] % {
                 'version': version,
                 'locale': locale,
                 'buildnum': str(buildnum),
                 'post_upload_extra': ' '.join(
                     c.get('post_upload_extra', []))
             }
         output = self.get_output_from_command_m(
             # Ugly hack to avoid |make upload| stderr from showing up
             # as get_output_from_command errors
             "%s upload AB_CD=%s 2>&1" % (make, locale),
             cwd=dirs['abs_locales_dir'],
             env=upload_env,
             silent=True)
         parser = OutputParser(config=self.config,
                               log_obj=self.log_obj,
                               error_list=MakefileErrorList)
         parser.add_lines(output)
         if parser.num_errors:
             self.add_failure(locale,
                              message="%s failed in make upload!" %
                              (locale))
             continue
         package_name = base_package_name % {'locale': locale}
         r = re.compile("(http.*%s)" % package_name)
         for line in output.splitlines():
             m = r.match(line)
             if m:
                 self.upload_urls[locale] = m.groups()[0]
                 self.info("Found upload url %s" % self.upload_urls[locale])
         success_count += 1
     self.summarize_success_count(
         success_count,
         total_count,
         message="Make Upload for %d of %d locales successful.")
Exemplo n.º 3
0
 def _query_make_variable(self, variable, make_args=None):
     make = self.query_exe('make')
     env = self.query_repack_env()
     dirs = self.query_abs_dirs()
     if make_args is None:
         make_args = []
     # TODO error checking
     output = self.get_output_from_command_m(
         [make, "echo-variable-%s" % variable] + make_args,
         cwd=dirs['abs_locales_dir'], silent=True,
         env=env
     )
     parser = OutputParser(config=self.config, log_obj=self.log_obj,
                           error_list=MakefileErrorList)
     parser.add_lines(output)
     return output.strip()
Exemplo n.º 4
0
 def sign_apk(self, apk, keystore, storepass, keypass, key_alias,
              remove_signature=True, error_list=None,
              log_level=INFO, error_level=ERROR):
     """
     Signs an apk with jarsigner.
     """
     jarsigner = self.query_exe('jarsigner')
     if remove_signature:
         status = self.unsign_apk(apk)
         if status:
             self.error("Can't remove signature in %s!" % apk)
             return -1
     if error_list is None:
         error_list = JarsignerErrorList[:]
     # This needs to run silently, so no run_command() or
     # get_output_from_command() (though I could add a
     # suppress_command_echo=True or something?)
     self.log("(signing %s)" % apk, level=log_level)
     try:
         p = subprocess.Popen([jarsigner, "-keystore", keystore,
                              "-storepass", storepass,
                              "-keypass", keypass,
                              apk, key_alias],
                              stdout=subprocess.PIPE,
                              stderr=subprocess.STDOUT,
                              bufsize=0)
     except OSError:
         self.exception("Error while signing %s (missing %s?):" % (apk, jarsigner))
         return -2
     except ValueError:
         self.exception("Popen called with invalid arguments during signing?")
         return -3
     parser = OutputParser(config=self.config, log_obj=self.log_obj,
                           error_list=error_list)
     loop = True
     while loop:
         if p.poll() is not None:
             """Avoid losing the final lines of the log?"""
             loop = False
         for line in p.stdout:
             parser.add_lines(line)
     if parser.num_errors:
         self.log("(failure)", level=error_level)
     else:
         self.log("(success)", level=log_level)
     return parser.num_errors
Exemplo n.º 5
0
 def _query_make_ident_output(self):
     """Get |make ident| output from the objdir.
     Only valid after setup is run.
     """
     if self.make_ident_output:
         return self.make_ident_output
     env = self.query_repack_env()
     dirs = self.query_abs_dirs()
     output = self.get_output_from_command_m(["make", "ident"],
                                             cwd=dirs['abs_locales_dir'],
                                             env=env,
                                             silent=True,
                                             halt_on_failure=True)
     parser = OutputParser(config=self.config, log_obj=self.log_obj,
                           error_list=MakefileErrorList)
     parser.add_lines(output)
     self.make_ident_output = output
     return output