summaryrefslogtreecommitdiff
path: root/apexer/apexer.py
Commit message (Collapse)AuthorAgeFilesLines
* Add an optional flag for an assets/ dir.Jaewoong Jung2019-06-251-0/+4
| | | | | | | | | | | This allows supplemental resource files (e.g. NOTICE output) to be included in the APEX under assets. Bug: 135218846 Test: Built Mainline modules + manual inspection Change-Id: Iafdbc9012ea72a2298b84e70779282c00f191f31 Merged-In: Iafdbc9012ea72a2298b84e70779282c00f191f31 (cherry picked from commit 2247d1d56781e832f79afe82637e725226a272d3)
* Update the default min sdk version for APEXes to 29Jiyong Park2019-05-161-1/+1
| | | | | | | | | | | | | | APEXes exist starting from Q (29). So updating the min version value to 29. Note: APEXes that are mainline modules for Q (e.g. timezone, conscrypt, ...) are still having min sdk version set to 28 to support beta devices. When we no longer need to support them, we should remove the hard-coded min sdk version from the AndroidManifest.xml for the APEXes. Bug: 131128233 Test: m com.android.runtime.debug and check its min sdk version number Change-Id: Idfaee55c2efb1bbb81c15368001badf95d407782
* Add versionName field to APEX manifest.Gavin Corkery2019-05-021-0/+2
| | | | | | | | | | | | | | | The source of truth for an APEX version name is the manifest.json file, which is propagated via aapt to the AndroidManifest.xml. Test: adb shell cmd apexservice getAllPackages Test: Add versionName field to an apex manifest.json, make and then run aapt dump badging to the path of the output. Bug: 118739827 Change-Id: I4648237847d06d69016a72b620d5c8588d852c69 Merged-In: I4648237847d06d69016a72b620d5c8588d852c69 (cherry picked from commit 9463856c5223a9881ce93de5efd5c4368131ebf5)
* Ensure APEXes have minSdkVersion specifiedJiyong Park2019-04-241-0/+2
| | | | | | | | | | | | | | | Missing minSdkVersion causes a problem when an APEX is re-signed with sign_target_files_apks. Specifically, if the value is missing, SignApk uses the most conservative algorithm SHA1withRSA which is being deprecated. To fix the problem, when an APEX is built, the default minSdkVersion is specified to ensure that all APEXes have minSdkVersion set. Bug: 131128233 Test: m com.android.runtime.debug; aapt dump badging <path_to_the_apex> shows minSdkVersion Change-Id: Ibc44b094052ea7a8ed96f9f464c55d48af37b04e
* Add --target_sdk_version to apexerJiyong Park2019-04-181-0/+4
| | | | | | | | It is used to set the target sdk version of the APEX for targeting. Bug: 130541924 Test: m Change-Id: I7178322bc8114bbe4992e68e3a0cda5ff3d2ae97
* Revert "Revert "apexer: Build filesystem images with inode size 256.""Jiyong Park2019-03-291-4/+2
| | | | | | | | This reverts commit 066a2e0f2fbf5f8a843552461d885010f1e63b7d. Reason for revert: aosp/936938 fixes the problem Change-Id: Ic1329914fa28b00e3b2db048e0ad38fe65e4aac5
* Revert "apexer: Build filesystem images with inode size 256."Xiangyu/Malcolm Chen2019-03-291-2/+4
| | | | | | | | | | This reverts commit 4d1634160d7dbd850140c917072f73f1063a60d3. Reason for revert: b/129547377 Broken test: suite/test-mapping-presubmit-retry_cloud-tf on aosp-master Change-Id: I804a380114a567c999a7c96198c66e8c8e6f7d22
* apexer: Build filesystem images with inode size 256.Martijn Coenen2019-03-291-4/+2
| | | | | | | | | | | The reason this caused non-deterministic images earlier is that larger inodes have the 'crtime' attribute inline, and, due to a missing E2FSPROGS_FAKE_TIME, this attribute was set to the current time instead of a fixed time. Bug: 122991714 Test: rebuild apex.apexd_test.apex several times, check hash Change-Id: I0e05dbd25d19a5219d5e0f2bd2e1ba057ad2cc8d
* Allow APEXER_TOOL_PATH to be set by a flag.Alex Light2019-03-041-16/+11
| | | | | | | | | | Add a --apexer_tool_path flag that can be used instead of the APEXER_TOOL_PATH environment variable. Test: apexer --help Test: m com.android.support.apexer Test: Build manual apex using --apexer_tool_path Change-Id: I51e689a322574df6d2c4d29823e7bbe778b8e335
* Add support for specifying the android.jar to link againstAlex Light2019-02-271-1/+4
| | | | | | | | | | | In order to run this tool outside of the build system we need to be able to use something other than a hardcoded location for the current sdks android.jar. Test: m com.android.runtime.debug Bug: 119332365 Bug: 119332362 Change-Id: I8f7f3cc39a91e96b4de727e906f253ba451f7806
* Allow each APEX to provide its own AndroidManifestJiyong Park2019-02-101-9/+34
| | | | | | | | | | | | | | | AndroidManifest.xml file can be specified via the 'androidManifest' property in the apex module type. It can be used to have a custom AndroidManifest.xml that have additional tags (such as <uses-sdk> or <uses-feature>) for precise tageting. The property is optiona; if unspecified, the one is auto-generated as before. Bug: 123857186 Test: m apex_test_build_features Change-Id: I0d28438e9463f8f544047bf5c89dc76066b7dbab
* Don't set -I (inode size) when creating the APEX image.Martijn Coenen2019-01-251-1/+3
| | | | | | | | | It appears to introduce non-determinism. Update the digest as well. Bug: 122991714 Test: builds, atest apex_file_test passes for multiple runs Change-Id: Id6cee105bde0ca496bafbe7119da96bda4dead34
* Tune fs parameters to save spaceJiyong Park2019-01-241-11/+26
| | | | | | | | | | | | | | | | | | - increase inode size to 256 in order not to break localization of sepolicy in xattr - reduce the # of inodes to the number of files/dirs counts - duplicated blocks are shared Bug: 122991714 Test: m. system boots to the UI Test: m com.android.runtime.debug Compare the sizeof the built file Before: 109846528 After: 102719762 Change-Id: Ieff0ac318731b3b9ab113d4a35da13e1f5f11676
* Add --override_apk_package_name to override app package nameJiyong Park2019-01-091-1/+7
| | | | | | | | | | | | | | | | | By default, the app package name of an APEX is equal to the apex package name. The new --override_apk_package_name option is used to override the behavior. In practice, one can use this option by setting PRODUCT_MANIFEST_PACKAGE_NAME_OVERRIDES := <apex_name>:<manifest_name> Test: m with PRODUCT_MANIFEST_PACKAGE_NAME_OVERRIDES for 1) an APK in Android.mk 2) an APK in ANdroid.bp 3) an APEX and check that manifest names are modified as specified Change-Id: Idb30015205c572013a6d193b776409d32452ffb8
* apexer: Move to proto object and remove ApexManifest classAbhijeet Kaur2019-01-021-3/+3
| | | | | | | | | | | | | Remove ApexManifest class and use proto object directly. Add postInstallHook field in proto message schema as it is present in apexd. Bug: 116129963 Test: ./apexer/runtests.sh Change-Id: Iaca472c942c1546ff74761d450155530d446447d
* Revert "Revert "Use protobuf as schema for JSON APEX manifest""Dario Freni2018-12-281-15/+11
| | | | | | | | | | | | This reverts commit 0fe26b1e6832d7fe6c19e728c21fdc0e9be2ed44. Reason for revert: Testing the breakage. Bug: 122067734 Test: Import error not deterministically reproducible. 'embedded_launcher: true' may remove the import error as suggested in the bug discussion thread. Change-Id: Iefd8c6c05c7bcf83a51aeed141eaaca436eed3cc
* Add --pubkey option to bundle public key with APEXJiyong Park2018-12-271-0/+6
| | | | | | | | | | | | | | | | | | The public key file is embedded in the zip container of the APEX with the name 'apex_pubkey'. In debuggable builds, the bundled public key will be used as a fallback when no matching public key is found in the built-in partitions (e.g. /system/etc/security/apex). This is useful for testing-purpose APEXes; the public key for the APEXes do not need to be force installed on the device, which requires rooting. Bug: 122047804 Test: add 'installable: false' to the apex_key 'com.android.apex.test_package.key'. mma under /system/apex/apexd/apexd_testdata. unzip the built APEX. The public key (renamed to apex_pubkey) is found in the zip container. Change-Id: I07be3be8ae763c12dc0541fec2b172b5f11bbafd
* Revert "Use protobuf as schema for JSON APEX manifest"Lingfeng Yang2018-12-251-11/+15
| | | | | | | | This reverts commit 7e021e8dcae1098eccf972eb9e71448134fdc08b. Reason for revert: build break Change-Id: I6fbd8176ec7d4124c49d07f07ca9cd21a54caad3
* Use protobuf as schema for JSON APEX manifestAbhijeet Kaur2018-12-241-15/+11
| | | | | | | | | | | Validate necessary fields in the manifest using protobuf. Add class for apex manifest for better usability of the JSON fields. Test: ./runtests.sh Bug: 116129963 Change-Id: Icf5091ebc9fb4faca437cada3b93cd98c4b77ba6
* Reland "Output of apexer is deterministic"Jiyong Park2018-12-181-3/+13
| | | | | | | | | | | | | This reverts commit 1486e178485b47094ac93f26624102106c1ecb89. The added option (-U, and -E) are moved in front of the positional parameters (image file name and block size). Bug: 120811390 Test: Build two com.android.tzdata APEXes without changing the source The two APEXes are identical. Change-Id: I489bb809cdd4baf7dc56801fbc5bf68219e726d1
* Revert "Output of apexer is deterministic"Wale Ogunwale2018-12-171-13/+3
| | | | | | | | This reverts commit 0a7e57c0e9c6122ac582e94dd465571c632add3b. Reason for revert: Breaks Mac builds Change-Id: I7be1854839ee8d4eddd060fe84c8be27f520c490
* Output of apexer is deterministicJiyong Park2018-12-171-3/+13
| | | | | | | | | | | Output of apexer is now deterministic. Unless the input files are changed, the output is not changed across different runs. Bug: 120811390 Test: Build two com.android.tzdata APEXes without changing the source The two APEXes are identical. Change-Id: I56657493bb54a859f18deb276edb68d6c9ee8f9e
* Add support for building zipapex filesAlex Light2018-12-041-77/+104
| | | | | | | | | These are apex files with the payload being a zip file instead of an FS image. This makes them easier to use by other tools without root. Test: build Bug: 120436895 Change-Id: I8c9eb6c1baa8a2bbf92fb4be4f6d89088245ee90
* Apexer: Print command output on errorAndreas Gampe2018-11-281-1/+1
| | | | | | | | To help diagnose issues. Test: m Test: manual Change-Id: I7f7265f5bd1eb2e2296099dcfbd020b312aff21f
* Ensure that apex key is used by only one APEX.Jiyong Park2018-11-271-1/+7
| | | | | | | | | | | | | | | | Two APEXes having differnet bundle names cannot be signed with the same APEX key. This is prohibited both by the build system and by the apexd at runtime. Test APEXs and keys are updated accordingly. Bug: 115721587 Test: m checkbuild Test: device boots, adb shell; su; setenforce 0; cmd apexservice getActivePackages shows the installed APEXes. Test: atest apexservice_test apex_file_test apex_manifest_test Change-Id: I07ed767b2dcd08f93ef98cc139d911121b016f9f
* Rename manifest and image files.Dario Freni2018-11-241-4/+4
| | | | | | | | | manifest.json -> apex_manifest.json image.img -> apex_payload.img Bug: 119672727 Test: m, installed on device, boots. tests succeed. Change-Id: I3d03647f76f146b582d2335a26eeac9a5c278f29
* Fix AndroidManifest.xml generated by apexer.py.Nicholas Lativy2018-11-231-1/+1
| | | | | | | Version code attribute was missing android namespace. Test: Manually. Change-Id: I809a6a77c69cb04ba053293dc4300b3ae515eb9f
* Remove buildspam for apexerJiyong Park2018-11-201-1/+3
| | | | | | | | | Bug: 119768180 Test: m apex.test [ 99% 5758/5761] //system/apex:apex.test apex [common] [100% 5761/5761] Install: out/target/product/walleye/system/apex/apex.test.apex Change-Id: Ia7bb715cbecdda4e11691e11d94e130f084d0012
* AndroidManifest for APEX has hasCode="false"Jiyong Park2018-11-161-0/+3
| | | | | | | | | This seem to be against the reality (since most APEXes will have code - shared libs, java libraries, ...). But this is required because APEX does not have classes.dex and other intra around APK is ensuring this. Test: m apex.test Change-Id: I8384fbaa4bc3606fbbd4ef9fc22357268051af9b
* APEXs can be signed with different keysJiyong Park2018-10-191-0/+1
| | | | | | | | | | | | The name of the key used to sign an APEX is recorded in the vb metadata structure. When verifying the APEX, the name is retrived to find the corresponding public key from the /system/etc/security/apex directory. Bug: 115721587 Test: m apex.test; m /apex/com.android.example.apex@1 exists Change-Id: I55a1695483515a8f4ac7d593d11675d9dd340b36
* Extend apexer's tools search path to SDK prebuilts.Roland Levillain2018-10-021-4/+12
| | | | | | | | | | | | | | | | In particular, this enables apexer to be used with a master-art source tree, by using aapt2 from SDK prebuilts instead of building it, which requires the following build dependencies (which are not part of the master-art manifest): - external/libpng - external/robolectric-shadows - frameworks/base - frameworks/opt/setupwizard Test: system/apex/apexer/runtests.sh on a master-art source tree Bug: 113373927 Bug: 112458021 Change-Id: Ice7a2923a6113c73082b60da96621f92ca59cb09
* Fix runtests.sh after recent changes to apexer.Dario Freni2018-09-281-0/+12
| | | | | | | Also added support for running from the build tree top. Test: runtests.sh Change-Id: I070fa4f73d64e5db66d363d680c4b7345055fdbb
* Omitting partition name and sizeJiyong Park2018-09-271-8/+0
| | | | | | | | | | | | f4f51ebeaf72b309679dd1e22724b53e322333aa in platform/external/avb allows us to omit partitio name and size when adding hashtree and footer. Take the advantage from it to eliminate the need to keep the code for calculating the size opportunistically. Bug: 113320014 Test: mma under system/apex/build Change-Id: I65fa34d2a011a28e3316b247cb9eed13d40ed4f8
* Reland: Add module type apex to build APEX bundlesJiyong Park2018-09-181-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A new module type 'apex' is added to be able to build APEX bundles in Soong. Usage: apex { name: "com.android.awesome", manifest: "manifest.json", file_contexts: "file_contexts", native_shared_lib_modules: ["libX", "libY"], } This will create /system/apex/com.android.awesome.apex having libX.so and libY.so in it. Right now, it lacks many of the planned features: - APEX modules are now built against platform API, which should be against stable APIs like NDK, Android API and API from other APEXs. - Only native shared libs are supported. Executables, java libraries, aidl_interfaces, and prebuilts should be supported. - Inter-APEX dependency isn't supported yet. - fs_config isn't configurable. All files and directories are set to (uid/gid/mode) = (1000/1000/0644) - native shared libs are stored unstripped. Bug: 112672359 Test: m apex.test Change-Id: I2e1a53a88c79653bcf33c1305baaf684428fcf6e
* Revert "Add module type apex to build APEX bundles"Jiyong Park2018-09-171-5/+0
| | | | | | | | This reverts commit e396fce50149aa84aed5adc5136f54827d44661c. Reason for revert: broke aosp_x86_64 Change-Id: I584be24644e68978e558d09327fce60b0ef3fc73
* Add module type apex to build APEX bundlesJiyong Park2018-09-141-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A new module type 'apex' is added to be able to build APEX bundles in Soong. Usage: apex { name: "com.android.awesome", manifest: "manifest.json", file_contexts: "file_contexts", native_shared_lib_modules: ["libX", "libY"], } This will create /system/apex/com.android.awesome.apex having libX.so and libY.so in it. Right now, it lacks many of the planned features: - APEX modules are now built against platform API, which should be against stable APIs like NDK, Android API and API from other APEXs. - Only native shared libs are supported. Executables, java libraries, aidl_interfaces, and prebuilts should be supported. - Inter-APEX dependency isn't supported yet. - fs_config isn't configurable. All files and directories are set to (uid/gid/mode) = (1000/1000/0644) - native shared libs are stored unstripped. Bug: 112672359 Test: m apex.test Change-Id: Ifc44790a8f7de9307550edef0e4d70e9a78327f6
* Don't deflate any input files.Martijn Coenen2018-09-111-1/+3
| | | | | | | | | | | | | | | | | | | | Even when passing '-L 0' to soong_zip, it can still decide to store files as deflated (but without any actual compression). This in turn throws off the zipalign tool, which doesn't align any compressed files, eg: $ zipalign -v -c 4096 apex.zip Verifying alignment of apex.zip (4096)... 39 image.img (OK - compressed) Instead, use the '-s' argument for soong_zip, to make sure the files get stored without any compression. This issue wasn't triggered earlier because deflation isn't used for small files. Test: tests pass, lare Change-Id: Ic71aa70af09b6b54621bd2d3de721237112a1add
* Version number in APEX manifest is set as versionCode of AndroidManifestJiyong Park2018-09-041-4/+6
| | | | | | | | | Package name together with version number fully identifies an APEX (and thus APK). Bug: 112458021 Test: runtests.sh Change-Id: I3d3193bc6071bebd577858fffc617660cb555380
* Silence some warnings for unused variablesJiyong Park2018-09-041-3/+2
| | | | | Test: runtests.sh Change-Id: I52ed16592b43d336d5bdfcaae0d05f3aac91d8b8
* The file system image is protected by dm-verityJiyong Park2018-08-291-0/+38
| | | | | | | | | | | | | The file system image in an APEX is now protected by dm-verity. The hash tree and vbmeta descriptors, etc are appened to the file system using the tool avbtool. Testing-purpose public/private key pairs are also added to sign the metadata. Bug: 112458021 Test: ./runtests.sh Change-Id: If32b99adaf2267e9b84a761c50fa3c7bc4854e2a
* Set uid/gid/mode of files in an APEXJiyong Park2018-08-281-1/+5
| | | | | | | | | | | | | | | | | | | | | apexer now supports --canned_fs_config to set uid, gid, mode and capability of files in the APEX. The syntax of a canned_fs_config is as simple as path uid gid mode [capability] for each path. Currently, uid, gid, and mode should be numeric, e.g., 100 200 0644, symbolic names are not supported yet. Note that when --canned_fs_config is specified, it must cover ALL files in the APEX. Missing a file is an error. Bug: 112458021 Test: runtests.sh Change-Id: I73da91dfd0be2a12acc80d7e08127994fa49e073
* Files in APEX are correctly labeledJiyong Park2018-08-271-5/+18
| | | | | | | | | add '--file_contexts' option to label files in the image.img in an APEX. Bug: 112458021 Test: m -j Test: runtests.sh Change-Id: I6c96f2815560528fe89199c7efb88d553c245a8f
* Make output consistentJiyong Park2018-08-271-10/+17
| | | | | | | | | Use soong_zip to make file order, xattr, and timestamp in an apex to be consistent. Bug: 112458021 Test: runtests.sh Change-Id: I2277285c687415747ee0ef224953b4ee0aa5e7d4
* Add apexer the tool for creating APEX filesJiyong Park2018-08-141-0/+238
apexer is the tool for creating APEX files which are new package format for system modules. It packages a set of files under the input directory into a filesystem image (ext4) which is then embedded to a zip file uncompressed. The packaged files are accessible by mounting the embedded filesystem image using the loopback device. Bug: 112458021 Test: runtests.sh which creates an apex file from random contents and ensures that the files inside the apex are identical to the input Change-Id: I36a84a9dbf6b446bf23ea59110a225260cb4bbd1