Commit graph

5138 commits

Author SHA1 Message Date
Tao Bao
6b9fef5243 releasetools: Address pylint warnings in add_img_to_target_files.py.
C:661, 0: Wrong hanging indentation (add 2 spaces).
        OPTIONS.input_tmp, "VENDOR_IMAGES")
        ^ | (bad-continuation)
C:673, 0: Wrong continued indentation (add 14 spaces).
                os.path.join("IMAGES", img_name))
                ^             | (bad-continuation)
C: 54, 0: Import "import datetime" should be placed at the top of the module (wrong-import-position)
C: 55, 0: Import "import hashlib" should be placed at the top of the module (wrong-import-position)
C: 56, 0: Import "import os" should be placed at the top of the module (wrong-import-position)
C: 57, 0: Import "import shlex" should be placed at the top of the module (wrong-import-position)
C: 58, 0: Import "import shutil" should be placed at the top of the module (wrong-import-position)
C: 59, 0: Import "import subprocess" should be placed at the top of the module (wrong-import-position)
C: 60, 0: Import "import tempfile" should be placed at the top of the module (wrong-import-position)
C: 61, 0: Import "import uuid" should be placed at the top of the module (wrong-import-position)
C: 62, 0: Import "import zipfile" should be placed at the top of the module (wrong-import-position)
C: 64, 0: Import "import build_image" should be placed at the top of the module (wrong-import-position)
C: 65, 0: Import "import common" should be placed at the top of the module (wrong-import-position)
C: 66, 0: Import "import rangelib" should be placed at the top of the module (wrong-import-position)
C: 67, 0: Import "import sparse_img" should be placed at the top of the module (wrong-import-position)
W:391,12: Redefining built-in 'dir' (redefined-builtin)

After this CL, it still gives the warning below, which is to be
addressed with follow-ups.

R:635, 2: Too many nested blocks (6/5) (too-many-nested-blocks)

Test: `m dist`
Test: pylint --rcfile=pylintrc add_img_to_target_files.py
Change-Id: I64da184b6b69e93449dbfc989a5d7f46d5223f42
2017-12-04 12:15:35 -08:00
Tao Bao
dac0c88d9d releasetools: Remove deprecated pylint options.
This option u'required-attributes' will be removed in Pylint 2.0
This option u'ignore-iface-methods' will be removed in Pylint 2.0

Test: pylint (1.6.5) no longer gives above warnings.
Change-Id: Ib07cd5aef87407260140c1fca0b11c439cbdf390
2017-12-04 12:15:23 -08:00
Dan Willemsen
30f514cc51 Merge changes from topic "clang_supported"
* changes:
  Prepare for clang+mingw windows builds
  Fix / suppress warnings for clang+mingw
2017-11-30 08:05:58 +00:00
Dan Willemsen
25c73e9156 Fix / suppress warnings for clang+mingw
Switch attribute error to attribute unavailable, which apparently works
since it then broke the build :-/

Suppress unused parameter warnings. They aren't that useful for windows
functions that are just #ifndef WIN32. This is marked as a global cflag,
but something is overriding that with the clang+mingw changes, and it's
not actually that hard to suppress or fix where necessary.

Bug: 69933068
Test: mmma build/tools/libhost
Change-Id: I09adda4544bc9b56452b4fe182dba3d0b701dcbb
2017-11-29 20:54:33 -08:00
Tianjie Xu
41390d4e1e Improve the comment in AddSplitTransfers
Bug: 69624507
Test: build an incremental package
Change-Id: I54dac0a2ddcc19b722e352fb19d53ff20444fa42
2017-11-22 11:35:18 -08:00
Tianjie Xu
520c9f0f5f Merge "Fall back to normal split if imgdiff fails when splitting large apks" 2017-11-22 18:28:31 +00:00
Tianjie Xu
f68b50f963 Fall back to normal split if imgdiff fails when splitting large apks
Imgdiff expects the input files to be valid zip archives. During the
split of large apks, imgdiff may fail when there's a hole in the input
file; potentially due to the blocks allocation of mke2fs. This CL solves
the issue by falling back to normal split in case of the imgdiff split
failure. The split transfers will then use bsdiff instead.

Bug: 69624507
Test: generate the incremental package for the failed targets and check the
transfers.
Change-Id: I4882452378123e60ad3434053b57f33e53ac4b82
2017-11-21 23:37:36 -08:00
Tao Bao
d2ae0b0613 check_ota_package_signature.py: Set up PYTHONPATH.
... to include system/update_engine/scripts if ANDROID_BUILD_TOP is set
(e.g. after lunching a target).

Test: ./build/make/tools/releasetools/check_ota_package_signature.py
      works without manually setting PYTHONPATH.
Change-Id: I0c5101fab2dd69cb6a598b909aa04bc4d5f45284
2017-11-21 11:30:27 -08:00
Tao Bao
37066490a5 Merge "releasetools: Allow building AVB-enabled recovery.img." 2017-11-21 17:02:35 +00:00
Colin Cross
3c363ad729 Convert signtos to Android.bp
See build/soong/README.md for more information.

Test: m checkbuild
Change-Id: Ia468cde0492e64858b7a603deba9b22b95e56ff4
2017-11-21 03:26:31 +00:00
Tao Bao
bf70c318b7 releasetools: Allow building AVB-enabled recovery.img.
Bug: 68224784
Test: Enable AVB on aosp_bullhead-userdebug. `m dist`. Note that the
      prebuilt vendor.img needs to be AVB-signed first.
Test: `m dist` with aosp_walleye-userdebug.
Change-Id: I18235e4d0dde6af71a96e46ec434480cc9a22bef
2017-11-20 12:44:18 -08:00
Tao Bao
ae396d9b0c releasetools: Always create IMAGES/ directory.
AddImagesToTargetFiles() takes either a zip file, or a zip root as
input. We used to create IMAGES/ directory only when working with zip
root input. Commit 262bf3f0b5 has changed
to also stage boot / recovery images there when working with a zip file.
This CL makes sure the directory is always available under both modes.

Bug: 63456822
Test: zip -d target_files.zip IMAGES/\*;
      add_img_to_target_files.py target_files.zip
Test: sign_target_files_apks.py target_files.zip signed-target_files.zip
Change-Id: Iea91d0403cdec1b16bb93bb71d3ed06856b8f7c3
2017-11-20 12:44:18 -08:00
Tao Bao
2f7fab9ab9 Merge "releasetools: Fix the rebuilding of vbmeta.img." 2017-11-18 00:22:14 +00:00
Colin Cross
f1f66974c6 Merge changes from topics "soong_logtags", "droiddoc_srcjars"
* changes:
  Allow converting logtags to java without merged logtags file
  Add support for srcjars to droiddoc
2017-11-17 21:32:27 +00:00
Chih-Hung Hsieh
2cd467b36c Recognize new clang-tidy android-* warnings.
Test: warn.py build.log
Change-Id: I9bcd1fffcb567346a3d959f98821e2cf58e87ba2
2017-11-16 15:42:11 -08:00
Colin Cross
0bb782bd4e Allow converting logtags to java without merged logtags file
Most logtags files only have entries with hardcoded numbers.
Allow these files to be converted to java without needing the
merged logtags file.

Test: m checkbuild
Change-Id: I4cd38aa502fc9b8e50af92ff8296d3ad6abfb56e
2017-11-16 14:58:05 -08:00
Tomasz Wasilczyk
4dbdb60698 Merge "Silence superfluous build messages." 2017-11-15 22:27:30 +00:00
Tomasz Wasilczyk
29ec06b7ba Silence superfluous build messages.
Bug: 69315492
Test: it builds
Change-Id: Ic02484b80fa27c53786204402930ed5f33ec7fda
2017-11-15 10:34:01 -08:00
Tao Bao
262bf3f0b5 releasetools: Fix the rebuilding of vbmeta.img.
If only vbmeta.img is missing from the target_files.zip,
'add_img_to_target_files.py -a' will fail to re-create vbmeta.img.

++++ vbmeta ++++

Traceback (most recent call last):
  File "./build/make/tools/releasetools/add_img_to_target_files.py", line 693, in <module>
    main(sys.argv[1:])
  File "./build/make/tools/releasetools/add_img_to_target_files.py", line 687, in main
    AddImagesToTargetFiles(args[0])
  File "./build/make/tools/releasetools/add_img_to_target_files.py", line 584, in AddImagesToTargetFiles
    boot_contents = boot_image.WriteToTemp()
AttributeError: 'NoneType' object has no attribute 'WriteToTemp'

Because it has skipped loading the boot.img, which leads to the above error.

Bug: 63456822
Test: As follows:
  $ zip -d target_files.zip vbmeta.img
  $ add_img_to_target_files.py -a target_files.zip
Test: `m dist` on aosp_arm64-userdebug
Change-Id: Ieba5f0b6848c3ec5d8bcfd24d48cc5af8b39f06c
2017-11-14 17:05:57 -08:00
Tao Bao
9dd909e6db releasetools: Fix the size check for AVB images.
When generating full OTAs for AVB-enabled targets, it fails the size
assertion for boot.img.

  ERROR: boot size (31457280) is 100.00% of limit (31457280)

The size assumption is no longer true for AVB-signed images, because
the actual image size should be always identical to the limit.

Bug: 67841177
Test: Enable AVB on bullhead. `m dist`.
Change-Id: I9bd432ccd88094628eb71308554839549eccb6d9
2017-11-14 15:43:36 -08:00
Tianjie Xu
5d60cd2d3e Merge "Add multithread support to call imgdiff with block-limit" 2017-11-14 18:54:08 +00:00
Tianjie Xu
2536607d90 Add multithread support to call imgdiff with block-limit
With the new implementation of handling large apks, we need to call
imgdiff with block-limit to split the apk and generate the patch at
the same time. The call to imgdiff would significantly increase the
time consumption of the "FindTransfers" function which we used to
execute sequentially. This cl addresses this issue and speeds up the
process by making the imgdiff call parallel.

Bug: 34220646
Test: Create and sideload an incremental package for angler
Change-Id: Id62e348418fc1d22e32ea6c8ac16d9ab3ec92d7b
2017-11-13 14:58:05 -08:00
Alex Deymo
cbb4ec6cf0 Merge "Update binary name to "brotli"." 2017-11-13 22:43:22 +00:00
Alex Deymo
b10e07aea7 Update binary name to "brotli".
With the update of brotli to version 1.0.1 the new binary tool is now
called "brotli". This patch updates the scripts to use the new name.

Bug: 34220646
Test: `make dist`; ota_from_target_files on non-A/B device.
Change-Id: Ie8da4333388d029d5960a723a55efd875d8ee820
2017-11-13 18:11:45 +01:00
Tao Bao
44cb0db6a7 Merge "releasetools: Reduce the memory use in test_common.py." 2017-11-11 01:32:31 +00:00
Colin Cross
3563ac582a Merge "Convert signapk to Android.bp" 2017-11-10 19:17:26 +00:00
Colin Cross
ad44dd4f3c Convert signapk to Android.bp
See build/soong/README.md for more information

Test: m checkbuild
Change-Id: I89a7fa7647e7081ca49720fae3be23ce84ab38e5
2017-11-09 15:11:34 -08:00
Tao Bao
f718f90212 releasetools: Write back default_system_dev_certificate.
When signing a target_files.zip, the OTA certificate specified by
default_system_dev_certificate could be replaced with a mapped key. When
that happens, we must explicitly specify --package_key when generating
OTA packages with ota_from_target_files.py. Otherwise the OTA package
will be signed with the wrong key, which leads to verification failures.

This CL updates the default_system_dev_certificate value in
misc_info.txt accordingly.

Test: Sign a target_files.zip and replace the OTA key. Check
      META/misc_info.txt in the generated target_files.zip.
  $ ./build/make/tools/releasetools/sign_target_files_apks.py -v \
      --replace_ota_keys \
      -k build/target/product/security/testkey=build/target/product/security/platform \
      out/dist/aosp_marlin-target_files-eng.tbao.zip \
      signed-marlin-target_files-test.zip

Change-Id: I093234b5add3e27c5b3887cefeffd74e6f0a3e98
2017-11-09 10:23:50 -08:00
Tao Bao
31b0807310 releasetools: Reduce the memory use in test_common.py.
test_common constructs a few 2GiB strings in memory, which leads to huge
memory footprint (18GiB). This CL moves away from in-memory strings to
generators, which reduces the memory use down to 41MiB. It also reduces
the time cost from 294s to 139s as an extra benefit for free.

The CL addresses some trivial pylint warnings as well.

* Before

$ /usr/bin/time -v python -m unittest -v test_common
...
----------------------------------------------------------------------
Ran 11 tests in 294.986s

OK
	Command being timed: "python -m unittest -v test_common"
	User time (seconds): 110.51
	System time (seconds): 109.34
	Percent of CPU this job got: 74%
	Elapsed (wall clock) time (h:mm:ss or m:ss): 4:55.06
	Average shared text size (kbytes): 0
	Average unshared data size (kbytes): 0
	Average stack size (kbytes): 0
	Average total size (kbytes): 0
	Maximum resident set size (kbytes): 18894172
	Average resident set size (kbytes): 0
	Major (requiring I/O) page faults: 1
	Minor (reclaiming a frame) page faults: 20774908
	Voluntary context switches: 48
	Involuntary context switches: 3241
	Swaps: 0
	File system inputs: 184
	File system outputs: 8406424
	Socket messages sent: 0
	Socket messages received: 0
	Signals delivered: 0
	Page size (bytes): 4096
	Exit status: 0

* After

$ /usr/bin/time -v python -m unittest -v test_common
...
----------------------------------------------------------------------
Ran 11 tests in 139.100s

OK
	Command being timed: "python -m unittest -v test_common"
	User time (seconds): 59.00
	System time (seconds): 4.73
	Percent of CPU this job got: 45%
	Elapsed (wall clock) time (h:mm:ss or m:ss): 2:19.17
	Average shared text size (kbytes): 0
	Average unshared data size (kbytes): 0
	Average stack size (kbytes): 0
	Average total size (kbytes): 0
	Maximum resident set size (kbytes): 41252
	Average resident set size (kbytes): 0
	Major (requiring I/O) page faults: 0
	Minor (reclaiming a frame) page faults: 106569
	Voluntary context switches: 44
	Involuntary context switches: 103
	Swaps: 0
	File system inputs: 8
	File system outputs: 8422808
	Socket messages sent: 0
	Socket messages received: 0
	Signals delivered: 0
	Page size (bytes): 4096
	Exit status: 0

Fixes: 68988396
Test: See above.
Change-Id: I00f16603a4ee59fb085b189c6f5b5ee9d2378690
2017-11-08 17:10:33 -08:00
Tianjie Xu
7136100be6 Merge "Fix the imgdiff failure when running test_common unittest" 2017-11-07 23:40:20 +00:00
Tianjie Xu
df055580d0 Fix the imgdiff failure when running test_common unittest
imgdiff fails on plain strings after we put more checks the input
data. This leads to failure when running unittest
"test_recovery_from_boot". The CL fixes the issue by serving gzipped
dummy images as the test input.

Bug: 68988329
Test: InstallRecoveryScriptFormatTest passes
Change-Id: I1952b311681ac4f39c0e51aef1de1177aebeac43
2017-11-07 12:38:08 -08:00
Dan Willemsen
dcd46870f2 Merge changes Ib37508d4,Ia46ac30e
* changes:
  Turn off Windows builds during BUILD_HOST_static
  zipalign: Fix build failure in static_sdk_tools.
2017-11-06 22:53:46 +00:00
Daniel Cardenas
429e5a6363 PDK fix. Remove conditional that stops component from being in PDK.
Bug: 67663308
Test: Build on master and PDK branch
Change-Id: I101452230376c4c509004cf6d03070ce85620e89
2017-11-06 11:57:06 -08:00
Narayan Kamath
887c645e02 zipalign: Fix build failure in static_sdk_tools.
Convert all dependencies to static deps.

Test: make -j50 static_sdk_tools BUILD_HOST_static=1
Bug: 35246701
Bug: 68804545

Change-Id: Ia46ac30e5c05226f1bfec82a84f05e4be945bf74
2017-11-06 11:12:08 -08:00
Tao Bao
c0dcbd0017 releasetools: Fix the doctest for rangelib.py.
$ python rangelib.py
**********************************************************************
File "rangelib.py", line 323, in __main__.RangeSet.next_item
Failed example:
    list(rangelib.RangeSet("10-19 3 5 7").next_item())
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib/python2.7/doctest.py", line 1315, in __run
        compileflags, 1) in test.globs
      File "<doctest __main__.RangeSet.next_item[2]>", line 1, in <module>
        list(rangelib.RangeSet("10-19 3 5 7").next_item())
    NameError: name 'rangelib' is not defined
**********************************************************************
1 items had failures:
   1 of   3 in __main__.RangeSet.next_item
***Test Failed*** 1 failures.

Test: python rangelib.py
Change-Id: I6c791ff4453f40d90b34f97b881460da9878fe64
2017-11-02 12:19:36 -07:00
Narayan Kamath
9709191837 Merge "zipalign: Remove dependency on androidfw." 2017-11-01 11:12:18 +00:00
Jaekyun Seok
43c2f8aeee Rename ro.vendor.product.* to ro.product.vendor.*
"ro.vendor." prefix will be used only for vendor-specific properties
except for ro.vendor.build.date, ro.vendor.build.date.utc and
ro.vendor.build.fingerprint.

Those exceptions have been used since Android L. So we can't rename them
to support the system-only upgrade from old Android.

Bug: 36796459
Test: confirmed that ro.vendor.product.* were changed to
ro.product.vendor.* in vendor/build.prop

Merged-In: Ibc107b00264a2dc194261d1968b27a9b17b5d798
Change-Id: Ibc107b00264a2dc194261d1968b27a9b17b5d798
(cherry picked from commit 8cf6443264)
2017-11-01 10:11:32 +09:00
Treehugger Robot
9a04e12eba Merge "Add OWNERS for SignApk" 2017-10-31 21:53:45 +00:00
Tao Bao
224b5f9926 Merge "releasetools: Remove the deprecated flag --board_config." 2017-10-31 21:36:45 +00:00
Tao Bao
f2a3454fa5 Merge "releasetools: Fix the wrong command when falling back to bsdiff." 2017-10-31 21:11:56 +00:00
Treehugger Robot
f9b1b4c37d Merge "releasetools: Fix the comment for '--verify' flag." 2017-10-31 21:00:19 +00:00
Alex Klyubin
c6c6dfe742 Add OWNERS for SignApk
Test: build/make/tools/checkowners.py -c -v OWNERS
Bug: 30972906
Change-Id: I7a2c9301376e24239924ffbedcb2b97727da700a
2017-10-31 12:36:04 -07:00
Tao Bao
4b76a0e9ee releasetools: Remove the deprecated flag --board_config.
It has been long deprecated since commit
fdd8e69c42 (Donut).

Test: `m dist` with aosp_marlin-userdebug and aosp_angler-userdebug.
Test: No user of "--board_config" in code search.
Change-Id: Ic0336c22cac32de5de88161748d09b579f892e99
2017-10-31 12:16:48 -07:00
Tao Bao
d41c9179d2 releasetools: Fix the wrong command when falling back to bsdiff.
Commit b937ead5d9 added the fallback to
bsdiff on imgdiff failures. However, it missed setting the transfer
style accordingly, which led to patch header mismatch.

Bug: 68659848
Test: Generate an incremental that has the fallback from imgdiff to
      bsdiff. Examine the generated transfer list and verify that it has
      "bsdiff" for the fallback command.

Change-Id: I55e46879d590a8af82ea796b9d98ffdb30360408
2017-10-31 12:09:07 -07:00
Tao Bao
edb35b85e2 releasetools: Fix the comment for '--verify' flag.
'-v' is not the abbreviation for '--verify' (but for '--verbose'
instead).

Test: N/A
Change-Id: I86339a1f7ea538d88ac6ed61595361531b79065c
2017-10-31 11:55:41 -07:00
Victor Hsieh
d50662502f Migrate to the new apksig API
Following the new API contract, this effectively add extra padding
before central dir to make it 4KB aligned.

Test: build succeeded
Bug: 30972906
Change-Id: I7cac9d2c4371b473c88df867b3b2ae906443db10
2017-10-31 08:24:02 -07:00
Narayan Kamath
0e4110e4c3 zipalign: Remove dependency on androidfw.
Use zip_archive directly. Note that this codepath is used only
when recompressing archives with zopfli during the alignment step.
It's unclear whether this is in use at all, but I verified that the
results are identical (note the usage of the "-z" flag in the test
below).

Test: make && out/host/linux-x86/bin/zipalign -v -f -z 8 \
        out/target/product/marlin/system/app/Email/Email.apk ./out.zip

Bug: 35246701
Change-Id: I641cdb6d409cc07974d49d42c9f9e6d4f905e472
2017-10-30 12:18:16 +00:00
Ryan Campbell
63fc0e681d Create product sysprops on vendor partition.
Duplicate essential product sysprops for manufacturer, model, brand, name, and device
from system on vendor so that mixed builds (vendor.img + GSI system.img) have correct
product information in their CTS/VTS reports.

Test: make
Bug: 64458205
Merged-In: Ib63b37772be493b9e035d9b7e8c5e2cf66f2fa8c
Change-Id: Ib63b37772be493b9e035d9b7e8c5e2cf66f2fa8c
(cherry picked from commit aea0f92ff3)
2017-10-25 11:35:14 +09:00
Colin Cross
bce301801f Merge "Update references to build/core to build/make/core"
am: 6db8597174

Change-Id: I4be5bc1805d1900991966d24fda15f2705ee248d
2017-10-20 23:49:17 +00:00
Colin Cross
6db8597174 Merge "Update references to build/core to build/make/core" 2017-10-20 23:41:12 +00:00