Opened 3 years ago

Closed 3 years ago

Last modified 2 years ago

#5129 closed defect (fixed)

[build] Signing fails if zipalign is not in PATH

Reported by: fhd Assignee: diegocarloslima
Priority: P2 Milestone: Adblock-Browser-for-Android-1.2.0
Module: Adblock-Browser-for-Android Keywords:
Cc: diegocarloslima Blocked By:
Blocking: Platform: Adblock Browser for Android
Ready: yes Confidential: no
Tester: Scheer Verified working: yes
Review URL(s):

https://codereview.adblockplus.org/29420572/

Description

Environment

Ubuntu 16.04, adblockbrowser-build revision bb6d66b3c073.

How to reproduce

  1. Run ./build.py build.
  2. Run ./build.py sign PATH where PATH is the location of the APK generated by the previous step.

Observed behaviour

build.py exits with an error. The last few lines of the output:

jar signed.

Warning: 
No -tsa or -tsacert is provided and this jar is not timestamped. Without a timestamp, users may not be able to validate this jar after the signer certificate's expiration date (2112-07-20) or after any future revocation date.
Traceback (most recent call last):
  File "./build.py", line 163, in <module>
    _sign(apk_path, config.ANDROID_KEYSTORE_PATH, config.ANDROID_KEY_NAME)
  File "./build.py", line 115, in _sign
    subprocess.check_call(["zipalign", "-v", "4", temp_apk_path, apk_path])
  File "/usr/lib/python2.7/subprocess.py", line 536, in check_call
    retcode = call(*popenargs, **kwargs)
  File "/usr/lib/python2.7/subprocess.py", line 523, in call
    return Popen(*popenargs, **kwargs).wait()
  File "/usr/lib/python2.7/subprocess.py", line 711, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1343, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

Expected behaviour

The APK should be signed and build.py should exit without errors.

Change History (9)

comment:1 Changed 3 years ago by fhd

  • Owner set to fhd

comment:2 Changed 3 years ago by fhd

I've removed the warning by supplying the -tsa argument, but the build still fails. Investigating.

comment:3 Changed 3 years ago by fhd

  • Summary changed from [build] Signing fails due to jarsigner warning to [build] Signing fails if zipalign is not in PATH

Turns out, jarsigner isn't actually the culprit - zipalign is. I just didn't have the executable in my PATH.

I figure we have two options:

1) We make build.py check that zipalign is in PATH before it begins the signing process.
2) We don't expect zipalign in the PATH to begin with.

I'm leaning towards (2) - even if that means hard coding the build tools version (it's zipalign's path). The alternative is to manually ensure the correct version of zipalign is in PATH on each system, seems error prone.

Diego, what do you think?

comment:4 Changed 3 years ago by diegocarloslima

  • Owner changed from fhd to diegocarloslima
  • Platform changed from Unknown / Cross platform to Adblock Browser for Android

comment:5 Changed 3 years ago by diegocarloslima

Yeah, approach 2 seems a better way of solving this. There's a ANDROID_BUILD_TOOLS_VERSION in Mozilla's code which we can use in order to get the path for the zipalign tool

comment:6 Changed 3 years ago by diegocarloslima

  • Review URL(s) modified (diff)
  • Status changed from new to reviewing

comment:7 Changed 3 years ago by abpbot

A commit referencing this issue has landed:
Issue 5129 - [build Signing fails if zipalign is not in PATH]

comment:8 Changed 3 years ago by diegocarloslima

  • Milestone set to Adblock-Browser-for-Android-next
  • Resolution set to fixed
  • Status changed from reviewing to closed

comment:9 Changed 2 years ago by scheer

  • Tester changed from Unknown to Scheer
  • Verified working set

adblockbrowser-1.1.1.20170612182010-arm
Galaxy S7
Android 7.0

Note: See TracTickets for help on using tickets.