diff options
| -rw-r--r-- | core/definitions.mk | 1 | ||||
| -rw-r--r-- | core/envsetup.rbc | 11 | ||||
| -rw-r--r-- | core/main.mk | 3 | ||||
| -rw-r--r-- | core/product.mk | 5 | ||||
| -rw-r--r-- | core/product_config.mk | 13 | ||||
| -rw-r--r-- | core/product_config.rbc | 47 | ||||
| -rw-r--r-- | target/product/base_system.mk | 1 | ||||
| -rw-r--r-- | target/product/emulator_vendor.mk | 2 | ||||
| -rw-r--r-- | target/product/virtual_ab_ota/compression_with_xor.mk | 21 | ||||
| -rw-r--r-- | tests/run.rbc | 3 | ||||
| -rw-r--r-- | tools/rbcrun/host.go | 2 | ||||
| -rw-r--r-- | tools/rbcrun/testdata/file_ops.star | 1 | ||||
| -rw-r--r-- | tools/releasetools/common.py | 7 | ||||
| -rwxr-xr-x | tools/releasetools/ota_from_target_files.py | 3 |
14 files changed, 91 insertions, 29 deletions
diff --git a/core/definitions.mk b/core/definitions.mk index 0fd023abf5..981c6cb3b8 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -2329,6 +2329,7 @@ endef define add-jar-resources-to-package rm -rf $(3) mkdir -p $(3) + zipinfo -1 $(2) > /dev/null unzip -qo $(2) -d $(3) $$(zipinfo -1 $(2) | grep -v -E "\.class$$") $(JAR) uf $(1) $(call jar-args-sorted-files-in-directory,$(3)) endef diff --git a/core/envsetup.rbc b/core/envsetup.rbc index 451623ba8b..69c4989176 100644 --- a/core/envsetup.rbc +++ b/core/envsetup.rbc @@ -188,9 +188,18 @@ def init(g): if g["HOST_BUILD_TYPE"] not in ["release", "debug"]: fail("HOST_BUILD_TYPE must be either release or debug, not '%s'" % g["HOST_BUILD_TYPE"]) + g.update([ + ("TARGET_COPY_OUT_VENDOR", "||VENDOR-PATH-PH||"), + ("TARGET_COPY_OUT_PRODUCT", "||PRODUCT-PATH-PH||"), + ("TARGET_COPY_OUT_PRODUCT_SERVICES", "||PRODUCT-PATH-PH||"), + ("TARGET_COPY_OUT_SYSTEM_EXT", "||SYSTEM_EXT-PATH-PH||"), + ("TARGET_COPY_OUT_ODM", "||ODM-PATH-PH||"), + ("TARGET_COPY_OUT_VENDOR_DLKM", "||VENDOR_DLKM-PATH-PH||"), + ("TARGET_COPY_OUT_ODM_DLKM", "||ODM_DLKM-PATH-PH||"), + ]) + # TODO(asmundak): there is more stuff in envsetup.mk lines 249-292, but # it does not seem to affect product configuration. Revisit this. - g["ART_APEX_JARS"] = [ "com.android.art:core-oj", "com.android.art:core-libart", diff --git a/core/main.mk b/core/main.mk index e0fb58d824..7b41ba21c0 100644 --- a/core/main.mk +++ b/core/main.mk @@ -120,9 +120,6 @@ ifeq (true,$(EMMA_INSTRUMENT)) ifndef SKIP_BOOT_JARS_CHECK SKIP_BOOT_JARS_CHECK := true endif -# Mainline modules prebuilts do not support coverage. Build them from source. -# See b/159241638 -MODULE_BUILD_FROM_SOURCE := true endif ifdef TARGET_ARCH_SUITE diff --git a/core/product.mk b/core/product.mk index f6347e829b..9aaf5eb300 100644 --- a/core/product.mk +++ b/core/product.mk @@ -372,11 +372,6 @@ _product_list_vars += PRODUCT_MANIFEST_PACKAGE_NAME_OVERRIDES _product_list_vars += PRODUCT_PACKAGE_NAME_OVERRIDES _product_list_vars += PRODUCT_CERTIFICATE_OVERRIDES -# A list of <overridden-apex>:<override-apex> pairs that specifies APEX module -# overrides to be applied to the APEX names in the boot jar variables -# (PRODUCT_BOOT_JARS, PRODUCT_APEX_BOOT_JARS etc). -_product_list_vars += PRODUCT_BOOT_JAR_MODULE_OVERRIDES - # Controls for whether different partitions are built for the current product. _product_single_value_vars += PRODUCT_BUILD_SYSTEM_IMAGE _product_single_value_vars += PRODUCT_BUILD_SYSTEM_OTHER_IMAGE diff --git a/core/product_config.mk b/core/product_config.mk index 403c6be130..7bed376dd4 100644 --- a/core/product_config.mk +++ b/core/product_config.mk @@ -285,19 +285,6 @@ PRODUCT_APEX_BOOT_JARS := $(filter-out com.android.i18n:core-icu4j,$(PRODUCT_APE # All APEX jars come after /system and /system_ext jars, so adding core-icu4j at the end of the list PRODUCT_BOOT_JARS += com.android.i18n:core-icu4j -# Replaces references to overridden boot jar modules in a boot jars variable. -# $(1): Name of a boot jars variable with <apex>:<jar> pairs. -define replace-boot-jar-module-overrides - $(foreach pair,$(PRODUCT_BOOT_JAR_MODULE_OVERRIDES),\ - $(eval _rbjmo_from := $(call word-colon,1,$(pair)))\ - $(eval _rbjmo_to := $(call word-colon,2,$(pair)))\ - $(eval $(1) := $(patsubst $(_rbjmo_from):%,$(_rbjmo_to):%,$($(1))))) -endef - -$(call replace-boot-jar-module-overrides,PRODUCT_BOOT_JARS) -$(call replace-boot-jar-module-overrides,PRODUCT_APEX_BOOT_JARS) -$(call replace-boot-jar-module-overrides,ART_APEX_JARS) - # The extra system server jars must be appended at the end after common system server jars. PRODUCT_SYSTEM_SERVER_JARS += $(PRODUCT_SYSTEM_SERVER_JARS_EXTRA) diff --git a/core/product_config.rbc b/core/product_config.rbc index 3714448590..f7ce7aa21b 100644 --- a/core/product_config.rbc +++ b/core/product_config.rbc @@ -463,6 +463,28 @@ def _mkinfo(file, message = ""): print(message) +def __mkparse_pattern(pattern): + """Parses Make's patsubst pattern.""" + in_escape = False + res = [] + acc = "" + for c in pattern.elems(): + if in_escape: + in_escape = False + acc += c + elif c == '\\': + in_escape = True + elif c == '%' and not res: + res.append(acc) + acc = '' + else: + acc += c + if in_escape: + acc += '\\' + res.append(acc) + return res + + def __mkpatsubst_word(parsed_pattern,parsed_subst, word): (before, after) = parsed_pattern if not word.startswith(before): @@ -480,16 +502,14 @@ def _mkpatsubst(pattern, replacement, s): Tokenizes `s` (unless it is already a list), and then performs a simple wildcard substitution (in other words, `foo%bar` pattern is equivalent to the regular expression `^foo(.*)bar$, and the first `%` in replacement is - $1 in regex terms). Escaping % is not supported + $1 in regex terms). """ - if pattern.find("\\") >= 0: - fail("'\\' in pattern is not allowed") - parsed_pattern = pattern.split("%", 1) + parsed_pattern = __mkparse_pattern(pattern) words = s if type(s) == "list" else _mkstrip(s).split(" ") if len(parsed_pattern) == 1: out_words = [ replacement if x == pattern else x for x in words] else: - parsed_replacement = replacement.split("%", 1) + parsed_replacement = __mkparse_pattern(replacement) out_words = [__mkpatsubst_word(parsed_pattern, parsed_replacement, x) for x in words] return out_words if type(s) == "list" else " ".join(out_words) @@ -522,6 +542,22 @@ def _mksubst(old, new, s): return s.replace(old, new) +def _product_copy_files_by_pattern(src, dest, s): + """Creates a copy list. + + For each item in a given list, create <from>:<to> pair, where <from> and + <to> are the results of applying Make-style patsubst of <src> and <dest> + respectively. E.g. the result of calling this function with + ("foo/%", "bar/%", ["a", "b"]) will be + ["foo/a:bar/a", "foo/b:bar/b"]. + """ + parsed_src = __mkparse_pattern(src) + parsed_dest = __mkparse_pattern(dest) + parsed_percent = ["", ""] + words = s if type(s) == "list" else _mkstrip(s).split(" ") + return [ __mkpatsubst_word(parsed_percent, parsed_src, x) + ":" + __mkpatsubst_word(parsed_percent, parsed_dest, x) for x in words] + + def __get_options(): """Returns struct containing runtime global settings.""" settings = dict( @@ -577,6 +613,7 @@ rblf = struct( mksubst = _mksubst, printvars = _printvars, product_configuration = _product_configuration, + product_copy_files_by_pattern = _product_copy_files_by_pattern, require_artifacts_in_path = _require_artifacts_in_path, require_artifacts_in_path_relaxed = _require_artifacts_in_path_relaxed, setdefault = _setdefault, diff --git a/target/product/base_system.mk b/target/product/base_system.mk index de3d63da77..d1214840c2 100644 --- a/target/product/base_system.mk +++ b/target/product/base_system.mk @@ -369,6 +369,7 @@ PRODUCT_PACKAGES_DEBUG := \ profcollectd \ profcollectctl \ remount \ + servicedispatcher \ showmap \ sqlite3 \ ss \ diff --git a/target/product/emulator_vendor.mk b/target/product/emulator_vendor.mk index 4d46358192..e6db0f8da0 100644 --- a/target/product/emulator_vendor.mk +++ b/target/product/emulator_vendor.mk @@ -37,7 +37,7 @@ $(call inherit-product-if-exists, device/generic/goldfish/vendor.mk) #watchdog tiggers reboot because location service is not #responding, disble it for now. -#still keep it on internal master as it is still working +#still keep it on internal main (master) as it is still working #once it is fixed in aosp, remove this block of comment. #PRODUCT_VENDOR_PROPERTIES += \ #config.disable_location=true diff --git a/target/product/virtual_ab_ota/compression_with_xor.mk b/target/product/virtual_ab_ota/compression_with_xor.mk new file mode 100644 index 0000000000..7d9253299c --- /dev/null +++ b/target/product/virtual_ab_ota/compression_with_xor.mk @@ -0,0 +1,21 @@ +# +# Copyright (C) 2021 The Android Open-Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + + +$(call inherit-product, $(SRC_TARGET_DIR)/product/virtual_ab_ota/compression.mk) + + +PRODUCT_VENDOR_PROPERTIES += ro.virtual_ab.compression.xor.enabled=true diff --git a/tests/run.rbc b/tests/run.rbc index 15f6212dfe..35ae19d518 100644 --- a/tests/run.rbc +++ b/tests/run.rbc @@ -43,6 +43,9 @@ assert_eq("abcZ", rblf.mkpatsubst("%z", "%Z", "abcz")) assert_eq("azx b", rblf.mkpatsubst("az", "AZ", "azx b")) assert_eq(["azx", "b"], rblf.mkpatsubst("az", "AZ", ["azx", "b"])) assert_eq("ABC", rblf.mkpatsubst("abc", "ABC", "abc")) +assert_eq(["%/foo"], rblf.mkpatsubst("%", "\\%/%", ["foo"])) +assert_eq(["foo/%"], rblf.mkpatsubst("%", "%/%", ["foo"])) +assert_eq(["from/a:to/a", "from/b:to/b"], rblf.product_copy_files_by_pattern("from/%", "to/%", "a b")) globals, config = rblf.product_configuration("test/device", init) assert_eq( diff --git a/tools/rbcrun/host.go b/tools/rbcrun/host.go index 1e433346a3..b3dd4991f4 100644 --- a/tools/rbcrun/host.go +++ b/tools/rbcrun/host.go @@ -118,7 +118,7 @@ func fileExists(_ *starlark.Thread, b *starlark.Builtin, args starlark.Tuple, if err := starlark.UnpackPositionalArgs(b.Name(), args, kwargs, 1, &path); err != nil { return starlark.None, err } - if stat, err := os.Stat(path); err != nil || stat.IsDir() { + if _, err := os.Stat(path); err != nil { return starlark.False, nil } return starlark.True, nil diff --git a/tools/rbcrun/testdata/file_ops.star b/tools/rbcrun/testdata/file_ops.star index e1f1ac27ea..31631ef462 100644 --- a/tools/rbcrun/testdata/file_ops.star +++ b/tools/rbcrun/testdata/file_ops.star @@ -4,6 +4,7 @@ load("assert.star", "assert") def test(): myname = "file_ops.star" + assert.true(rblf_file_exists("."), "./ exists ") assert.true(rblf_file_exists(myname), "the file %s does exist" % myname) assert.true(not rblf_file_exists("no_such_file"), "the file no_such_file does not exist") files = rblf_wildcard("*.star") diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py index 97cfee9d91..f30e382ea8 100644 --- a/tools/releasetools/common.py +++ b/tools/releasetools/common.py @@ -449,6 +449,13 @@ class BuildInfo(object): return vabc_enabled @property + def is_vabc_xor(self): + vendor_prop = self.info_dict.get("vendor.build.prop") + vabc_xor_enabled = vendor_prop and \ + vendor_prop.GetProp("ro.virtual_ab.compression.xor.enabled") == "true" + return vabc_xor_enabled + + @property def vendor_suppressed_vabc(self): vendor_prop = self.info_dict.get("vendor.build.prop") vabc_suppressed = vendor_prop and \ diff --git a/tools/releasetools/ota_from_target_files.py b/tools/releasetools/ota_from_target_files.py index 1f3022bc69..366b51a23c 100755 --- a/tools/releasetools/ota_from_target_files.py +++ b/tools/releasetools/ota_from_target_files.py @@ -1091,6 +1091,9 @@ def GenerateAbOtaPackage(target_file, output_file, source_file=None): if target_info.vendor_suppressed_vabc: logger.info("Vendor suppressed VABC. Disabling") OPTIONS.disable_vabc = True + if not target_info.is_vabc_xor or OPTIONS.disable_vabc: + logger.info("VABC XOR Not supported, disabling") + OPTIONS.enable_vabc_xor = False additional_args = [] # Prepare custom images. |