Merge "Enforce property split in GSI"
diff --git a/OWNERS b/OWNERS
index 77496f1..e89a6a1 100644
--- a/OWNERS
+++ b/OWNERS
@@ -1,6 +1,8 @@
# Core build team (MTV)
ccross@android.com
dwillemsen@google.com
+asmundak@google.com
+jungjw@google.com
# To expedite LON reviews
hansson@google.com
diff --git a/core/dex_preopt_odex_install.mk b/core/dex_preopt_odex_install.mk
index 9832c2f..50e922e 100644
--- a/core/dex_preopt_odex_install.mk
+++ b/core/dex_preopt_odex_install.mk
@@ -105,6 +105,7 @@
my_dexpreopt_archs :=
my_dexpreopt_images :=
+my_dexpreopt_images_deps :=
my_dexpreopt_infix := boot
ifeq (true, $(DEXPREOPT_USE_APEX_IMAGE))
my_dexpreopt_infix := apex
@@ -143,12 +144,14 @@
# Odex for the 1st arch
my_dexpreopt_archs += $(TARGET_ARCH)
my_dexpreopt_images += $(DEXPREOPT_IMAGE_$(my_dexpreopt_infix)_$(TARGET_ARCH))
+ my_dexpreopt_images_deps += $(DEXPREOPT_IMAGE_DEPS_$(my_dexpreopt_infix)_$(TARGET_ARCH))
# Odex for the 2nd arch
ifdef TARGET_2ND_ARCH
ifneq ($(TARGET_TRANSLATE_2ND_ARCH),true)
ifneq (first,$(my_module_multilib))
my_dexpreopt_archs += $(TARGET_2ND_ARCH)
my_dexpreopt_images += $(DEXPREOPT_IMAGE_$(my_dexpreopt_infix)_$(TARGET_2ND_ARCH))
+ my_dexpreopt_images_deps += $(DEXPREOPT_IMAGE_DEPS_$(my_dexpreopt_infix)_$(TARGET_2ND_ARCH))
endif # my_module_multilib is not first.
endif # TARGET_TRANSLATE_2ND_ARCH not true
endif # TARGET_2ND_ARCH
@@ -160,6 +163,8 @@
my_dexpreopt_archs += $(TARGET_$(my_2nd_arch_prefix)ARCH)
my_dexpreopt_images += \
$(DEXPREOPT_IMAGE_$(my_dexpreopt_infix)_$(TARGET_$(my_2nd_arch_prefix)ARCH))
+ my_dexpreopt_images_deps += \
+ $(DEXPREOPT_IMAGE_DEPS_$(my_dexpreopt_infix)_$(TARGET_$(my_2nd_arch_prefix)ARCH))
ifdef TARGET_2ND_ARCH
ifeq ($(my_module_multilib),both)
# The non-preferred arch
@@ -167,6 +172,8 @@
my_dexpreopt_archs += $(TARGET_$(my_2nd_arch_prefix)ARCH)
my_dexpreopt_images += \
$(DEXPREOPT_IMAGE_$(my_dexpreopt_infix)_$(TARGET_$(my_2nd_arch_prefix)ARCH))
+ my_dexpreopt_images_deps += \
+ $(DEXPREOPT_IMAGE_DEPS_$(my_dexpreopt_infix)_$(TARGET_$(my_2nd_arch_prefix)ARCH))
endif # LOCAL_MULTILIB is both
endif # TARGET_2ND_ARCH
endif # LOCAL_MODULE_CLASS
@@ -263,7 +270,7 @@
my_dexpreopt_deps += \
$(foreach lib, $(my_dexpreopt_libs), \
$(call intermediates-dir-for,JAVA_LIBRARIES,$(lib),,COMMON)/javalib.jar)
- my_dexpreopt_deps += $(my_dexpreopt_images)
+ my_dexpreopt_deps += $(my_dexpreopt_images_deps)
my_dexpreopt_deps += $(DEXPREOPT_BOOTCLASSPATH_DEX_FILES)
$(my_dexpreopt_zip): PRIVATE_MODULE := $(LOCAL_MODULE)
diff --git a/core/java_common.mk b/core/java_common.mk
index 9909885..ff2886e 100644
--- a/core/java_common.mk
+++ b/core/java_common.mk
@@ -416,8 +416,8 @@
ifndef SOONG_SYSTEM_MODULES_$(my_system_modules)
$(call pretty-error, Invalid system modules $(my_system_modules))
endif
- full_java_system_modules_deps := $(SOONG_SYSTEM_MODULES_$(my_system_modules))
- my_system_modules_dir := $(patsubst %/lib/modules,%,$(SOONG_SYSTEM_MODULES_$(my_system_modules)))
+ full_java_system_modules_deps := $(SOONG_SYSTEM_MODULES_DEPS_$(my_system_modules))
+ my_system_modules_dir := $(SOONG_SYSTEM_MODULES_$(my_system_modules))
endif
endif
endif
diff --git a/envsetup.sh b/envsetup.sh
index 2fa5660..941c5f7 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -768,218 +768,6 @@
fi
}
-function m()
-{
- local T=$(gettop)
- if [ "$T" ]; then
- _wrap_build $T/build/soong/soong_ui.bash --make-mode $@
- else
- echo "Couldn't locate the top of the tree. Try setting TOP."
- return 1
- fi
-}
-
-function findmakefile()
-{
- local TOPFILE=build/make/core/envsetup.mk
- local HERE=$PWD
- if [ "$1" ]; then
- \cd $1
- fi;
- local T=
- while [ \( ! \( -f $TOPFILE \) \) -a \( $PWD != "/" \) ]; do
- T=`PWD= /bin/pwd`
- if [ -f "$T/Android.mk" -o -f "$T/Android.bp" ]; then
- echo $T/Android.mk
- \cd $HERE
- return
- fi
- \cd ..
- done
- \cd $HERE
- return 1
-}
-
-function mm()
-{
- local T=$(gettop)
- # If we're sitting in the root of the build tree, just do a
- # normal build.
- if [ -f build/soong/soong_ui.bash ]; then
- _wrap_build $T/build/soong/soong_ui.bash --make-mode $@
- else
- # Find the closest Android.mk file.
- local M=$(findmakefile)
- local MODULES=
- local GET_INSTALL_PATH=
- local ARGS=
- # Remove the path to top as the makefilepath needs to be relative
- local M=`echo $M|sed 's:'$T'/::'`
- if [ ! "$T" ]; then
- echo "Couldn't locate the top of the tree. Try setting TOP."
- return 1
- elif [ ! "$M" ]; then
- echo "Couldn't locate a makefile from the current directory."
- return 1
- else
- local ARG
- for ARG in $@; do
- case $ARG in
- GET-INSTALL-PATH) GET_INSTALL_PATH=$ARG;;
- esac
- done
- if [ -n "$GET_INSTALL_PATH" ]; then
- MODULES=
- ARGS=GET-INSTALL-PATH-IN-$(dirname ${M})
- ARGS=${ARGS//\//-}
- else
- MODULES=MODULES-IN-$(dirname ${M})
- # Convert "/" to "-".
- MODULES=${MODULES//\//-}
- ARGS=$@
- fi
- if [ "1" = "${WITH_TIDY_ONLY}" -o "true" = "${WITH_TIDY_ONLY}" ]; then
- MODULES=tidy_only
- fi
- ONE_SHOT_MAKEFILE=$M _wrap_build $T/build/soong/soong_ui.bash --make-mode $MODULES $ARGS
- fi
- fi
-}
-
-function mmm()
-{
- local T=$(gettop)
- if [ "$T" ]; then
- local MAKEFILE=
- local MODULES=
- local MODULES_IN_PATHS=
- local ARGS=
- local DIR TO_CHOP
- local DIR_MODULES
- local GET_INSTALL_PATH=
- local GET_INSTALL_PATHS=
- local DASH_ARGS=$(echo "$@" | awk -v RS=" " -v ORS=" " '/^-.*$/')
- local DIRS=$(echo "$@" | awk -v RS=" " -v ORS=" " '/^[^-].*$/')
- for DIR in $DIRS ; do
- DIR_MODULES=`echo $DIR | sed -n -e 's/.*:\(.*$\)/\1/p' | sed 's/,/ /'`
- DIR=`echo $DIR | sed -e 's/:.*//' -e 's:/$::'`
- # Remove the leading ./ and trailing / if any exists.
- DIR=${DIR#./}
- DIR=${DIR%/}
- local M
- if [ "$DIR_MODULES" = "" ]; then
- M=$(findmakefile $DIR)
- else
- # Only check the target directory if a module is specified.
- if [ -f $DIR/Android.mk -o -f $DIR/Android.bp ]; then
- local HERE=$PWD
- cd $DIR
- M=`PWD= /bin/pwd`
- M=$M/Android.mk
- cd $HERE
- fi
- fi
- if [ "$M" ]; then
- # Remove the path to top as the makefilepath needs to be relative
- local M=`echo $M|sed 's:'$T'/::'`
- if [ "$DIR_MODULES" = "" ]; then
- MODULES_IN_PATHS="$MODULES_IN_PATHS MODULES-IN-$(dirname ${M})"
- GET_INSTALL_PATHS="$GET_INSTALL_PATHS GET-INSTALL-PATH-IN-$(dirname ${M})"
- else
- MODULES="$MODULES $DIR_MODULES"
- fi
- MAKEFILE="$MAKEFILE $M"
- else
- case $DIR in
- showcommands | snod | dist | *=*) ARGS="$ARGS $DIR";;
- GET-INSTALL-PATH) GET_INSTALL_PATH=$DIR;;
- *) if [ -d $DIR ]; then
- echo "No Android.mk in $DIR.";
- else
- echo "Couldn't locate the directory $DIR";
- fi
- return 1;;
- esac
- fi
- done
- if [ -n "$GET_INSTALL_PATH" ]; then
- ARGS=${GET_INSTALL_PATHS//\//-}
- MODULES=
- MODULES_IN_PATHS=
- fi
- if [ "1" = "${WITH_TIDY_ONLY}" -o "true" = "${WITH_TIDY_ONLY}" ]; then
- MODULES=tidy_only
- MODULES_IN_PATHS=
- fi
- # Convert "/" to "-".
- MODULES_IN_PATHS=${MODULES_IN_PATHS//\//-}
- ONE_SHOT_MAKEFILE="$MAKEFILE" _wrap_build $T/build/soong/soong_ui.bash --make-mode $DASH_ARGS $MODULES $MODULES_IN_PATHS $ARGS
- else
- echo "Couldn't locate the top of the tree. Try setting TOP."
- return 1
- fi
-}
-
-function mma()
-{
- local T=$(gettop)
- if [ -f build/soong/soong_ui.bash ]; then
- _wrap_build $T/build/soong/soong_ui.bash --make-mode $@
- else
- if [ ! "$T" ]; then
- echo "Couldn't locate the top of the tree. Try setting TOP."
- return 1
- fi
- local M=$(findmakefile || echo $(realpath $PWD)/Android.mk)
- # Remove the path to top as the makefilepath needs to be relative
- local M=`echo $M|sed 's:'$T'/::'`
- local MODULES_IN_PATHS=MODULES-IN-$(dirname ${M})
- # Convert "/" to "-".
- MODULES_IN_PATHS=${MODULES_IN_PATHS//\//-}
- _wrap_build $T/build/soong/soong_ui.bash --make-mode $@ $MODULES_IN_PATHS
- fi
-}
-
-function mmma()
-{
- local T=$(gettop)
- if [ "$T" ]; then
- local DASH_ARGS=$(echo "$@" | awk -v RS=" " -v ORS=" " '/^-.*$/')
- local DIRS=$(echo "$@" | awk -v RS=" " -v ORS=" " '/^[^-].*$/')
- local MY_PWD=`PWD= /bin/pwd`
- if [ "$MY_PWD" = "$T" ]; then
- MY_PWD=
- else
- MY_PWD=`echo $MY_PWD|sed 's:'$T'/::'`
- fi
- local DIR=
- local MODULES_IN_PATHS=
- local ARGS=
- for DIR in $DIRS ; do
- if [ -d $DIR ]; then
- # Remove the leading ./ and trailing / if any exists.
- DIR=${DIR#./}
- DIR=${DIR%/}
- if [ "$MY_PWD" != "" ]; then
- DIR=$MY_PWD/$DIR
- fi
- MODULES_IN_PATHS="$MODULES_IN_PATHS MODULES-IN-$DIR"
- else
- case $DIR in
- showcommands | snod | dist | *=*) ARGS="$ARGS $DIR";;
- *) echo "Couldn't find directory $DIR"; return 1;;
- esac
- fi
- done
- # Convert "/" to "-".
- MODULES_IN_PATHS=${MODULES_IN_PATHS//\//-}
- _wrap_build $T/build/soong/soong_ui.bash --make-mode $DASH_ARGS $ARGS $MODULES_IN_PATHS
- else
- echo "Couldn't locate the top of the tree. Try setting TOP."
- return 1
- fi
-}
-
function croot()
{
local T=$(gettop)
@@ -1665,6 +1453,41 @@
return $ret
}
+function _trigger_build()
+(
+ local -r bc="$1"; shift
+ if T="$(gettop)"; then
+ _wrap_build "$T/build/soong/soong_ui.bash" --build-mode --${bc} --dir="$(pwd)" "$@"
+ else
+ echo "Couldn't locate the top of the tree. Try setting TOP."
+ fi
+)
+
+function m()
+(
+ _trigger_build "all-modules" "$@"
+)
+
+function mm()
+(
+ _trigger_build "modules-in-a-dir-no-deps" "$@"
+)
+
+function mmm()
+(
+ _trigger_build "modules-in-dirs-no-deps" "$@"
+)
+
+function mma()
+(
+ _trigger_build "modules-in-a-dir" "$@"
+)
+
+function mmma()
+(
+ _trigger_build "modules-in-dirs" "$@"
+)
+
function make()
{
_wrap_build $(get_make_command "$@") "$@"
diff --git a/target/product/base_system.mk b/target/product/base_system.mk
index 7bec975..f09493e 100644
--- a/target/product/base_system.mk
+++ b/target/product/base_system.mk
@@ -299,12 +299,9 @@
unwind_symbols \
viewcompiler \
tzdata_host \
- tzdata_host_runtime_apex \
tzdata_host_tzdata_apex \
- tzlookup.xml_host_runtime_apex \
tzlookup.xml_host_tzdata_apex \
tz_version_host \
- tz_version_host_runtime_apex \
tz_version_host_tzdata_apex \
ifeq ($(TARGET_CORE_JARS),)
diff --git a/target/product/gsi_common.mk b/target/product/gsi_common.mk
index 0428d75..7578f92 100644
--- a/target/product/gsi_common.mk
+++ b/target/product/gsi_common.mk
@@ -23,6 +23,11 @@
# Default AOSP sounds
$(call inherit-product-if-exists, frameworks/base/data/sounds/AllAudio.mk)
+# GSI doesn't support apex for now.
+# Properties set in product take precedence over those in vendor.
+PRODUCT_PRODUCT_PROPERTIES += \
+ ro.apex.updatable=false
+
# Additional settings used in all AOSP builds
PRODUCT_PRODUCT_PROPERTIES += \
ro.config.ringtone=Ring_Synth_04.ogg \
diff --git a/tools/fs_config/README b/tools/fs_config/README
index f7d4deb..21bdeb8 100644
--- a/tools/fs_config/README
+++ b/tools/fs_config/README
@@ -3,16 +3,33 @@
| _ <| __|| _ || | || \/ || __|
\__|\_/\_____/\__|__/|_____/\__ \__/\_____/
-Generating the android_filesystem_config.h:
+The fs_config_generator.py tool uses the platform android_filesystem_config.h and the
+TARGET_FS_CONFIG_GEN files to generate the fs_config_dirs and fs_config_files files for each
+partition, as well as passwd and group files, and the generated_oem_aid.h header.
-To generate the android_filesystem_config.h file, one can set
-TARGET_FS_CONFIG_GEN, which can be a list of intermediate fs configuration
-files.
+The fs_config_dirs and fs_config_files binary files are interpreted by the libcutils fs_config()
+function, along with the built-in defaults, to serve as overrides to complete the results. The
+Target files are used by filesystem and adb tools to ensure that the file and directory properties
+are preserved during runtime operations. The host files in the ${OUT} directory are used in the
+final stages when building the filesystem images to set the file and directory properties.
-The parsing of the config file follows the Python ConfigParser specification,
-with the sections and fields as defined below. There are two types of sections,
-both sections require all options to be specified. The first section type is
-the "caps" section.
+See ./fs_config_generator.py fsconfig --help for how these files are generated.
+
+The passwd and group files are formatted as documented in man pages passwd(5) and group(5) and used
+by bionic for implementing getpwnam() and related functions.
+
+See ./fs_config_generator.py passwd --help and ./fs_config_generator.py group --help for how these
+files are generated.
+
+The generated_oem_aid.h creates identifiers for non-platform AIDs for developers wishing to use them
+in their native code. To do so, include the oemaids_headers header library in the corresponding
+makefile and #include "generated_oem_aid.h" in the code wishing to use these identifiers.
+
+See ./fs_config_generator.py oemaid --help for how this file is generated.
+
+The parsing of the TARGET_FS_CONFIG_GEN files follows the Python ConfigParser specification, with
+the sections and fields as defined below. There are two types of sections, both sections require all
+options to be specified. The first section type is the "caps" section.
The "caps" section follows the following syntax:
@@ -103,11 +120,6 @@
file and to line up files. Sync lines are placed with the source file as comments in the generated
header file.
-For OEMs wishing to use the define AIDs in their native code, one can access the generated header
-file like so:
- 1. In your C code just #include "generated_oem_aid.h" and start using the declared identifiers.
- 2. In your Makefile add this static library like so: LOCAL_HEADER_LIBRARIES := oemaids_headers
-
Unit Tests:
From within the fs_config directory, unit tests can be executed like so:
@@ -123,45 +135,3 @@
To add new tests, simply add a test_<xxx> method to the test class. It will automatically
get picked up and added to the test suite.
-
-Using the android_filesystem_config.h:
-
-The tool fs_config_generate is built as a dependency to fs_config_dirs and
-fs_config_files host targets, and #includes the above supplied or generated
-android_filesystem_config.h file, and can be instructed to generate the binary
-data that lands in the device target locations /system/etc/fs_config_dirs and
-/system/etc/fs_config_files and in the host's ${OUT} locations
-${OUT}/target/product/<device>/system/etc/fs_config_dirs and
-${OUT}/target/product/<device>/system/etc/fs_config_files. The binary files
-are interpreted by the libcutils fs_conf() function, along with the built-in
-defaults, to serve as overrides to complete the results. The Target files are
-used by filesystem and adb tools to ensure that the file and directory
-properties are preserved during runtime operations. The host files in the
-${OUT} directory are used in the final stages when building the filesystem
-images to set the file and directory properties.
-
-For systems with separate partition images, such as vendor or oem,
-fs_config_generate can be instructed to filter the specific file references
-to land in each partition's etc/fs_config_dirs or etc/fs_config_files
-locations. The filter can be instructed to blacklist a partition's data by
-providing the comma separated minus sign prefixed partition names. The filter
-can be instructed to whitelist partition data by providing the partition name.
-
-For example:
-- For system.img, but not vendor, oem or odm file references:
- -P -vendor,-oem,-odm
- This makes sure the results only contain content associated with the
- system, and not vendor, oem or odm, blacklisting their content.
-- For vendor.img file references: -P vendor
-- For oem.img file references: -P oem
-- For odm.img file references: -P odm
-
-fs_config_generate --help reports:
-
-Generate binary content for fs_config_dirs (-D) and fs_config_files (-F)
-from device-specific android_filesystem_config.h override. Filter based
-on a comma separated partition list (-P) whitelist or prefixed by a
-minus blacklist. Partitions are identified as path references to
-<partition>/ or system/<partition>
-
-Usage: fs_config_generate -D|-F [-P list] [-o output-file]
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index 80f8002..7cff831 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -863,7 +863,7 @@
A Image object. If it is a sparse image and reset_file_map is False, the
image will have file_map info loaded.
"""
- if info_dict == None:
+ if info_dict is None:
info_dict = LoadInfoDict(input_zip)
is_sparse = info_dict.get("extfs_sparse_flag")
@@ -1568,6 +1568,15 @@
perms = 0o100644
else:
zinfo = zinfo_or_arcname
+ # Python 2 and 3 behave differently when calling ZipFile.writestr() with
+ # zinfo.external_attr being 0. Python 3 uses `0o600 << 16` as the value for
+ # such a case (since
+ # https://github.com/python/cpython/commit/18ee29d0b870caddc0806916ca2c823254f1a1f9),
+ # which seems to make more sense. Otherwise the entry will have 0o000 as the
+ # permission bits. We follow the logic in Python 3 to get consistent
+ # behavior between using the two versions.
+ if not zinfo.external_attr:
+ zinfo.external_attr = 0o600 << 16
# If compress_type is given, it overrides the value in zinfo.
if compress_type is not None:
@@ -1600,7 +1609,7 @@
Raises:
AssertionError: In case of non-zero return from 'zip'.
"""
- if isinstance(entries, basestring):
+ if isinstance(entries, str):
entries = [entries]
cmd = ["zip", "-d", zip_filename] + entries
RunAndCheckOutput(cmd)
@@ -2370,14 +2379,16 @@
def __init__(self, info_dict, block_diffs, progress_dict=None,
source_info_dict=None):
if progress_dict is None:
- progress_dict = dict()
+ progress_dict = {}
self._remove_all_before_apply = False
if source_info_dict is None:
self._remove_all_before_apply = True
- source_info_dict = dict()
+ source_info_dict = {}
- block_diff_dict = {e.partition:e for e in block_diffs}
+ block_diff_dict = collections.OrderedDict(
+ [(e.partition, e) for e in block_diffs])
+
assert len(block_diff_dict) == len(block_diffs), \
"Duplicated BlockDifference object for {}".format(
[partition for partition, count in
diff --git a/tools/releasetools/test_common.py b/tools/releasetools/test_common.py
index 9b76734..11ac9f5 100644
--- a/tools/releasetools/test_common.py
+++ b/tools/releasetools/test_common.py
@@ -41,7 +41,7 @@
# Generate a long string with holes, e.g. 'xyz\x00abc\x00...'.
for _ in range(0, size, step_size):
yield os.urandom(block_size)
- yield '\0' * (step_size - block_size)
+ yield b'\0' * (step_size - block_size)
class CommonZipTest(test_utils.ReleaseToolsTestCase):
@@ -72,7 +72,7 @@
# Verify the zip contents.
entry = zip_file.open(arcname)
sha1_hash = sha1()
- for chunk in iter(lambda: entry.read(4 * MiB), ''):
+ for chunk in iter(lambda: entry.read(4 * MiB), b''):
sha1_hash.update(chunk)
self.assertEqual(expected_hash, sha1_hash.hexdigest())
self.assertIsNone(zip_file.testzip())
@@ -97,8 +97,8 @@
try:
sha1_hash = sha1()
for data in contents:
- sha1_hash.update(data)
- test_file.write(data)
+ sha1_hash.update(bytes(data))
+ test_file.write(bytes(data))
test_file.close()
expected_stat = os.stat(test_file_name)
@@ -136,8 +136,11 @@
expected_mode = extra_args.get("perms", 0o644)
else:
arcname = zinfo_or_arcname.filename
- expected_mode = extra_args.get("perms",
- zinfo_or_arcname.external_attr >> 16)
+ if zinfo_or_arcname.external_attr:
+ zinfo_perms = zinfo_or_arcname.external_attr >> 16
+ else:
+ zinfo_perms = 0o600
+ expected_mode = extra_args.get("perms", zinfo_perms)
common.ZipWriteStr(zip_file, zinfo_or_arcname, contents, **extra_args)
common.ZipClose(zip_file)
@@ -262,6 +265,10 @@
"perms": 0o600,
"compress_type": zipfile.ZIP_STORED,
})
+ self._test_ZipWriteStr(zinfo, random_string, {
+ "perms": 0o000,
+ "compress_type": zipfile.ZIP_STORED,
+ })
def test_ZipWriteStr_large_file(self):
# zipfile.writestr() doesn't work when the str size is over 2GiB even with
@@ -274,9 +281,9 @@
})
def test_ZipWriteStr_resets_ZIP64_LIMIT(self):
- self._test_reset_ZIP64_LIMIT(self._test_ZipWriteStr, "foo", "")
+ self._test_reset_ZIP64_LIMIT(self._test_ZipWriteStr, 'foo', b'')
zinfo = zipfile.ZipInfo(filename="foo")
- self._test_reset_ZIP64_LIMIT(self._test_ZipWriteStr, zinfo, "")
+ self._test_reset_ZIP64_LIMIT(self._test_ZipWriteStr, zinfo, b'')
def test_bug21309935(self):
zip_file = tempfile.NamedTemporaryFile(delete=False)
@@ -1151,7 +1158,7 @@
class DynamicPartitionsDifferenceTest(test_utils.ReleaseToolsTestCase):
@staticmethod
def get_op_list(output_path):
- with zipfile.ZipFile(output_path, 'r') as output_zip:
+ with zipfile.ZipFile(output_path) as output_zip:
with output_zip.open("dynamic_partitions_op_list") as op_list:
return [line.strip() for line in op_list.readlines()
if not line.startswith("#")]
@@ -1176,12 +1183,12 @@
self.assertEqual(str(self.script).strip(), """
assert(update_dynamic_partitions(package_extract_file("dynamic_partitions_op_list")));
-patch(vendor);
-verify(vendor);
-unmap_partition("vendor");
patch(system);
verify(system);
unmap_partition("system");
+patch(vendor);
+verify(vendor);
+unmap_partition("vendor");
""".strip())
lines = self.get_op_list(self.output_path)
@@ -1229,7 +1236,8 @@
grown = lines.index("resize_group group_baz 4294967296")
added = lines.index("add_group group_qux 1073741824")
- self.assertLess(max(removed, shrunk) < min(grown, added),
+ self.assertLess(max(removed, shrunk),
+ min(grown, added),
"ops that remove / shrink partitions must precede ops that "
"grow / add partitions")