Merge "Move check partition size logs to a file"
This commit is contained in:
@@ -3635,33 +3635,32 @@ ifeq (,$(TARGET_BUILD_APPS))
|
|||||||
|
|
||||||
ifeq (true,$(PRODUCT_BUILD_SUPER_PARTITION))
|
ifeq (true,$(PRODUCT_BUILD_SUPER_PARTITION))
|
||||||
|
|
||||||
droid_targets: check-all-partition-sizes
|
|
||||||
|
|
||||||
.PHONY: check-all-partition-sizes check-all-partition-sizes-nodeps
|
|
||||||
|
|
||||||
check_all_partition_sizes_file := $(call intermediates-dir-for,PACKAGING,check-all-partition-sizes)/timestamp
|
|
||||||
|
|
||||||
check-all-partition-sizes: $(check_all_partition_sizes_file)
|
|
||||||
|
|
||||||
$(check_all_partition_sizes_file): \
|
|
||||||
$(CHECK_PARTITION_SIZES) \
|
|
||||||
$(call images-for-partitions,$(BOARD_SUPER_PARTITION_PARTITION_LIST))
|
|
||||||
|
|
||||||
# $(1): misc_info.txt
|
# $(1): misc_info.txt
|
||||||
|
# #(2): optional log file
|
||||||
define check-all-partition-sizes-target
|
define check-all-partition-sizes-target
|
||||||
mkdir -p $(dir $(1))
|
mkdir -p $(dir $(1))
|
||||||
rm -f $(1)
|
rm -f $(1)
|
||||||
$(call dump-super-image-info, $(1))
|
$(call dump-super-image-info, $(1))
|
||||||
$(foreach partition,$(BOARD_SUPER_PARTITION_PARTITION_LIST), \
|
$(foreach partition,$(BOARD_SUPER_PARTITION_PARTITION_LIST), \
|
||||||
echo "$(partition)_image="$(call images-for-partitions,$(partition)) >> $(1);)
|
echo "$(partition)_image="$(call images-for-partitions,$(partition)) >> $(1);)
|
||||||
$(CHECK_PARTITION_SIZES) -v $(1)
|
$(CHECK_PARTITION_SIZES) $(if $(2),--logfile $(2),-v) $(1)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(check_all_partition_sizes_file):
|
check_all_partition_sizes_log := $(call intermediates-dir-for,PACKAGING,check-all-partition-sizes)/check_all_partition_sizes_log
|
||||||
$(call check-all-partition-sizes-target, \
|
droid_targets: $(check_all_partition_sizes_log)
|
||||||
$(call intermediates-dir-for,PACKAGING,check-all-partition-sizes)/misc_info.txt)
|
$(call dist-for-goals, droid_targets, $(check_all_partition_sizes_log))
|
||||||
touch $@
|
|
||||||
|
|
||||||
|
$(check_all_partition_sizes_log): \
|
||||||
|
$(CHECK_PARTITION_SIZES) \
|
||||||
|
$(call images-for-partitions,$(BOARD_SUPER_PARTITION_PARTITION_LIST))
|
||||||
|
$(call check-all-partition-sizes-target, \
|
||||||
|
$(call intermediates-dir-for,PACKAGING,check-all-partition-sizes)/misc_info.txt, \
|
||||||
|
$@)
|
||||||
|
|
||||||
|
.PHONY: check-all-partition-sizes
|
||||||
|
check-all-partition-sizes: $(check_all_partition_sizes_log)
|
||||||
|
|
||||||
|
.PHONY: check-all-partition-sizes-nodeps
|
||||||
check-all-partition-sizes-nodeps:
|
check-all-partition-sizes-nodeps:
|
||||||
$(call check-all-partition-sizes-target, \
|
$(call check-all-partition-sizes-target, \
|
||||||
$(call intermediates-dir-for,PACKAGING,check-all-partition-sizes-nodeps)/misc_info.txt)
|
$(call intermediates-dir-for,PACKAGING,check-all-partition-sizes-nodeps)/misc_info.txt)
|
||||||
|
@@ -87,6 +87,7 @@ class Options(object):
|
|||||||
# Stash size cannot exceed cache_size * threshold.
|
# Stash size cannot exceed cache_size * threshold.
|
||||||
self.cache_size = None
|
self.cache_size = None
|
||||||
self.stash_threshold = 0.8
|
self.stash_threshold = 0.8
|
||||||
|
self.logfile = None
|
||||||
|
|
||||||
|
|
||||||
OPTIONS = Options()
|
OPTIONS = Options()
|
||||||
@@ -158,13 +159,14 @@ def InitLogging():
|
|||||||
'default': {
|
'default': {
|
||||||
'class': 'logging.StreamHandler',
|
'class': 'logging.StreamHandler',
|
||||||
'formatter': 'standard',
|
'formatter': 'standard',
|
||||||
|
'level': 'WARNING',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'loggers': {
|
'loggers': {
|
||||||
'': {
|
'': {
|
||||||
'handlers': ['default'],
|
'handlers': ['default'],
|
||||||
'level': 'WARNING',
|
|
||||||
'propagate': True,
|
'propagate': True,
|
||||||
|
'level': 'INFO',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -177,8 +179,19 @@ def InitLogging():
|
|||||||
|
|
||||||
# Increase the logging level for verbose mode.
|
# Increase the logging level for verbose mode.
|
||||||
if OPTIONS.verbose:
|
if OPTIONS.verbose:
|
||||||
config = copy.deepcopy(DEFAULT_LOGGING_CONFIG)
|
config = copy.deepcopy(config)
|
||||||
config['loggers']['']['level'] = 'INFO'
|
config['handlers']['default']['level'] = 'INFO'
|
||||||
|
|
||||||
|
if OPTIONS.logfile:
|
||||||
|
config = copy.deepcopy(config)
|
||||||
|
config['handlers']['logfile'] = {
|
||||||
|
'class': 'logging.FileHandler',
|
||||||
|
'formatter': 'standard',
|
||||||
|
'level': 'INFO',
|
||||||
|
'mode': 'w',
|
||||||
|
'filename': OPTIONS.logfile,
|
||||||
|
}
|
||||||
|
config['loggers']['']['handlers'].append('logfile')
|
||||||
|
|
||||||
logging.config.dictConfig(config)
|
logging.config.dictConfig(config)
|
||||||
|
|
||||||
@@ -1797,6 +1810,9 @@ Global options
|
|||||||
|
|
||||||
-h (--help)
|
-h (--help)
|
||||||
Display this usage message and exit.
|
Display this usage message and exit.
|
||||||
|
|
||||||
|
--logfile <file>
|
||||||
|
Put verbose logs to specified file (regardless of --verbose option.)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def Usage(docstring):
|
def Usage(docstring):
|
||||||
@@ -1822,7 +1838,7 @@ def ParseOptions(argv,
|
|||||||
"java_path=", "java_args=", "public_key_suffix=",
|
"java_path=", "java_args=", "public_key_suffix=",
|
||||||
"private_key_suffix=", "boot_signer_path=", "boot_signer_args=",
|
"private_key_suffix=", "boot_signer_path=", "boot_signer_args=",
|
||||||
"verity_signer_path=", "verity_signer_args=", "device_specific=",
|
"verity_signer_path=", "verity_signer_args=", "device_specific=",
|
||||||
"extra="] +
|
"extra=", "logfile="] +
|
||||||
list(extra_long_opts))
|
list(extra_long_opts))
|
||||||
except getopt.GetoptError as err:
|
except getopt.GetoptError as err:
|
||||||
Usage(docstring)
|
Usage(docstring)
|
||||||
@@ -1864,6 +1880,8 @@ def ParseOptions(argv,
|
|||||||
elif o in ("-x", "--extra"):
|
elif o in ("-x", "--extra"):
|
||||||
key, value = a.split("=", 1)
|
key, value = a.split("=", 1)
|
||||||
OPTIONS.extras[key] = value
|
OPTIONS.extras[key] = value
|
||||||
|
elif o in ("--logfile",):
|
||||||
|
OPTIONS.logfile = a
|
||||||
else:
|
else:
|
||||||
if extra_option_handler is None or not extra_option_handler(o, a):
|
if extra_option_handler is None or not extra_option_handler(o, a):
|
||||||
assert False, "unknown option \"%s\"" % (o,)
|
assert False, "unknown option \"%s\"" % (o,)
|
||||||
|
Reference in New Issue
Block a user