Skip to content
This repository has been archived by the owner on May 8, 2020. It is now read-only.

Commit

Permalink
rail's comments
Browse files Browse the repository at this point in the history
  • Loading branch information
escapewindow committed Feb 1, 2012
1 parent 3d97575 commit 02127a5
Showing 1 changed file with 23 additions and 13 deletions.
36 changes: 23 additions & 13 deletions scripts/sign_android.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,12 +307,19 @@ def _sign(self, apk, meta_inf=True, error_list=None):
# 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?)
p = subprocess.Popen([jarsigner, "-keystore", c['keystore'],
"-storepass", self.store_passphrase,
"-keypass", self.key_passphrase,
apk, c['key_alias']],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
try:
p = subprocess.Popen([jarsigner, "-keystore", c['keystore'],
"-storepass", self.store_passphrase,
"-keypass", self.key_passphrase,
apk, c['key_alias']],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
except OSError:
self.dump_exception("Error while signing %s (missing %s?):" % (apk, jarsigner))
return -1
except ValueError:
self.dump_exception("Popen called with invalid arguments during signing?")
return -2
parser = OutputParser(config=self.config, log_obj=self.log_obj,
error_list=error_list)
loop = True
Expand All @@ -327,14 +334,15 @@ def _sign(self, apk, meta_inf=True, error_list=None):
def add_failure(self, platform, locale,
message="%(platform)s:%(locale)s failed.",
level=ERROR):
s = "%s_%s" % (platform, locale)
s = "%s:%s" % (platform, locale)
if s not in self.failures:
self.failures.append(s)
self.return_code += 1
self.add_summary(message, level=level)
self.add_summary(message % {'platform': platform, 'locale': locale},
level=level)

def query_failure(self, platform, locale):
s = "%s_%s" % (platform, locale)
s = "%s:%s" % (platform, locale)
return s in self.failures

# Actions {{{2
Expand All @@ -350,6 +358,8 @@ def verify_passphrases(self):
error_list=TEST_JARSIGNER_ERROR_LIST)
if status == 0:
self.info("Passphrases are good.")
elif status < 0:
self.fatal("Encountered errors while trying to sign!")
else:
self.fatal("Unable to verify passphrases!")

Expand Down Expand Up @@ -398,7 +408,7 @@ def download_unsigned_bits(self):
total_count += 1
if not self.download_file(url, file_path):
self.add_failure(platform, locale,
message="Unable to download %s:%s unsigned apk!" % (platform, locale))
message="Unable to download %(platform)s:%(locale)s unsigned apk!")
else:
successful_count += 1
level = INFO
Expand Down Expand Up @@ -444,7 +454,7 @@ def sign(self):
unsigned_path, signed_path],
error_list=BaseErrorList):
self.add_failure(platform, locale,
message="Unable to align %s:%s apk!" % (platform, locale))
message="Unable to align %(platform)s:%(locale)s apk!")
self.rmtree(signed_dir)
else:
successful_count += 1
Expand Down Expand Up @@ -486,7 +496,7 @@ def verify_signatures(self):
if not os.path.exists(os.path.join(dirs['abs_work_dir'],
signed_path)):
self.add_failure(platform, locale,
message="Can't sign nonexistent %s:%s apk!" % (platform, locale))
message="Can't verify nonexistent %(platform)s:%(locale)s apk!")
continue
status = self.run_command(
[c['signature_verification_script'],
Expand All @@ -499,7 +509,7 @@ def verify_signatures(self):
)
if status:
self.add_failure(platform, locale,
message="Errors signing %s:%s apk!" % (platform, locale))
message="Errors verifying %(platform)s:%(locale)s apk!")

def upload_signed_bits(self):
c = self.config
Expand Down

0 comments on commit 02127a5

Please sign in to comment.