Merge "Add null and console dev nodes to the Android initramfs"
diff --git a/core/Makefile b/core/Makefile
index 51541d8..88c3853 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -740,12 +740,6 @@
$(call dist-for-goals,droidcore-unbundled,$(WALL_WERROR))
# -----------------------------------------------------------------
-# C/C++ flag information for modules
-$(call dist-for-goals,droidcore-unbundled,$(SOONG_MODULES_CFLAG_ARTIFACTS))
-
-$(foreach a,$(SOONG_MODULES_CFLAG_ARTIFACTS),$(call declare-0p-target,$(call word-colon,1,$(a))))
-
-# -----------------------------------------------------------------
# Modules missing profile files
PGO_PROFILE_MISSING := $(PRODUCT_OUT)/pgo_profile_file_missing.txt
$(PGO_PROFILE_MISSING):
@@ -3495,6 +3489,18 @@
INTERNAL_VENDORIMAGE_FILES += $(call create-partition-compat-symlink,$(TARGET_OUT_VENDOR)/lib/modules,/vendor_dlkm/lib/modules,vendor_dlkm.img)
endif
+# Install vendor/etc/linker.config.pb when PRODUCT_VENDOR_LINKER_CONFIG_FRAGMENTS is set
+ifneq ($(strip $(PRODUCT_VENDOR_LINKER_CONFIG_FRAGMENTS)),)
+vendor_linker_config_file := $(TARGET_OUT_VENDOR)/etc/linker.config.pb
+$(vendor_linker_config_file): private_linker_config_fragments := $(PRODUCT_VENDOR_LINKER_CONFIG_FRAGMENTS)
+$(vendor_linker_config_file): $(PRODUCT_VENDOR_LINKER_CONFIG_FRAGMENTS) | $(HOST_OUT_EXECUTABLES)/conv_linker_config
+ $(HOST_OUT_EXECUTABLES)/conv_linker_config proto \
+ --source $(call normalize-path-list,$(private_linker_config_fragments)) \
+ --output $@
+$(call define declare-0p-target,$(vendor_linker_config_file),)
+INTERNAL_VENDORIMAGE_FILES += $(vendor_linker_config_file)
+endif
+
INSTALLED_FILES_FILE_VENDOR := $(PRODUCT_OUT)/installed-files-vendor.txt
INSTALLED_FILES_JSON_VENDOR := $(INSTALLED_FILES_FILE_VENDOR:.txt=.json)
$(INSTALLED_FILES_FILE_VENDOR): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_VENDOR)
@@ -4081,7 +4087,8 @@
INTERNAL_AVB_PARTITIONS_IN_CHAINED_VBMETA_IMAGES := \
$(BOARD_AVB_VBMETA_SYSTEM) \
- $(BOARD_AVB_VBMETA_VENDOR)
+ $(BOARD_AVB_VBMETA_VENDOR) \
+ $(foreach partition,$(BOARD_AVB_VBMETA_CUSTOM_PARTITIONS),$(BOARD_AVB_VBMETA_$(call to-upper,$(partition))))
# Not allowing the same partition to appear in multiple groups.
ifneq ($(words $(sort $(INTERNAL_AVB_PARTITIONS_IN_CHAINED_VBMETA_IMAGES))),$(words $(INTERNAL_AVB_PARTITIONS_IN_CHAINED_VBMETA_IMAGES)))
@@ -4387,6 +4394,11 @@
$(eval $(call check-and-set-avb-args,vbmeta_vendor))
endif
+ifdef BOARD_AVB_VBMETA_CUSTOM_PARTITIONS
+$(foreach partition,$(BOARD_AVB_VBMETA_CUSTOM_PARTITIONS),$(eval $(call check-and-set-avb-args,vbmeta_$(partition))))
+$(foreach partition,$(BOARD_AVB_VBMETA_CUSTOM_PARTITIONS),$(eval BOARD_AVB_MAKE_VBMETA_$(call to-upper,$(partition))_IMAGE_ARGS += --padding_size 4096))
+endif
+
ifneq ($(strip $(BOARD_CUSTOMIMAGES_PARTITION_LIST)),)
$(foreach partition,$(BOARD_CUSTOMIMAGES_PARTITION_LIST), \
$(eval $(call check-and-set-custom-avb-chain-args,$(partition))))
@@ -4415,6 +4427,13 @@
--rollback_index $(BOARD_AVB_VBMETA_VENDOR_ROLLBACK_INDEX)
endif
+ifdef BOARD_AVB_VBMETA_CUSTOM_PARTITIONS
+ $(foreach partition,$(call to-upper,$(BOARD_AVB_VBMETA_CUSTOM_PARTITIONS)), \
+ $(if $(BOARD_AVB_VBMETA_$(partition)_ROLLBACK_INDEX),$(eval \
+ BOARD_AVB_MAKE_VBMETA_$(partition)_IMAGE_ARGS += \
+ --rollback_index $(BOARD_AVB_VBMETA_$(partition)_ROLLBACK_INDEX))))
+endif
+
# $(1): the directory to extract public keys to
define extract-avb-chain-public-keys
$(if $(BOARD_AVB_BOOT_KEY_PATH),\
@@ -4471,7 +4490,11 @@
$(if $(BOARD_CUSTOMIMAGES_PARTITION_LIST),\
$(hide) $(foreach partition,$(BOARD_CUSTOMIMAGES_PARTITION_LIST), \
$(AVBTOOL) extract_public_key --key $(BOARD_AVB_$(call to-upper,$(partition))_KEY_PATH) \
- --output $(1)/$(partition).avbpubkey;))
+ --output $(1)/$(partition).avbpubkey;)) \
+ $(if $(BOARD_AVB_VBMETA_CUSTOM_PARTITIONS),\
+ $(hide) $(foreach partition,$(BOARD_AVB_VBMETA_CUSTOM_PARTITIONS), \
+ $(AVBTOOL) extract_public_key --key $(BOARD_AVB_VBMETA_$(call to-upper,$(partition))_KEY_PATH) \
+ --output $(1)/vbmeta_$(partition).avbpubkey;))
endef
# Builds a chained VBMeta image. This VBMeta image will contain the descriptors for the partitions
@@ -4483,13 +4506,13 @@
# $(1): VBMeta image name, such as "vbmeta_system", "vbmeta_vendor" etc.
# $(2): Output filename.
define build-chained-vbmeta-image
- $(call pretty,"Target chained vbmeta image: $@")
- $(hide) $(AVBTOOL) make_vbmeta_image \
- $(INTERNAL_AVB_$(call to-upper,$(1))_SIGNING_ARGS) \
- $(BOARD_AVB_MAKE_$(call to-upper,$(1))_IMAGE_ARGS) \
- $(foreach image,$(BOARD_AVB_$(call to-upper,$(1))), \
- --include_descriptors_from_image $(call images-for-partitions,$(image))) \
- --output $@
+ $(call pretty,"Target chained vbmeta image: $@")
+ $(hide) $(AVBTOOL) make_vbmeta_image \
+ $(INTERNAL_AVB_$(call to-upper,$(1))_SIGNING_ARGS) \
+ $(BOARD_AVB_MAKE_$(call to-upper,$(1))_IMAGE_ARGS) \
+ $(foreach image,$(BOARD_AVB_$(call to-upper,$(1))), \
+ --include_descriptors_from_image $(call images-for-partitions,$(image))) \
+ --output $@
endef
ifdef BUILDING_SYSTEM_IMAGE
@@ -4517,7 +4540,26 @@
$(call declare-1p-container,$(INSTALLED_VBMETA_VENDORIMAGE_TARGET),)
-UNMOUNTED_NOTICE_VENDOR_DEPS+= $(INSTALLED_VBMETA_VENDORIMAGE_TARGET)
+UNMOUNTED_NOTICE_VENDOR_DEPS += $(INSTALLED_VBMETA_VENDORIMAGE_TARGET)
+endif
+
+ifdef BOARD_AVB_VBMETA_CUSTOM_PARTITIONS
+define declare-custom-vbmeta-target
+INSTALLED_VBMETA_$(call to-upper,$(1))IMAGE_TARGET := $(PRODUCT_OUT)/vbmeta_$(call to-lower,$(1)).img
+$$(INSTALLED_VBMETA_$(call to-upper,$(1))IMAGE_TARGET): \
+ $(AVBTOOL) \
+ $(call images-for-partitions,$(BOARD_AVB_VBMETA_$(call to-upper,$(1)))) \
+ $(BOARD_AVB_VBMETA_$(call to-upper,$(1))_KEY_PATH)
+ $$(call build-chained-vbmeta-image,vbmeta_$(call to-lower,$(1)))
+
+$(call declare-1p-container,$(INSTALLED_VBMETA_$(call to-upper,$(1))IMAGE_TARGET),)
+
+UNMOUNTED_NOTICE_VENDOR_DEPS += $(INSTALLED_VBMETA_$(call to-upper,$(1))IMAGE_TARGET)
+endef
+
+$(foreach partition,\
+ $(call to-upper,$(BOARD_AVB_VBMETA_CUSTOM_PARTITIONS)),\
+ $(eval $(call declare-custom-vbmeta-target,$(partition))))
endif
define build-vbmetaimage-target
@@ -4537,6 +4579,7 @@
$(INSTALLED_VBMETAIMAGE_TARGET): PRIVATE_AVB_VBMETA_SIGNING_ARGS := \
--algorithm $(BOARD_AVB_ALGORITHM) --key $(BOARD_AVB_KEY_PATH)
+
$(INSTALLED_VBMETAIMAGE_TARGET): \
$(AVBTOOL) \
$(INSTALLED_BOOTIMAGE_TARGET) \
@@ -4557,8 +4600,10 @@
$(INSTALLED_RECOVERYIMAGE_TARGET) \
$(INSTALLED_VBMETA_SYSTEMIMAGE_TARGET) \
$(INSTALLED_VBMETA_VENDORIMAGE_TARGET) \
+ $(foreach partition,$(call to-upper,$(BOARD_AVB_VBMETA_CUSTOM_PARTITIONS)),$(INSTALLED_VBMETA_$(partition)IMAGE_TARGET)) \
$(BOARD_AVB_VBMETA_SYSTEM_KEY_PATH) \
$(BOARD_AVB_VBMETA_VENDOR_KEY_PATH) \
+ $(foreach partition,$(call to-upper,$(BOARD_AVB_VBMETA_CUSTOM_PARTITIONS)),$(BOARD_AVB_VBMETA_$(partition)_KEY_PATH)) \
$(BOARD_AVB_KEY_PATH)
$(build-vbmetaimage-target)
@@ -5063,7 +5108,7 @@
INTERNAL_OTATOOLS_MODULES += \
apexer \
apex_compression_tool \
- blkid \
+ blkid_static \
deapexer \
debugfs_static \
dump_apex_info \
@@ -5310,6 +5355,15 @@
$(hide) echo "avb_vbmeta_vendor_algorithm=$(BOARD_AVB_VBMETA_VENDOR_ALGORITHM)" >> $@
$(hide) echo "avb_vbmeta_vendor_rollback_index_location=$(BOARD_AVB_VBMETA_VENDOR_ROLLBACK_INDEX_LOCATION)" >> $@
endif # BOARD_AVB_VBMETA_VENDOR_KEY_PATH
+ifneq (,$(strip $(BOARD_AVB_VBMETA_CUSTOM_PARTITIONS)))
+ $(hide) echo "avb_custom_vbmeta_images_partition_list=$(BOARD_AVB_VBMETA_CUSTOM_PARTITIONS)" >> $@
+ $(hide) $(foreach partition,$(BOARD_AVB_VBMETA_CUSTOM_PARTITIONS),\
+ echo "avb_vbmeta_$(partition)=$(BOARD_AVB_VBMETA_$(call to-upper,$(partition)))" >> $@ ;\
+ echo "avb_vbmeta_$(partition)_args=$(BOARD_AVB_MAKE_VBMETA_$(call to-upper,$(partition))_IMAGE_ARGS)" >> $@ ;\
+ echo "avb_vbmeta_$(partition)_key_path=$(BOARD_AVB_VBMETA_$(call to-upper,$(partition))_KEY_PATH)" >> $@ ;\
+ echo "avb_vbmeta_$(partition)_algorithm=$(BOARD_AVB_VBMETA_$(call to-upper,$(partition))_ALGORITHM)" >> $@ ;\
+ echo "avb_vbmeta_$(partition)_rollback_index_location=$(BOARD_AVB_VBMETA_$(call to-upper,$(partition))_ROLLBACK_INDEX_LOCATION)" >> $@ ;)
+endif # BOARD_AVB_VBMETA_CUSTOM_PARTITIONS
endif # BOARD_AVB_ENABLE
ifdef BOARD_BPT_INPUT_FILES
$(hide) echo "board_bpt_enable=true" >> $@
diff --git a/core/base_rules.mk b/core/base_rules.mk
index 00f5f21..18730aa 100644
--- a/core/base_rules.mk
+++ b/core/base_rules.mk
@@ -600,7 +600,11 @@
# Manually handle the case where the
# output file is in the recovery or ramdisk partition.
ifneq (,$(filter $(TARGET_RECOVERY_ROOT_OUT)/%,$(my_module_path)))
- my_init_rc_path := $(TARGET_RECOVERY_ROOT_OUT)/system/etc
+ ifneq (,$(filter $(TARGET_RECOVERY_ROOT_OUT)/first_stage_ramdisk/%,$(my_module_path)))
+ my_init_rc_path := $(TARGET_RECOVERY_ROOT_OUT)/first_stage_ramdisk/system/etc
+ else
+ my_init_rc_path := $(TARGET_RECOVERY_ROOT_OUT)/system/etc
+ endif
else ifneq (,$(filter $(TARGET_RAMDISK_OUT)/%,$(my_module_path)))
my_init_rc_path := $(TARGET_RAMDISK_OUT)/system/etc
else
diff --git a/core/binary.mk b/core/binary.mk
index 6320726..6f1d814 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -58,6 +58,9 @@
my_cppflags := $(LOCAL_CPPFLAGS)
my_cflags_no_override := $(GLOBAL_CLANG_CFLAGS_NO_OVERRIDE)
my_cppflags_no_override := $(GLOBAL_CLANG_CPPFLAGS_NO_OVERRIDE)
+ifeq ($(my_32_64_bit_suffix), 64)
+ my_cflags_no_override += $(GLOBAL_CLANG_CFLAGS_64_NO_OVERRIDE)
+endif
ifdef is_third_party
my_cflags_no_override += $(GLOBAL_CLANG_EXTERNAL_CFLAGS_NO_OVERRIDE)
my_cppflags_no_override += $(GLOBAL_CLANG_EXTERNAL_CFLAGS_NO_OVERRIDE)
diff --git a/core/config.mk b/core/config.mk
index f5bb7ef..025a3a1 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -431,6 +431,9 @@
$(hide) $(HOST_NM) -gP $(1) | cut -f1-2 -d" " | (grep -v U$$ >> $(2) || true)
endef
+# Pick a Java compiler.
+include $(BUILD_SYSTEM)/combo/javac.mk
+
ifeq ($(CALLED_FROM_SETUP),true)
include $(BUILD_SYSTEM)/ccache.mk
include $(BUILD_SYSTEM)/goma.mk
@@ -453,9 +456,6 @@
WITH_TIDY_ONLY :=
endif
-# Pick a Java compiler.
-include $(BUILD_SYSTEM)/combo/javac.mk
-
# ---------------------------------------------------------------
# Check that the configuration is current. We check that
# BUILD_ENV_SEQUENCE_NUMBER is current against this value.
diff --git a/core/main.mk b/core/main.mk
index 0453cda..3866037 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -92,6 +92,9 @@
-include test/catbox/tools/build/config.mk
# CTS-Root-specific config.
-include test/cts-root/tools/build/config.mk
+# WVTS-specific config.
+-include test/wvts/tools/build/config.mk
+
# Clean rules
.PHONY: clean-dex-files
@@ -1602,6 +1605,9 @@
.PHONY: vbmetavendorimage
vbmetavendorimage: $(INSTALLED_VBMETA_VENDORIMAGE_TARGET)
+.PHONY: vbmetacustomimages
+vbmetacustomimages: $(foreach partition,$(call to-upper,$(BOARD_AVB_VBMETA_CUSTOM_PARTITIONS)),$(INSTALLED_VBMETA_$(partition)IMAGE_TARGET))
+
# The droidcore-unbundled target depends on the subset of targets necessary to
# perform a full system build (either unbundled or not).
.PHONY: droidcore-unbundled
diff --git a/core/product.mk b/core/product.mk
index 7621c71..3b22314 100644
--- a/core/product.mk
+++ b/core/product.mk
@@ -373,6 +373,9 @@
# If true, installs a full version of com.android.virt APEX.
_product_single_value_vars += PRODUCT_AVF_ENABLED
+# List of .json files to be merged/compiled into vendor/etc/linker.config.pb
+_product_list_vars += PRODUCT_VENDOR_LINKER_CONFIG_FRAGMENTS
+
# Whether to use userfaultfd GC.
# Possible values are:
# - "default" or empty: both the build system and the runtime determine whether to use userfaultfd
diff --git a/core/proguard_basic_keeps.flags b/core/proguard_basic_keeps.flags
index 7e7b270..ea200c1 100644
--- a/core/proguard_basic_keeps.flags
+++ b/core/proguard_basic_keeps.flags
@@ -83,13 +83,14 @@
# 1) runtime-visible annotations will still be kept, and 2) compile-time
# annotations are stripped by R8 anyway.
# Note: The ** prefix is used to accommodate jarjar repackaging.
-# TODO(b/242088131): Remove these exemptions after resolving transitive libs
-# dependencies that are provided to R8.
+# TODO(b/266561579): Remove this exemptions after resolving jarjar-ed transitive libs
-dontwarn **android**.annotation*.**
--dontwarn **com.google.errorprone.annotations.**
--dontwarn javax.annotation.**
--dontwarn org.checkerframework.**
--dontwarn org.jetbrains.annotations.**
+
+# These classes generate warnings of the kind `Library class extends program class`
+# because some apps have deps that statically include the same libraries as the app,
+# and r8 complains that a library is implementing a class provided by the app (the "program").
+-dontwarn com.google.protobuf.**
+-dontwarn kotlin.reflect.jvm.internal.ReflectionFactoryImpl
# Less spammy.
-dontnote
diff --git a/core/rbe.mk b/core/rbe.mk
index 65abde5..6754b0a 100644
--- a/core/rbe.mk
+++ b/core/rbe.mk
@@ -81,11 +81,11 @@
endif
ifdef RBE_R8
- R8_WRAPPER := $(strip $(RBE_WRAPPER) --labels=type=compile,compiler=r8 --exec_strategy=$(r8_exec_strategy) --platform=$(java_r8_d8_platform) --inputs=$(OUT_DIR)/soong/host/linux-x86/framework/r8-compat-proguard.jar,build/make/core/proguard_basic_keeps.flags --toolchain_inputs=$(JAVA))
+ R8_WRAPPER := $(strip $(RBE_WRAPPER) --labels=type=compile,compiler=r8 --exec_strategy=$(r8_exec_strategy) --platform=$(java_r8_d8_platform) --inputs=$(OUT_DIR)/host/linux-x86/framework/r8.jar,build/make/core/proguard_basic_keeps.flags --toolchain_inputs=$(firstword $(JAVA)))
endif
ifdef RBE_D8
- D8_WRAPPER := $(strip $(RBE_WRAPPER) --labels=type=compile,compiler=d8 --exec_strategy=$(d8_exec_strategy) --platform=$(java_r8_d8_platform) --inputs=$(OUT_DIR)/soong/host/linux-x86/framework/d8.jar --toolchain_inputs=$(JAVA))
+ D8_WRAPPER := $(strip $(RBE_WRAPPER) --labels=type=compile,compiler=d8 --exec_strategy=$(d8_exec_strategy) --platform=$(java_r8_d8_platform) --inputs=$(OUT_DIR)/host/linux-x86/framework/d8.jar --toolchain_inputs=$(firstword $(JAVA)))
endif
rbe_dir :=
diff --git a/core/tasks/wvts.mk b/core/tasks/wvts.mk
new file mode 100644
index 0000000..a79f613
--- /dev/null
+++ b/core/tasks/wvts.mk
@@ -0,0 +1,30 @@
+# Copyright (C) 2022 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.
+
+# Widevine test suite for non-GMS partners: go/android-wvts
+ifneq ($(wildcard test/wvts/tools/wvts-tradefed/README),)
+test_suite_name := wvts
+test_suite_tradefed := wvts-tradefed
+test_suite_dynamic_config := test/wvts/tools/wvts-tradefed/DynamicConfig.xml
+test_suite_readme := test/wvts/tools/wvts-tradefed/README
+
+$(call declare-1p-target,$(test_suite_dynamic_config),wvts)
+$(call declare-1p-target,$(test_suite_readme),wvts)
+
+include $(BUILD_SYSTEM)/tasks/tools/compatibility.mk
+
+.PHONY: wvts
+wvts: $(compatibility_zip) $(compatibility_tests_list_zip)
+$(call dist-for-goals, wvts, $(compatibility_zip) $(compatibility_tests_list_zip))
+endif
diff --git a/envsetup.sh b/envsetup.sh
index a30f6bd..ab86d5f 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -79,6 +79,7 @@
- ggrep: Greps on all local Gradle files.
- gogrep: Greps on all local Go files.
- jgrep: Greps on all local Java files.
+- jsongrep: Greps on all local Json files.
- ktgrep: Greps on all local Kotlin files.
- resgrep: Greps on all local res/*.xml files.
- mangrep: Greps on all local AndroidManifest.xml files.
@@ -87,6 +88,7 @@
- rsgrep: Greps on all local Rust files.
- sepgrep: Greps on all local sepolicy files.
- sgrep: Greps on all local source files.
+- tomlgrep: Greps on all local Toml files.
- pygrep: Greps on all local Python files.
- godir: Go to the directory containing a file.
- allmod: List all modules.
@@ -1236,6 +1238,18 @@
-exec grep --color -n "$@" {} +
}
+function jsongrep()
+{
+ find . -name .repo -prune -o -name .git -prune -o -name out -prune -o -type f -name "*\.json" \
+ -exec grep --color -n "$@" {} +
+}
+
+function tomlgrep()
+{
+ find . -name .repo -prune -o -name .git -prune -o -name out -prune -o -type f -name "*\.toml" \
+ -exec grep --color -n "$@" {} +
+}
+
function ktgrep()
{
find . -name .repo -prune -o -name .git -prune -o -name out -prune -o -type f -name "*\.kt" \
diff --git a/finalize-locally-mainline-sdk.sh b/finalize-locally-mainline-sdk.sh
new file mode 100755
index 0000000..c72ef8c
--- /dev/null
+++ b/finalize-locally-mainline-sdk.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+set -ex
+
+function finalize_locally_mainline_sdk() {
+ local MAINLINE_EXTENSION='6'
+
+ local top="$(dirname "$0")"/../..
+
+ # Bump SDK extension version.
+ "$top/packages/modules/SdkExtensions/gen_sdk/bump_sdk.sh" ${MAINLINE_EXTENSION}
+
+ local version_defaults="$top/build/make/core/version_defaults.mk"
+ sed -i -e "s/PLATFORM_SDK_EXTENSION_VERSION := .*/PLATFORM_SDK_EXTENSION_VERSION := ${MAINLINE_EXTENSION}/g" $version_defaults
+
+ # Build modules SDKs.
+ TARGET_BUILD_VARIANT=userdebug UNBUNDLED_BUILD_SDKS_FROM_SOURCE=true "$top/vendor/google/build/mainline_modules_sdks.sh"
+
+ # Update prebuilts.
+ "$top/prebuilts/build-tools/path/linux-x86/python3" "$top/packages/modules/common/tools/finalize_sdk.py" -l -b 0 -f ${MAINLINE_EXTENSION} -r '' 0
+}
+
+finalize_locally_mainline_sdk
+
diff --git a/finalize-sdk-rel.sh b/finalize-sdk-rel.sh
index 35899f7..b19e56a 100755
--- a/finalize-sdk-rel.sh
+++ b/finalize-sdk-rel.sh
@@ -14,7 +14,7 @@
# adb keys
$m adb
- LOGNAME=android-eng HOSTNAME=google.com adb keygen "$DEV_SRC_DIR/vendor/google/security/adb/${PLATFORM_VERSION}.adb_key"
+ LOGNAME=android-eng HOSTNAME=google.com "$DEV_SRC_DIR/out/host/linux-x86/bin/adb" keygen "$DEV_SRC_DIR/vendor/google/security/adb/${PLATFORM_VERSION}.adb_key"
# build/make/core/version_defaults.mk
sed -i -e "s/PLATFORM_VERSION_CODENAME.${BUILD_PREFIX} := .*/PLATFORM_VERSION_CODENAME.${BUILD_PREFIX} := REL/g" "$DEV_SRC_DIR/build/make/core/version_defaults.mk"
@@ -29,13 +29,13 @@
cp -r "$DEV_SRC_DIR/system/sepolicy/private/" "$DEV_SRC_DIR/system/sepolicy/prebuilts/api/${PLATFORM_SDK_VERSION}.0/"
# prebuilts/abi-dumps/ndk
- git -C "$DEV_SRC_DIR/prebuilts/abi-dumps/ndk" mv current ${PLATFORM_SDK_VERSION}
+ mv "$DEV_SRC_DIR/prebuilts/abi-dumps/ndk/current" "$DEV_SRC_DIR/prebuilts/abi-dumps/ndk/$PLATFORM_SDK_VERSION"
# prebuilts/abi-dumps/vndk
- git -C "$DEV_SRC_DIR/prebuilts/abi-dumps/vndk" mv ${PLATFORM_CODENAME} ${PLATFORM_SDK_VERSION}
+ mv "$DEV_SRC_DIR/prebuilts/abi-dumps/vndk/$PLATFORM_CODENAME" "$DEV_SRC_DIR/prebuilts/abi-dumps/vndk/$PLATFORM_SDK_VERSION"
# prebuilts/abi-dumps/platform
- git -C "$DEV_SRC_DIR/prebuilts/abi-dumps/platform" mv current ${PLATFORM_SDK_VERSION}
+ mv "$DEV_SRC_DIR/prebuilts/abi-dumps/platform/current" "$DEV_SRC_DIR/prebuilts/abi-dumps/platform/$PLATFORM_SDK_VERSION"
}
finalize_sdk_rel
diff --git a/finalize-step-1-for-build-target.sh b/finalize-step-1-for-build-target.sh
index 52cf0a7..8b35a1d 100755
--- a/finalize-step-1-for-build-target.sh
+++ b/finalize-step-1-for-build-target.sh
@@ -4,49 +4,10 @@
set -ex
-function revert_to_unfinalized_state() {
- declare -a projects=(
- "build/make/"
- "build/soong/"
- "cts/"
- "frameworks/base/"
- "frameworks/hardware/interfaces/"
- "frameworks/libs/modules-utils/"
- "frameworks/libs/net/"
- "hardware/interfaces/"
- "libcore/"
- "packages/services/Car/"
- "platform_testing/"
- "prebuilts/abi-dumps/ndk/"
- "prebuilts/abi-dumps/platform/"
- "prebuilts/abi-dumps/vndk/"
- "system/hardware/interfaces/"
- "system/tools/aidl/"
- "tools/platform-compat"
- "device/generic/car"
- "development"
- )
-
- for project in "${projects[@]}"
- do
- local git_path="$top/$project"
- echo "Reverting: $git_path"
- baselineHash="$(git -C $git_path log --format=%H --no-merges --max-count=1 --grep ^FINALIZATION_STEP_1_BASELINE_COMMIT)" ;
- if [[ $baselineHash ]]; then
- previousHash="$(git -C $git_path log --format=%H --no-merges --max-count=100 --grep ^FINALIZATION_STEP_1_SCRIPT_COMMIT $baselineHash..HEAD | tr \n \040)" ;
- else
- previousHash="$(git -C $git_path log --format=%H --no-merges --max-count=100 --grep ^FINALIZATION_STEP_1_SCRIPT_COMMIT | tr \n \040)" ;
- fi ;
- if [[ $previousHash ]]; then git -C $git_path revert --no-commit --strategy=ort --strategy-option=ours $previousHash ; fi ;
- done
-}
-
function finalize_step_1_main() {
local top="$(dirname "$0")"/../..
local m="$top/build/soong/soong_ui.bash --make-mode TARGET_PRODUCT=aosp_arm64 TARGET_BUILD_VARIANT=userdebug"
- revert_to_unfinalized_state
-
# vndk etc finalization
source $top/build/make/finalize-aidl-vndk-sdk-resources.sh
diff --git a/finalize-step-1.sh b/finalize-step-1.sh
index 20bc2bf..8871862 100755
--- a/finalize-step-1.sh
+++ b/finalize-step-1.sh
@@ -32,6 +32,9 @@
}
function finalize_step_1_main() {
+ # deprecated, do not use
+ exit 1
+
local top="$(dirname "$0")"/../..
repo selfupdate
diff --git a/finalize-step-2-for-build-target.sh b/finalize-step-2-for-build-target.sh
index caf415f..b74fd03 100755
--- a/finalize-step-2-for-build-target.sh
+++ b/finalize-step-2-for-build-target.sh
@@ -4,55 +4,19 @@
set -ex
-function revert_to_unfinalized_state() {
- declare -a projects=(
- "build/make/"
- "build/soong/"
- "cts/"
- "frameworks/base/"
- "frameworks/hardware/interfaces/"
- "frameworks/libs/modules-utils/"
- "frameworks/libs/net/"
- "hardware/interfaces/"
- "libcore/"
- "packages/services/Car/"
- "platform_testing/"
- "prebuilts/abi-dumps/ndk/"
- "prebuilts/abi-dumps/platform/"
- "prebuilts/abi-dumps/vndk/"
- "system/hardware/interfaces/"
- "system/tools/aidl/"
- "tools/platform-compat"
- "device/generic/car"
- "development"
- )
-
- for project in "${projects[@]}"
- do
- local git_path="$top/$project"
- echo "Reverting: $git_path"
- baselineHash="$(git -C $git_path log --format=%H --no-merges --max-count=1 --grep ^FINALIZATION_STEP_1_BASELINE_COMMIT)" ;
- if [[ $baselineHash ]]; then
- previousHash="$(git -C $git_path log --format=%H --no-merges --max-count=100 --grep ^FINALIZATION_STEP_1_SCRIPT_COMMIT $baselineHash..HEAD | tr \n \040)" ;
- else
- previousHash="$(git -C $git_path log --format=%H --no-merges --max-count=100 --grep ^FINALIZATION_STEP_1_SCRIPT_COMMIT | tr \n \040)" ;
- fi ;
- if [[ $previousHash ]]; then git -C $git_path revert --no-commit --strategy=ort --strategy-option=ours $previousHash ; fi ;
- done
-}
-
function finalize_step_2_main() {
local top="$(dirname "$0")"/../..
local m="$top/build/soong/soong_ui.bash --make-mode TARGET_PRODUCT=aosp_arm64 TARGET_BUILD_VARIANT=userdebug"
- revert_to_unfinalized_state
-
# vndk etc finalization
source $top/build/make/finalize-aidl-vndk-sdk-resources.sh
# prebuilts etc
source $top/build/make/finalize-sdk-rel.sh
+ # mainline sdk prebuilts
+ source $top/build/make/finalize-locally-mainline-sdk.sh
+
# build to confirm everything is OK
AIDL_FROZEN_REL=true $m
}
diff --git a/finalize-step-2.sh b/finalize-step-2.sh
index 627153b..ef80b2b 100755
--- a/finalize-step-2.sh
+++ b/finalize-step-2.sh
@@ -32,6 +32,9 @@
}
function finalize_step_2_main() {
+ # deprecated, do not use
+ exit 1
+
local top="$(dirname "$0")"/../..
repo selfupdate
diff --git a/target/board/BoardConfigEmuCommon.mk b/target/board/BoardConfigEmuCommon.mk
index 5acbe7f..7a07d70 100644
--- a/target/board/BoardConfigEmuCommon.mk
+++ b/target/board/BoardConfigEmuCommon.mk
@@ -34,7 +34,7 @@
BOARD_BUILD_SUPER_IMAGE_BY_DEFAULT := true
# 8G + 8M
- BOARD_SUPER_PARTITION_SIZE := 8598323200
+ BOARD_SUPER_PARTITION_SIZE ?= 8598323200
BOARD_SUPER_PARTITION_GROUPS := emulator_dynamic_partitions
ifeq ($(QEMU_USE_SYSTEM_EXT_PARTITIONS),true)
@@ -57,7 +57,7 @@
endif
# 8G
- BOARD_EMULATOR_DYNAMIC_PARTITIONS_SIZE := 8589934592
+ BOARD_EMULATOR_DYNAMIC_PARTITIONS_SIZE ?= 8589934592
# in build environment to speed up make -j
ifeq ($(QEMU_DISABLE_AVB),true)
diff --git a/target/product/AndroidProducts.mk b/target/product/AndroidProducts.mk
index 585630b..1e0ce19 100644
--- a/target/product/AndroidProducts.mk
+++ b/target/product/AndroidProducts.mk
@@ -36,6 +36,7 @@
PRODUCT_MAKEFILES := \
$(LOCAL_DIR)/aosp_arm64.mk \
$(LOCAL_DIR)/aosp_arm.mk \
+ $(LOCAL_DIR)/aosp_riscv64.mk \
$(LOCAL_DIR)/aosp_x86_64.mk \
$(LOCAL_DIR)/aosp_x86.mk \
$(LOCAL_DIR)/full.mk \
diff --git a/target/product/base_system.mk b/target/product/base_system.mk
index cabb172..b66d2c7 100644
--- a/target/product/base_system.mk
+++ b/target/product/base_system.mk
@@ -54,7 +54,6 @@
com.android.appsearch \
com.android.btservices \
com.android.conscrypt \
- com.android.cronet \
com.android.extservices \
com.android.i18n \
com.android.ipsec \
@@ -389,6 +388,7 @@
procrank \
profcollectd \
profcollectctl \
+ record_binder \
servicedispatcher \
showmap \
sqlite3 \
diff --git a/target/product/base_vendor.mk b/target/product/base_vendor.mk
index 7fb785c..3c4d62e 100644
--- a/target/product/base_vendor.mk
+++ b/target/product/base_vendor.mk
@@ -46,7 +46,7 @@
# Base modules and settings for the vendor partition.
PRODUCT_PACKAGES += \
- android.hardware.cas@1.2-service \
+ android.hardware.cas-service.example \
boringssl_self_test_vendor \
dumpsys_vendor \
fs_config_files_nonsystem \
@@ -81,7 +81,11 @@
endif
-# Base module when shipping api level is less than or equal to 29
+# Base modules when shipping api level is less than or equal to 33
+PRODUCT_PACKAGES_SHIPPING_API_LEVEL_33 += \
+ android.hardware.cas@1.2-service \
+
+# Base modules when shipping api level is less than or equal to 29
PRODUCT_PACKAGES_SHIPPING_API_LEVEL_29 += \
android.hardware.configstore@1.1-service \
vndservice \
diff --git a/target/product/generic_ramdisk.mk b/target/product/generic_ramdisk.mk
index c7dcd60..ebac62f 100644
--- a/target/product/generic_ramdisk.mk
+++ b/target/product/generic_ramdisk.mk
@@ -29,11 +29,16 @@
adb_debug.prop \
userdebug_plat_sepolicy.cil \
+
+# For targets using dedicated recovery partition, generic ramdisk
+# might be relocated to recovery partition
_my_paths := \
$(TARGET_COPY_OUT_RAMDISK)/ \
$(TARGET_COPY_OUT_DEBUG_RAMDISK)/ \
system/usr/share/zoneinfo/tz_version \
system/usr/share/zoneinfo/tzdata \
+ $(TARGET_COPY_OUT_RECOVERY)/root/first_stage_ramdisk/system \
+
# We use the "relaxed" version here because tzdata / tz_version is only produced
# by this makefile on a subset of devices.
diff --git a/target/product/gsi/33.txt b/target/product/gsi/33.txt
index 03a143d..db05f93 100644
--- a/target/product/gsi/33.txt
+++ b/target/product/gsi/33.txt
@@ -79,7 +79,6 @@
VNDK-core: android.hardware.graphics.allocator@4.0.so
VNDK-core: android.hardware.graphics.bufferqueue@1.0.so
VNDK-core: android.hardware.graphics.bufferqueue@2.0.so
-VNDK-core: android.hardware.health-V1-ndk.so
VNDK-core: android.hardware.health.storage-V1-ndk.so
VNDK-core: android.hardware.identity-V4-ndk.so
VNDK-core: android.hardware.ir-V1-ndk.so
diff --git a/target/product/gsi/Android.mk b/target/product/gsi/Android.mk
index d02dc7a..107c94f 100644
--- a/target/product/gsi/Android.mk
+++ b/target/product/gsi/Android.mk
@@ -126,8 +126,13 @@
endef
VNDK_ABI_DUMP_DIR := prebuilts/abi-dumps/vndk/$(PLATFORM_VNDK_VERSION)
-NDK_ABI_DUMP_DIR := prebuilts/abi-dumps/ndk/$(PLATFORM_VNDK_VERSION)
-PLATFORM_ABI_DUMP_DIR := prebuilts/abi-dumps/platform/$(PLATFORM_VNDK_VERSION)
+ifeq (REL,$(PLATFORM_VERSION_CODENAME))
+ NDK_ABI_DUMP_DIR := prebuilts/abi-dumps/ndk/$(PLATFORM_SDK_VERSION)
+ PLATFORM_ABI_DUMP_DIR := prebuilts/abi-dumps/platform/$(PLATFORM_SDK_VERSION)
+else
+ NDK_ABI_DUMP_DIR := prebuilts/abi-dumps/ndk/current
+ PLATFORM_ABI_DUMP_DIR := prebuilts/abi-dumps/platform/current
+endif
VNDK_ABI_DUMPS := $(call find-abi-dump-paths,$(VNDK_ABI_DUMP_DIR))
NDK_ABI_DUMPS := $(call find-abi-dump-paths,$(NDK_ABI_DUMP_DIR))
PLATFORM_ABI_DUMPS := $(call find-abi-dump-paths,$(PLATFORM_ABI_DUMP_DIR))
@@ -141,7 +146,7 @@
$(check-vndk-abi-dump-list-timestamp): PRIVATE_STUB_LIBRARIES := $(STUB_LIBRARIES)
$(check-vndk-abi-dump-list-timestamp):
$(eval added_vndk_abi_dumps := $(strip $(sort $(filter-out \
- $(call filter-abi-dump-paths,LLNDK VNDK-SP VNDK-core,$(PRIVATE_LSDUMP_PATHS)), \
+ $(call filter-abi-dump-paths,VNDK-SP VNDK-core,$(PRIVATE_LSDUMP_PATHS)), \
$(notdir $(VNDK_ABI_DUMPS))))))
$(if $(added_vndk_abi_dumps), \
echo -e "Found unexpected ABI reference dump files under $(VNDK_ABI_DUMP_DIR). It is caused by mismatch between Android.bp and the dump files. Run \`find \$${ANDROID_BUILD_TOP}/$(VNDK_ABI_DUMP_DIR) '(' -name $(subst $(space), -or -name ,$(added_vndk_abi_dumps)) ')' -delete\` to delete the dump files.")
@@ -154,7 +159,7 @@
echo -e "Found unexpected ABI reference dump files under $(NDK_ABI_DUMP_DIR). It is caused by mismatch between Android.bp and the dump files. Run \`find \$${ANDROID_BUILD_TOP}/$(NDK_ABI_DUMP_DIR) '(' -name $(subst $(space), -or -name ,$(added_ndk_abi_dumps)) ')' -delete\` to delete the dump files.")
$(eval added_platform_abi_dumps := $(strip $(sort $(filter-out \
- $(call filter-abi-dump-paths,PLATFORM,$(PRIVATE_LSDUMP_PATHS)) \
+ $(call filter-abi-dump-paths,LLNDK PLATFORM,$(PRIVATE_LSDUMP_PATHS)) \
$(addsuffix .lsdump,$(PRIVATE_STUB_LIBRARIES)), \
$(notdir $(PLATFORM_ABI_DUMPS))))))
$(if $(added_platform_abi_dumps), \
diff --git a/target/product/virtual_ab_ota/android_t_baseline.mk b/target/product/virtual_ab_ota/android_t_baseline.mk
index 716c8e0..418aaa4 100644
--- a/target/product/virtual_ab_ota/android_t_baseline.mk
+++ b/target/product/virtual_ab_ota/android_t_baseline.mk
@@ -12,29 +12,11 @@
# 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.
+#
-# This file enables baseline features, such as io_uring,
-# userspace merge, etc. But sets compression method to none.
-# This .mk file also removes snapuserd from vendor ramdisk,
-# as T launching devices will have init_boot which has snapuserd
-# in generic ramdisk.
-# T launching devices should include this .mk file, and configure
-# compression algorithm by setting
-# PRODUCT_VIRTUAL_AB_COMPRESSION_METHOD to gz or brotli. Complete
-# set of supported algorithms can be found in
-# system/core/fs_mgr/libsnapshot/cow_writer.cpp
-
-PRODUCT_VIRTUAL_AB_OTA := true
-
-PRODUCT_VENDOR_PROPERTIES += ro.virtual_ab.enabled=true
-
-PRODUCT_VENDOR_PROPERTIES += ro.virtual_ab.compression.enabled=true
-PRODUCT_VENDOR_PROPERTIES += ro.virtual_ab.userspace.snapshots.enabled=true
-PRODUCT_VENDOR_PROPERTIES += ro.virtual_ab.io_uring.enabled=true
-PRODUCT_VENDOR_PROPERTIES += ro.virtual_ab.compression.xor.enabled=true
-
-PRODUCT_VIRTUAL_AB_COMPRESSION := true
-PRODUCT_VIRTUAL_AB_COMPRESSION_METHOD ?= none
-PRODUCT_PACKAGES += \
- snapuserd \
-
+# This file should be used only for T launching devices. We maintain
+# this file just for backward compatibility for T launch devices
+# so that build doesn't break.
+#
+# All U+ launching devices should instead use vabc_features.mk.
+$(call inherit-product, $(SRC_TARGET_DIR)/product/virtual_ab_ota/vabc_features.mk)
diff --git a/target/product/virtual_ab_ota/compression.mk b/target/product/virtual_ab_ota/compression.mk
index d5bd2a5..dc1ee3e 100644
--- a/target/product/virtual_ab_ota/compression.mk
+++ b/target/product/virtual_ab_ota/compression.mk
@@ -19,6 +19,12 @@
PRODUCT_VENDOR_PROPERTIES += ro.virtual_ab.compression.enabled=true
PRODUCT_VENDOR_PROPERTIES += ro.virtual_ab.userspace.snapshots.enabled=true
PRODUCT_VENDOR_PROPERTIES += ro.virtual_ab.io_uring.enabled=true
+PRODUCT_VENDOR_PROPERTIES += ro.virtual_ab.batch_writes=true
+
+# Enabling this property, will improve OTA install time
+# but will use an additional CPU core
+# PRODUCT_VENDOR_PROPERTIES += ro.virtual_ab.compression.threads=true
+
PRODUCT_VIRTUAL_AB_COMPRESSION := true
PRODUCT_PACKAGES += \
snapuserd.vendor_ramdisk \
diff --git a/target/product/virtual_ab_ota/vabc_features.mk b/target/product/virtual_ab_ota/vabc_features.mk
new file mode 100644
index 0000000..874eb9c
--- /dev/null
+++ b/target/product/virtual_ab_ota/vabc_features.mk
@@ -0,0 +1,46 @@
+#
+# Copyright (C) 2022 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.
+
+# This file enables baseline features, such as io_uring,
+# userspace merge, etc. But sets compression method to none.
+# This .mk file also removes snapuserd from vendor ramdisk,
+# as T launching devices will have init_boot which has snapuserd
+# in generic ramdisk.
+#
+# T and U launching devices should include this .mk file, and configure
+# compression algorithm by setting
+# PRODUCT_VIRTUAL_AB_COMPRESSION_METHOD to lz4, gz or brotli. Complete
+# set of supported algorithms can be found in
+# system/core/fs_mgr/libsnapshot/cow_writer.cpp
+
+PRODUCT_VIRTUAL_AB_OTA := true
+
+PRODUCT_VENDOR_PROPERTIES += ro.virtual_ab.enabled=true
+
+PRODUCT_VENDOR_PROPERTIES += ro.virtual_ab.compression.enabled=true
+PRODUCT_VENDOR_PROPERTIES += ro.virtual_ab.userspace.snapshots.enabled=true
+PRODUCT_VENDOR_PROPERTIES += ro.virtual_ab.io_uring.enabled=true
+PRODUCT_VENDOR_PROPERTIES += ro.virtual_ab.compression.xor.enabled=true
+PRODUCT_VENDOR_PROPERTIES += ro.virtual_ab.batch_writes=true
+
+# Enabling this property, will improve OTA install time
+# but will use an additional CPU core
+# PRODUCT_VENDOR_PROPERTIES += ro.virtual_ab.compression.threads=true
+
+PRODUCT_VIRTUAL_AB_COMPRESSION := true
+PRODUCT_VIRTUAL_AB_COMPRESSION_METHOD ?= none
+PRODUCT_PACKAGES += \
+ snapuserd \
+
diff --git a/tests/b_tests.sh b/tests/b_tests.sh
index 45cb4f7..13f156d 100755
--- a/tests/b_tests.sh
+++ b/tests/b_tests.sh
@@ -27,6 +27,10 @@
b build "$test_target" --run-soong-tests
b build --run-soong-tests "$test_target"
b --run-soong-tests build "$test_target"
+# Test that the bazel server can be restarted once shut down. If run in a
+# docker container, you need to run the docker container with --init or
+# have some other process as PID 1 that can reap zombies.
+b shutdown
b cquery 'kind(test, //build/bazel/examples/android_app/...)' --config=android
b run $test_target -- --help >/dev/null
diff --git a/tools/compliance/cmd/sbom/sbom.go b/tools/compliance/cmd/sbom/sbom.go
index 493d331..0f8a876 100644
--- a/tools/compliance/cmd/sbom/sbom.go
+++ b/tools/compliance/cmd/sbom/sbom.go
@@ -271,6 +271,17 @@
return pms[index], nil
}
+// inputFiles returns the complete list of files read
+func inputFiles(lg *compliance.LicenseGraph, pmix *projectmetadata.Index, licenseTexts []string) []string {
+ projectMeta := pmix.AllMetadataFiles()
+ targets := lg.TargetNames()
+ files := make([]string, 0, len(licenseTexts)+len(targets)+len(projectMeta))
+ files = append(files, licenseTexts...)
+ files = append(files, targets...)
+ files = append(files, projectMeta...)
+ return files
+}
+
// sbomGenerator implements the spdx bom utility
// SBOM is part of the new government regulation issued to improve national cyber security
@@ -332,9 +343,9 @@
if isMainPackage {
mainPackage = getDocumentName(ctx, tn, pm)
fmt.Fprintf(ctx.stdout, "SPDXVersion: SPDX-2.2\n")
- fmt.Fprintf(ctx.stdout, "DataLicense: CC-1.0\n")
+ fmt.Fprintf(ctx.stdout, "DataLicense: CC0-1.0\n")
fmt.Fprintf(ctx.stdout, "DocumentName: %s\n", mainPackage)
- fmt.Fprintf(ctx.stdout, "SPDXID: SPDXRef-DOCUMENT-%s\n", mainPackage)
+ fmt.Fprintf(ctx.stdout, "SPDXID: SPDXRef-DOCUMENT\n")
fmt.Fprintf(ctx.stdout, "DocumentNamespace: Android\n")
fmt.Fprintf(ctx.stdout, "Creator: Organization: Google LLC\n")
fmt.Fprintf(ctx.stdout, "Created: %s\n", ctx.creationTime().Format("2006-01-02T15:04:05Z"))
@@ -352,8 +363,8 @@
}()
if len(path) == 0 {
relationships = append(relationships,
- fmt.Sprintf("Relationship: SPDXRef-DOCUMENT-%s DESCRIBES SPDXRef-Package-%s",
- mainPackage, getPackageName(ctx, tn)))
+ fmt.Sprintf("Relationship: SPDXRef-DOCUMENT DESCRIBES SPDXRef-Package-%s",
+ getPackageName(ctx, tn)))
} else {
// Check parent and identify annotation
parent := path[len(path)-1]
@@ -417,6 +428,7 @@
fmt.Fprintf(ctx.stdout, "ExtractedText: <text>%v</text>\n", string(text))
}
- deps := licenseTexts
+ deps := inputFiles(lg, pmix, licenseTexts)
+ sort.Strings(deps)
return deps, nil
}
diff --git a/tools/compliance/cmd/sbom/sbom_test.go b/tools/compliance/cmd/sbom/sbom_test.go
index 6b40a27..6df74e2 100644
--- a/tools/compliance/cmd/sbom/sbom_test.go
+++ b/tools/compliance/cmd/sbom/sbom_test.go
@@ -30,9 +30,9 @@
var (
spdxVersionTag = regexp.MustCompile(`^\s*SPDXVersion: SPDX-2.2\s*$`)
- spdxDataLicenseTag = regexp.MustCompile(`^\s*DataLicense: CC-1.0\s*$`)
+ spdxDataLicenseTag = regexp.MustCompile(`^\s*DataLicense: CC0-1.0\s*$`)
spdxDocumentNameTag = regexp.MustCompile(`^\s*DocumentName:\s*Android*\s*$`)
- spdxIDTag = regexp.MustCompile(`^\s*SPDXID:\s*SPDXRef-DOCUMENT-(.*)\s*$`)
+ spdxIDTag = regexp.MustCompile(`^\s*SPDXID:\s*SPDXRef-DOCUMENT\s*$`)
spdxDocumentNameSpaceTag = regexp.MustCompile(`^\s*DocumentNamespace:\s*Android\s*$`)
spdxCreatorOrganizationTag = regexp.MustCompile(`^\s*Creator:\s*Organization:\s*Google LLC\s*$`)
spdxCreatedTimeTag = regexp.MustCompile(`^\s*Created: 1970-01-01T00:00:00Z\s*$`)
@@ -76,7 +76,7 @@
spdxVersion{},
spdxDataLicense{},
spdxDocumentName{"Android"},
- spdxID{"Android"},
+ spdxID{},
spdxDocumentNameSpace{},
spdxCreatorOrganization{},
spdxCreatedTime{},
@@ -85,7 +85,7 @@
spdxPkgID{"testdata/firstparty/highest.apex.meta_lic"},
spdxPkgDownloadLocation{"NOASSERTION"},
spdxPkgLicenseDeclared{"testdata-firstparty-FIRST_PARTY_LICENSE"},
- spdxRelationship{"DOCUMENT-Android ", "testdata-firstparty-highest.apex.meta_lic", "DESCRIBES"},
+ spdxRelationship{"DOCUMENT ", "testdata-firstparty-highest.apex.meta_lic", "DESCRIBES"},
packageTag{"testdata/firstparty/bin/bin1.meta_lic"},
packageName{"testdata/firstparty/bin/bin1.meta_lic"},
spdxPkgID{"testdata/firstparty/bin/bin1.meta_lic"},
@@ -129,7 +129,16 @@
spdxExtractedText{"&&&First Party License&&&"},
spdxExtractedClosingText{},
},
- expectedDeps: []string{"testdata/firstparty/FIRST_PARTY_LICENSE"},
+ expectedDeps: []string{
+ "testdata/firstparty/FIRST_PARTY_LICENSE",
+ "testdata/firstparty/bin/bin1.meta_lic",
+ "testdata/firstparty/bin/bin2.meta_lic",
+ "testdata/firstparty/highest.apex.meta_lic",
+ "testdata/firstparty/lib/liba.so.meta_lic",
+ "testdata/firstparty/lib/libb.so.meta_lic",
+ "testdata/firstparty/lib/libc.a.meta_lic",
+ "testdata/firstparty/lib/libd.so.meta_lic",
+ },
},
{
condition: "firstparty",
@@ -139,7 +148,7 @@
spdxVersion{},
spdxDataLicense{},
spdxDocumentName{"Android"},
- spdxID{"Android"},
+ spdxID{},
spdxDocumentNameSpace{},
spdxCreatorOrganization{},
spdxCreatedTime{},
@@ -148,7 +157,7 @@
spdxPkgID{"testdata/firstparty/application.meta_lic"},
spdxPkgDownloadLocation{"NOASSERTION"},
spdxPkgLicenseDeclared{"testdata-firstparty-FIRST_PARTY_LICENSE"},
- spdxRelationship{"DOCUMENT-Android ", "testdata/firstparty/application.meta_lic", "DESCRIBES"},
+ spdxRelationship{"DOCUMENT ", "testdata/firstparty/application.meta_lic", "DESCRIBES"},
packageTag{"testdata/firstparty/bin/bin3.meta_lic"},
packageName{"testdata/firstparty/bin/bin3.meta_lic"},
spdxPkgID{"testdata/firstparty/bin/bin3.meta_lic"},
@@ -172,7 +181,13 @@
spdxExtractedText{"&&&First Party License&&&"},
spdxExtractedClosingText{},
},
- expectedDeps: []string{"testdata/firstparty/FIRST_PARTY_LICENSE"},
+ expectedDeps: []string{
+ "testdata/firstparty/FIRST_PARTY_LICENSE",
+ "testdata/firstparty/application.meta_lic",
+ "testdata/firstparty/bin/bin3.meta_lic",
+ "testdata/firstparty/lib/liba.so.meta_lic",
+ "testdata/firstparty/lib/libb.so.meta_lic",
+ },
},
{
condition: "firstparty",
@@ -182,7 +197,7 @@
spdxVersion{},
spdxDataLicense{},
spdxDocumentName{"Android"},
- spdxID{"Android"},
+ spdxID{},
spdxDocumentNameSpace{},
spdxCreatorOrganization{},
spdxCreatedTime{},
@@ -191,7 +206,7 @@
spdxPkgID{"testdata/firstparty/container.zip.meta_lic"},
spdxPkgDownloadLocation{"NOASSERTION"},
spdxPkgLicenseDeclared{"testdata-firstparty-FIRST_PARTY_LICENSE"},
- spdxRelationship{"DOCUMENT-Android ", "testdata/firstparty/container.zip.meta_lic", "DESCRIBES"},
+ spdxRelationship{"DOCUMENT ", "testdata/firstparty/container.zip.meta_lic", "DESCRIBES"},
packageTag{"testdata/firstparty/bin/bin1.meta_lic"},
packageName{"testdata/firstparty/bin/bin1.meta_lic"},
spdxPkgID{"testdata/firstparty/bin/bin1.meta_lic"},
@@ -235,7 +250,16 @@
spdxExtractedText{"&&&First Party License&&&"},
spdxExtractedClosingText{},
},
- expectedDeps: []string{"testdata/firstparty/FIRST_PARTY_LICENSE"},
+ expectedDeps: []string{
+ "testdata/firstparty/FIRST_PARTY_LICENSE",
+ "testdata/firstparty/bin/bin1.meta_lic",
+ "testdata/firstparty/bin/bin2.meta_lic",
+ "testdata/firstparty/container.zip.meta_lic",
+ "testdata/firstparty/lib/liba.so.meta_lic",
+ "testdata/firstparty/lib/libb.so.meta_lic",
+ "testdata/firstparty/lib/libc.a.meta_lic",
+ "testdata/firstparty/lib/libd.so.meta_lic",
+ },
},
{
condition: "firstparty",
@@ -245,7 +269,7 @@
spdxVersion{},
spdxDataLicense{},
spdxDocumentName{"Android"},
- spdxID{"Android"},
+ spdxID{},
spdxDocumentNameSpace{},
spdxCreatorOrganization{},
spdxCreatedTime{},
@@ -254,7 +278,7 @@
spdxPkgID{"testdata/firstparty/bin/bin1.meta_lic"},
spdxPkgDownloadLocation{"NOASSERTION"},
spdxPkgLicenseDeclared{"testdata-firstparty-FIRST_PARTY_LICENSE"},
- spdxRelationship{"DOCUMENT-Android ", "testdata/firstparty/bin/bin1.meta_lic", "DESCRIBES"},
+ spdxRelationship{"DOCUMENT ", "testdata/firstparty/bin/bin1.meta_lic", "DESCRIBES"},
packageTag{"testdata/firstparty/lib/liba.so.meta_lic"},
packageName{"testdata/firstparty/lib/liba.so.meta_lic"},
spdxPkgID{"testdata/firstparty/lib/liba.so.meta_lic"},
@@ -272,7 +296,12 @@
spdxExtractedText{"&&&First Party License&&&"},
spdxExtractedClosingText{},
},
- expectedDeps: []string{"testdata/firstparty/FIRST_PARTY_LICENSE"},
+ expectedDeps: []string{
+ "testdata/firstparty/FIRST_PARTY_LICENSE",
+ "testdata/firstparty/bin/bin1.meta_lic",
+ "testdata/firstparty/lib/liba.so.meta_lic",
+ "testdata/firstparty/lib/libc.a.meta_lic",
+ },
},
{
condition: "firstparty",
@@ -282,7 +311,7 @@
spdxVersion{},
spdxDataLicense{},
spdxDocumentName{"Android"},
- spdxID{"Android"},
+ spdxID{},
spdxDocumentNameSpace{},
spdxCreatorOrganization{},
spdxCreatedTime{},
@@ -291,13 +320,16 @@
spdxPkgID{"testdata/firstparty/lib/libd.so.meta_lic"},
spdxPkgDownloadLocation{"NOASSERTION"},
spdxPkgLicenseDeclared{"testdata-firstparty-FIRST_PARTY_LICENSE"},
- spdxRelationship{"DOCUMENT-Android ", "testdata/firstparty/lib/libd.so.meta_lic", "DESCRIBES"},
+ spdxRelationship{"DOCUMENT ", "testdata/firstparty/lib/libd.so.meta_lic", "DESCRIBES"},
spdxLicense{},
spdxLicenseID{"testdata-firstparty-FIRST_PARTY_LICENSE"},
spdxExtractedText{"&&&First Party License&&&"},
spdxExtractedClosingText{},
},
- expectedDeps: []string{"testdata/firstparty/FIRST_PARTY_LICENSE"},
+ expectedDeps: []string{
+ "testdata/firstparty/FIRST_PARTY_LICENSE",
+ "testdata/firstparty/lib/libd.so.meta_lic",
+ },
},
{
condition: "notice",
@@ -307,7 +339,7 @@
spdxVersion{},
spdxDataLicense{},
spdxDocumentName{"Android"},
- spdxID{"Android"},
+ spdxID{},
spdxDocumentNameSpace{},
spdxCreatorOrganization{},
spdxCreatedTime{},
@@ -316,7 +348,7 @@
spdxPkgID{"testdata/notice/highest.apex.meta_lic"},
spdxPkgDownloadLocation{"NOASSERTION"},
spdxPkgLicenseDeclared{"testdata-firstparty-FIRST_PARTY_LICENSE"},
- spdxRelationship{"DOCUMENT-Android ", "testdata/notice/highest.apex.meta_lic", "DESCRIBES"},
+ spdxRelationship{"DOCUMENT ", "testdata/notice/highest.apex.meta_lic", "DESCRIBES"},
packageTag{"testdata/notice/bin/bin1.meta_lic"},
packageName{"testdata/notice/bin/bin1.meta_lic"},
spdxPkgID{"testdata/notice/bin/bin1.meta_lic"},
@@ -366,6 +398,13 @@
expectedDeps: []string{
"testdata/firstparty/FIRST_PARTY_LICENSE",
"testdata/notice/NOTICE_LICENSE",
+ "testdata/notice/bin/bin1.meta_lic",
+ "testdata/notice/bin/bin2.meta_lic",
+ "testdata/notice/highest.apex.meta_lic",
+ "testdata/notice/lib/liba.so.meta_lic",
+ "testdata/notice/lib/libb.so.meta_lic",
+ "testdata/notice/lib/libc.a.meta_lic",
+ "testdata/notice/lib/libd.so.meta_lic",
},
},
{
@@ -376,7 +415,7 @@
spdxVersion{},
spdxDataLicense{},
spdxDocumentName{"Android"},
- spdxID{"Android"},
+ spdxID{},
spdxDocumentNameSpace{},
spdxCreatorOrganization{},
spdxCreatedTime{},
@@ -385,7 +424,7 @@
spdxPkgID{"testdata/notice/container.zip.meta_lic"},
spdxPkgDownloadLocation{"NOASSERTION"},
spdxPkgLicenseDeclared{"testdata-firstparty-FIRST_PARTY_LICENSE"},
- spdxRelationship{"DOCUMENT-Android ", "testdata/notice/container.zip.meta_lic", "DESCRIBES"},
+ spdxRelationship{"DOCUMENT ", "testdata/notice/container.zip.meta_lic", "DESCRIBES"},
packageTag{"testdata/notice/bin/bin1.meta_lic"},
packageName{"testdata/notice/bin/bin1.meta_lic"},
spdxPkgID{"testdata/notice/bin/bin1.meta_lic"},
@@ -435,6 +474,13 @@
expectedDeps: []string{
"testdata/firstparty/FIRST_PARTY_LICENSE",
"testdata/notice/NOTICE_LICENSE",
+ "testdata/notice/bin/bin1.meta_lic",
+ "testdata/notice/bin/bin2.meta_lic",
+ "testdata/notice/container.zip.meta_lic",
+ "testdata/notice/lib/liba.so.meta_lic",
+ "testdata/notice/lib/libb.so.meta_lic",
+ "testdata/notice/lib/libc.a.meta_lic",
+ "testdata/notice/lib/libd.so.meta_lic",
},
},
{
@@ -445,7 +491,7 @@
spdxVersion{},
spdxDataLicense{},
spdxDocumentName{"Android"},
- spdxID{"Android"},
+ spdxID{},
spdxDocumentNameSpace{},
spdxCreatorOrganization{},
spdxCreatedTime{},
@@ -454,7 +500,7 @@
spdxPkgID{"testdata/notice/application.meta_lic"},
spdxPkgDownloadLocation{"NOASSERTION"},
spdxPkgLicenseDeclared{"testdata-firstparty-FIRST_PARTY_LICENSE"},
- spdxRelationship{"DOCUMENT-Android ", "testdata-notice-application.meta_lic", "DESCRIBES"},
+ spdxRelationship{"DOCUMENT ", "testdata-notice-application.meta_lic", "DESCRIBES"},
packageTag{"testdata/notice/bin/bin3.meta_lic"},
packageName{"testdata/notice/bin/bin3.meta_lic"},
spdxPkgID{"testdata/notice/bin/bin3.meta_lic"},
@@ -484,6 +530,10 @@
expectedDeps: []string{
"testdata/firstparty/FIRST_PARTY_LICENSE",
"testdata/notice/NOTICE_LICENSE",
+ "testdata/notice/application.meta_lic",
+ "testdata/notice/bin/bin3.meta_lic",
+ "testdata/notice/lib/liba.so.meta_lic",
+ "testdata/notice/lib/libb.so.meta_lic",
},
},
{
@@ -494,7 +544,7 @@
spdxVersion{},
spdxDataLicense{},
spdxDocumentName{"Android"},
- spdxID{"Android"},
+ spdxID{},
spdxDocumentNameSpace{},
spdxCreatorOrganization{},
spdxCreatedTime{},
@@ -503,7 +553,7 @@
spdxPkgID{"testdata/notice/bin/bin1.meta_lic"},
spdxPkgDownloadLocation{"NOASSERTION"},
spdxPkgLicenseDeclared{"testdata-firstparty-FIRST_PARTY_LICENSE"},
- spdxRelationship{"DOCUMENT-Android ", "testdata/notice/bin/bin1.meta_lic", "DESCRIBES"},
+ spdxRelationship{"DOCUMENT ", "testdata/notice/bin/bin1.meta_lic", "DESCRIBES"},
packageTag{"testdata/notice/lib/liba.so.meta_lic"},
packageName{"testdata/notice/lib/liba.so.meta_lic"},
spdxPkgID{"testdata/notice/lib/liba.so.meta_lic"},
@@ -527,6 +577,9 @@
expectedDeps: []string{
"testdata/firstparty/FIRST_PARTY_LICENSE",
"testdata/notice/NOTICE_LICENSE",
+ "testdata/notice/bin/bin1.meta_lic",
+ "testdata/notice/lib/liba.so.meta_lic",
+ "testdata/notice/lib/libc.a.meta_lic",
},
},
{
@@ -537,7 +590,7 @@
spdxVersion{},
spdxDataLicense{},
spdxDocumentName{"Android"},
- spdxID{"Android"},
+ spdxID{},
spdxDocumentNameSpace{},
spdxCreatorOrganization{},
spdxCreatedTime{},
@@ -546,13 +599,16 @@
spdxPkgID{"testdata/notice/lib/libd.so.meta_lic"},
spdxPkgDownloadLocation{"NOASSERTION"},
spdxPkgLicenseDeclared{"testdata-notice-NOTICE_LICENSE"},
- spdxRelationship{"DOCUMENT-Android ", "testdata/notice/lib/libd.so.meta_lic", "DESCRIBES"},
+ spdxRelationship{"DOCUMENT ", "testdata/notice/lib/libd.so.meta_lic", "DESCRIBES"},
spdxLicense{},
spdxLicenseID{"testdata-notice-NOTICE_LICENSE"},
spdxExtractedText{"%%%Notice License%%%"},
spdxExtractedClosingText{},
},
- expectedDeps: []string{"testdata/notice/NOTICE_LICENSE"},
+ expectedDeps: []string{
+ "testdata/notice/NOTICE_LICENSE",
+ "testdata/notice/lib/libd.so.meta_lic",
+ },
},
{
condition: "reciprocal",
@@ -562,7 +618,7 @@
spdxVersion{},
spdxDataLicense{},
spdxDocumentName{"Android"},
- spdxID{"Android"},
+ spdxID{},
spdxDocumentNameSpace{},
spdxCreatorOrganization{},
spdxCreatedTime{},
@@ -571,7 +627,7 @@
spdxPkgID{"testdata/reciprocal/highest.apex.meta_lic"},
spdxPkgDownloadLocation{"NOASSERTION"},
spdxPkgLicenseDeclared{"testdata-firstparty-FIRST_PARTY_LICENSE"},
- spdxRelationship{"DOCUMENT-Android ", "testdata/reciprocal/highest.apex.meta_lic", "DESCRIBES"},
+ spdxRelationship{"DOCUMENT ", "testdata/reciprocal/highest.apex.meta_lic", "DESCRIBES"},
packageTag{"testdata/reciprocal/bin/bin1.meta_lic"},
packageName{"testdata/reciprocal/bin/bin1.meta_lic"},
spdxPkgID{"testdata/reciprocal/bin/bin1.meta_lic"},
@@ -625,6 +681,13 @@
"testdata/firstparty/FIRST_PARTY_LICENSE",
"testdata/notice/NOTICE_LICENSE",
"testdata/reciprocal/RECIPROCAL_LICENSE",
+ "testdata/reciprocal/bin/bin1.meta_lic",
+ "testdata/reciprocal/bin/bin2.meta_lic",
+ "testdata/reciprocal/highest.apex.meta_lic",
+ "testdata/reciprocal/lib/liba.so.meta_lic",
+ "testdata/reciprocal/lib/libb.so.meta_lic",
+ "testdata/reciprocal/lib/libc.a.meta_lic",
+ "testdata/reciprocal/lib/libd.so.meta_lic",
},
},
{
@@ -635,7 +698,7 @@
spdxVersion{},
spdxDataLicense{},
spdxDocumentName{"Android"},
- spdxID{"Android"},
+ spdxID{},
spdxDocumentNameSpace{},
spdxCreatorOrganization{},
spdxCreatedTime{},
@@ -644,7 +707,7 @@
spdxPkgID{"testdata/reciprocal/container.zip.meta_lic"},
spdxPkgDownloadLocation{"NOASSERTION"},
spdxPkgLicenseDeclared{"testdata-firstparty-FIRST_PARTY_LICENSE"},
- spdxRelationship{"DOCUMENT-Android ", "testdata/reciprocal/container.zip.meta_lic", "DESCRIBES"},
+ spdxRelationship{"DOCUMENT ", "testdata/reciprocal/container.zip.meta_lic", "DESCRIBES"},
packageTag{"testdata/reciprocal/bin/bin1.meta_lic"},
packageName{"testdata/reciprocal/bin/bin1.meta_lic"},
spdxPkgID{"testdata/reciprocal/bin/bin1.meta_lic"},
@@ -698,6 +761,13 @@
"testdata/firstparty/FIRST_PARTY_LICENSE",
"testdata/notice/NOTICE_LICENSE",
"testdata/reciprocal/RECIPROCAL_LICENSE",
+ "testdata/reciprocal/bin/bin1.meta_lic",
+ "testdata/reciprocal/bin/bin2.meta_lic",
+ "testdata/reciprocal/container.zip.meta_lic",
+ "testdata/reciprocal/lib/liba.so.meta_lic",
+ "testdata/reciprocal/lib/libb.so.meta_lic",
+ "testdata/reciprocal/lib/libc.a.meta_lic",
+ "testdata/reciprocal/lib/libd.so.meta_lic",
},
},
{
@@ -708,7 +778,7 @@
spdxVersion{},
spdxDataLicense{},
spdxDocumentName{"Android"},
- spdxID{"Android"},
+ spdxID{},
spdxDocumentNameSpace{},
spdxCreatorOrganization{},
spdxCreatedTime{},
@@ -717,7 +787,7 @@
spdxPkgID{"testdata/reciprocal/application.meta_lic"},
spdxPkgDownloadLocation{"NOASSERTION"},
spdxPkgLicenseDeclared{"testdata-firstparty-FIRST_PARTY_LICENSE"},
- spdxRelationship{"DOCUMENT-Android ", "testdata/reciprocal/application.meta_lic", "DESCRIBES"},
+ spdxRelationship{"DOCUMENT ", "testdata/reciprocal/application.meta_lic", "DESCRIBES"},
packageTag{"testdata/reciprocal/bin/bin3.meta_lic"},
packageName{"testdata/reciprocal/bin/bin3.meta_lic"},
spdxPkgID{"testdata/reciprocal/bin/bin3.meta_lic"},
@@ -751,6 +821,10 @@
"testdata/firstparty/FIRST_PARTY_LICENSE",
"testdata/notice/NOTICE_LICENSE",
"testdata/reciprocal/RECIPROCAL_LICENSE",
+ "testdata/reciprocal/application.meta_lic",
+ "testdata/reciprocal/bin/bin3.meta_lic",
+ "testdata/reciprocal/lib/liba.so.meta_lic",
+ "testdata/reciprocal/lib/libb.so.meta_lic",
},
},
{
@@ -761,7 +835,7 @@
spdxVersion{},
spdxDataLicense{},
spdxDocumentName{"Android"},
- spdxID{"Android"},
+ spdxID{},
spdxDocumentNameSpace{},
spdxCreatorOrganization{},
spdxCreatedTime{},
@@ -770,7 +844,7 @@
spdxPkgID{"testdata/reciprocal/bin/bin1.meta_lic"},
spdxPkgDownloadLocation{"NOASSERTION"},
spdxPkgLicenseDeclared{"testdata-firstparty-FIRST_PARTY_LICENSE"},
- spdxRelationship{"DOCUMENT-Android ", "testdata/reciprocal/bin/bin1.meta_lic", "DESCRIBES"},
+ spdxRelationship{"DOCUMENT ", "testdata/reciprocal/bin/bin1.meta_lic", "DESCRIBES"},
packageTag{"testdata/reciprocal/lib/liba.so.meta_lic"},
packageName{"testdata/reciprocal/lib/liba.so.meta_lic"},
spdxPkgID{"testdata/reciprocal/lib/liba.so.meta_lic"},
@@ -794,6 +868,9 @@
expectedDeps: []string{
"testdata/firstparty/FIRST_PARTY_LICENSE",
"testdata/reciprocal/RECIPROCAL_LICENSE",
+ "testdata/reciprocal/bin/bin1.meta_lic",
+ "testdata/reciprocal/lib/liba.so.meta_lic",
+ "testdata/reciprocal/lib/libc.a.meta_lic",
},
},
{
@@ -804,7 +881,7 @@
spdxVersion{},
spdxDataLicense{},
spdxDocumentName{"Android"},
- spdxID{"Android"},
+ spdxID{},
spdxDocumentNameSpace{},
spdxCreatorOrganization{},
spdxCreatedTime{},
@@ -813,7 +890,7 @@
spdxPkgID{"testdata/reciprocal/lib/libd.so.meta_lic"},
spdxPkgDownloadLocation{"NOASSERTION"},
spdxPkgLicenseDeclared{"testdata-notice-NOTICE_LICENSE"},
- spdxRelationship{"DOCUMENT-Android ", "testdata/reciprocal/lib/libd.so.meta_lic", "DESCRIBES"},
+ spdxRelationship{"DOCUMENT ", "testdata/reciprocal/lib/libd.so.meta_lic", "DESCRIBES"},
spdxLicense{},
spdxLicenseID{"testdata-notice-NOTICE_LICENSE"},
spdxExtractedText{"%%%Notice License%%%"},
@@ -821,6 +898,7 @@
},
expectedDeps: []string{
"testdata/notice/NOTICE_LICENSE",
+ "testdata/reciprocal/lib/libd.so.meta_lic",
},
},
{
@@ -832,7 +910,7 @@
spdxVersion{},
spdxDataLicense{},
spdxDocumentName{"Android"},
- spdxID{"Android"},
+ spdxID{},
spdxDocumentNameSpace{},
spdxCreatorOrganization{},
spdxCreatedTime{},
@@ -841,7 +919,7 @@
spdxPkgID{"testdata/restricted/highest.apex.meta_lic"},
spdxPkgDownloadLocation{"NOASSERTION"},
spdxPkgLicenseDeclared{"testdata-firstparty-FIRST_PARTY_LICENSE"},
- spdxRelationship{"DOCUMENT-Android ", "testdata/restricted/highest.apex.meta_lic", "DESCRIBES"},
+ spdxRelationship{"DOCUMENT ", "testdata/restricted/highest.apex.meta_lic", "DESCRIBES"},
packageTag{"testdata/restricted/bin/bin1.meta_lic"},
packageName{"testdata/restricted/bin/bin1.meta_lic"},
spdxPkgID{"testdata/restricted/bin/bin1.meta_lic"},
@@ -899,6 +977,13 @@
"testdata/notice/NOTICE_LICENSE",
"testdata/reciprocal/RECIPROCAL_LICENSE",
"testdata/restricted/RESTRICTED_LICENSE",
+ "testdata/restricted/bin/bin1.meta_lic",
+ "testdata/restricted/bin/bin2.meta_lic",
+ "testdata/restricted/highest.apex.meta_lic",
+ "testdata/restricted/lib/liba.so.meta_lic",
+ "testdata/restricted/lib/libb.so.meta_lic",
+ "testdata/restricted/lib/libc.a.meta_lic",
+ "testdata/restricted/lib/libd.so.meta_lic",
},
},
{
@@ -910,7 +995,7 @@
spdxVersion{},
spdxDataLicense{},
spdxDocumentName{"Android"},
- spdxID{"Android"},
+ spdxID{},
spdxDocumentNameSpace{},
spdxCreatorOrganization{},
spdxCreatedTime{},
@@ -919,7 +1004,7 @@
spdxPkgID{"testdata/restricted/container.zip.meta_lic"},
spdxPkgDownloadLocation{"NOASSERTION"},
spdxPkgLicenseDeclared{"testdata-firstparty-FIRST_PARTY_LICENSE"},
- spdxRelationship{"DOCUMENT-Android ", "testdata/restricted/container.zip.meta_lic", "DESCRIBES"},
+ spdxRelationship{"DOCUMENT ", "testdata/restricted/container.zip.meta_lic", "DESCRIBES"},
packageTag{"testdata/restricted/bin/bin1.meta_lic"},
packageName{"testdata/restricted/bin/bin1.meta_lic"},
spdxPkgID{"testdata/restricted/bin/bin1.meta_lic"},
@@ -977,6 +1062,13 @@
"testdata/notice/NOTICE_LICENSE",
"testdata/reciprocal/RECIPROCAL_LICENSE",
"testdata/restricted/RESTRICTED_LICENSE",
+ "testdata/restricted/bin/bin1.meta_lic",
+ "testdata/restricted/bin/bin2.meta_lic",
+ "testdata/restricted/container.zip.meta_lic",
+ "testdata/restricted/lib/liba.so.meta_lic",
+ "testdata/restricted/lib/libb.so.meta_lic",
+ "testdata/restricted/lib/libc.a.meta_lic",
+ "testdata/restricted/lib/libd.so.meta_lic",
},
},
{
@@ -987,7 +1079,7 @@
spdxVersion{},
spdxDataLicense{},
spdxDocumentName{"Android"},
- spdxID{"Android"},
+ spdxID{},
spdxDocumentNameSpace{},
spdxCreatorOrganization{},
spdxCreatedTime{},
@@ -996,7 +1088,7 @@
spdxPkgID{"testdata/restricted/bin/bin1.meta_lic"},
spdxPkgDownloadLocation{"NOASSERTION"},
spdxPkgLicenseDeclared{"testdata-firstparty-FIRST_PARTY_LICENSE"},
- spdxRelationship{"DOCUMENT-Android ", "testdata/restricted/bin/bin1.meta_lic", "DESCRIBES"},
+ spdxRelationship{"DOCUMENT ", "testdata/restricted/bin/bin1.meta_lic", "DESCRIBES"},
packageTag{"testdata/restricted/lib/liba.so.meta_lic"},
packageName{"testdata/restricted/lib/liba.so.meta_lic"},
spdxPkgID{"testdata/restricted/lib/liba.so.meta_lic"},
@@ -1024,6 +1116,9 @@
"testdata/firstparty/FIRST_PARTY_LICENSE",
"testdata/reciprocal/RECIPROCAL_LICENSE",
"testdata/restricted/RESTRICTED_LICENSE",
+ "testdata/restricted/bin/bin1.meta_lic",
+ "testdata/restricted/lib/liba.so.meta_lic",
+ "testdata/restricted/lib/libc.a.meta_lic",
},
},
{
@@ -1034,7 +1129,7 @@
spdxVersion{},
spdxDataLicense{},
spdxDocumentName{"Android"},
- spdxID{"Android"},
+ spdxID{},
spdxDocumentNameSpace{},
spdxCreatorOrganization{},
spdxCreatedTime{},
@@ -1043,13 +1138,16 @@
spdxPkgID{"testdata/restricted/lib/libd.so.meta_lic"},
spdxPkgDownloadLocation{"NOASSERTION"},
spdxPkgLicenseDeclared{"testdata-notice-NOTICE_LICENSE"},
- spdxRelationship{"DOCUMENT-Android ", "testdata/restricted/lib/libd.so.meta_lic", "DESCRIBES"},
+ spdxRelationship{"DOCUMENT ", "testdata/restricted/lib/libd.so.meta_lic", "DESCRIBES"},
spdxLicense{},
spdxLicenseID{"testdata-notice-NOTICE_LICENSE"},
spdxExtractedText{"%%%Notice License%%%"},
spdxExtractedClosingText{},
},
- expectedDeps: []string{"testdata/notice/NOTICE_LICENSE"},
+ expectedDeps: []string{
+ "testdata/notice/NOTICE_LICENSE",
+ "testdata/restricted/lib/libd.so.meta_lic",
+ },
},
{
condition: "proprietary",
@@ -1059,7 +1157,7 @@
spdxVersion{},
spdxDataLicense{},
spdxDocumentName{"Android"},
- spdxID{"Android"},
+ spdxID{},
spdxDocumentNameSpace{},
spdxCreatorOrganization{},
spdxCreatedTime{},
@@ -1068,7 +1166,7 @@
spdxPkgID{"testdata/proprietary/highest.apex.meta_lic"},
spdxPkgDownloadLocation{"NOASSERTION"},
spdxPkgLicenseDeclared{"testdata-firstparty-FIRST_PARTY_LICENSE"},
- spdxRelationship{"DOCUMENT-Android ", "testdata/proprietary/highest.apex.meta_lic", "DESCRIBES"},
+ spdxRelationship{"DOCUMENT ", "testdata/proprietary/highest.apex.meta_lic", "DESCRIBES"},
packageTag{"testdata/proprietary/bin/bin1.meta_lic"},
packageName{"testdata/proprietary/bin/bin1.meta_lic"},
spdxPkgID{"testdata/proprietary/bin/bin1.meta_lic"},
@@ -1125,6 +1223,13 @@
"testdata/firstparty/FIRST_PARTY_LICENSE",
"testdata/notice/NOTICE_LICENSE",
"testdata/proprietary/PROPRIETARY_LICENSE",
+ "testdata/proprietary/bin/bin1.meta_lic",
+ "testdata/proprietary/bin/bin2.meta_lic",
+ "testdata/proprietary/highest.apex.meta_lic",
+ "testdata/proprietary/lib/liba.so.meta_lic",
+ "testdata/proprietary/lib/libb.so.meta_lic",
+ "testdata/proprietary/lib/libc.a.meta_lic",
+ "testdata/proprietary/lib/libd.so.meta_lic",
"testdata/restricted/RESTRICTED_LICENSE",
},
},
@@ -1136,7 +1241,7 @@
spdxVersion{},
spdxDataLicense{},
spdxDocumentName{"Android"},
- spdxID{"Android"},
+ spdxID{},
spdxDocumentNameSpace{},
spdxCreatorOrganization{},
spdxCreatedTime{},
@@ -1145,7 +1250,7 @@
spdxPkgID{"testdata/proprietary/container.zip.meta_lic"},
spdxPkgDownloadLocation{"NOASSERTION"},
spdxPkgLicenseDeclared{"testdata-firstparty-FIRST_PARTY_LICENSE"},
- spdxRelationship{"DOCUMENT-Android ", "testdata/proprietary/container.zip.meta_lic", "DESCRIBES"},
+ spdxRelationship{"DOCUMENT ", "testdata/proprietary/container.zip.meta_lic", "DESCRIBES"},
packageTag{"testdata/proprietary/bin/bin1.meta_lic"},
packageName{"testdata/proprietary/bin/bin1.meta_lic"},
spdxPkgID{"testdata/proprietary/bin/bin1.meta_lic"},
@@ -1202,6 +1307,13 @@
"testdata/firstparty/FIRST_PARTY_LICENSE",
"testdata/notice/NOTICE_LICENSE",
"testdata/proprietary/PROPRIETARY_LICENSE",
+ "testdata/proprietary/bin/bin1.meta_lic",
+ "testdata/proprietary/bin/bin2.meta_lic",
+ "testdata/proprietary/container.zip.meta_lic",
+ "testdata/proprietary/lib/liba.so.meta_lic",
+ "testdata/proprietary/lib/libb.so.meta_lic",
+ "testdata/proprietary/lib/libc.a.meta_lic",
+ "testdata/proprietary/lib/libd.so.meta_lic",
"testdata/restricted/RESTRICTED_LICENSE",
},
},
@@ -1213,7 +1325,7 @@
spdxVersion{},
spdxDataLicense{},
spdxDocumentName{"Android"},
- spdxID{"Android"},
+ spdxID{},
spdxDocumentNameSpace{},
spdxCreatorOrganization{},
spdxCreatedTime{},
@@ -1222,7 +1334,7 @@
spdxPkgID{"testdata/proprietary/application.meta_lic"},
spdxPkgDownloadLocation{"NOASSERTION"},
spdxPkgLicenseDeclared{"testdata-firstparty-FIRST_PARTY_LICENSE"},
- spdxRelationship{"DOCUMENT-Android ", "testdata/proprietary/application.meta_lic", "DESCRIBES"},
+ spdxRelationship{"DOCUMENT ", "testdata/proprietary/application.meta_lic", "DESCRIBES"},
packageTag{"testdata/proprietary/bin/bin3.meta_lic"},
packageName{"testdata/proprietary/bin/bin3.meta_lic"},
spdxPkgID{"testdata/proprietary/bin/bin3.meta_lic"},
@@ -1255,6 +1367,10 @@
expectedDeps: []string{
"testdata/firstparty/FIRST_PARTY_LICENSE",
"testdata/proprietary/PROPRIETARY_LICENSE",
+ "testdata/proprietary/application.meta_lic",
+ "testdata/proprietary/bin/bin3.meta_lic",
+ "testdata/proprietary/lib/liba.so.meta_lic",
+ "testdata/proprietary/lib/libb.so.meta_lic",
"testdata/restricted/RESTRICTED_LICENSE",
},
},
@@ -1266,7 +1382,7 @@
spdxVersion{},
spdxDataLicense{},
spdxDocumentName{"Android"},
- spdxID{"Android"},
+ spdxID{},
spdxDocumentNameSpace{},
spdxCreatorOrganization{},
spdxCreatedTime{},
@@ -1275,7 +1391,7 @@
spdxPkgID{"testdata/proprietary/bin/bin1.meta_lic"},
spdxPkgDownloadLocation{"NOASSERTION"},
spdxPkgLicenseDeclared{"testdata-firstparty-FIRST_PARTY_LICENSE"},
- spdxRelationship{"DOCUMENT-Android ", "testdata/proprietary/bin/bin1.meta_lic", "DESCRIBES"},
+ spdxRelationship{"DOCUMENT ", "testdata/proprietary/bin/bin1.meta_lic", "DESCRIBES"},
packageTag{"testdata/proprietary/lib/liba.so.meta_lic"},
packageName{"testdata/proprietary/lib/liba.so.meta_lic"},
spdxPkgID{"testdata/proprietary/lib/liba.so.meta_lic"},
@@ -1299,6 +1415,9 @@
expectedDeps: []string{
"testdata/firstparty/FIRST_PARTY_LICENSE",
"testdata/proprietary/PROPRIETARY_LICENSE",
+ "testdata/proprietary/bin/bin1.meta_lic",
+ "testdata/proprietary/lib/liba.so.meta_lic",
+ "testdata/proprietary/lib/libc.a.meta_lic",
},
},
{
@@ -1309,7 +1428,7 @@
spdxVersion{},
spdxDataLicense{},
spdxDocumentName{"Android"},
- spdxID{"Android"},
+ spdxID{},
spdxDocumentNameSpace{},
spdxCreatorOrganization{},
spdxCreatedTime{},
@@ -1318,13 +1437,16 @@
spdxPkgID{"testdata/proprietary/lib/libd.so.meta_lic"},
spdxPkgDownloadLocation{"NOASSERTION"},
spdxPkgLicenseDeclared{"testdata-notice-NOTICE_LICENSE"},
- spdxRelationship{"DOCUMENT-Android ", "testdata/proprietary/lib/libd.so.meta_lic", "DESCRIBES"},
+ spdxRelationship{"DOCUMENT ", "testdata/proprietary/lib/libd.so.meta_lic", "DESCRIBES"},
spdxLicense{},
spdxLicenseID{"testdata-notice-NOTICE_LICENSE"},
spdxExtractedText{"%%%Notice License%%%"},
spdxExtractedClosingText{},
},
- expectedDeps: []string{"testdata/notice/NOTICE_LICENSE"},
+ expectedDeps: []string{
+ "testdata/notice/NOTICE_LICENSE",
+ "testdata/proprietary/lib/libd.so.meta_lic",
+ },
},
}
for _, tt := range tests {
@@ -1419,20 +1541,14 @@
return "PackageName: " + replaceSlashes(m.name)
}
-type spdxID struct {
- name string
-}
+type spdxID struct {}
func (m spdxID) isMatch(line string) bool {
- groups := spdxIDTag.FindStringSubmatch(line)
- if len(groups) != 2 {
- return false
- }
- return groups[1] == replaceSlashes(m.name)
+ return spdxIDTag.MatchString(line)
}
func (m spdxID) String() string {
- return "SPDXID: SPDXRef-DOCUMENT-" + replaceSlashes(m.name)
+ return "SPDXID: SPDXRef-DOCUMENT"
}
type spdxPkgID struct {
@@ -1468,7 +1584,7 @@
}
func (m spdxDataLicense) String() string {
- return "DataLicense: CC-1.0"
+ return "DataLicense: CC0-1.0"
}
type spdxDocumentName struct {
diff --git a/tools/compliance/graph.go b/tools/compliance/graph.go
index fac1d05..9ad319b 100644
--- a/tools/compliance/graph.go
+++ b/tools/compliance/graph.go
@@ -88,6 +88,15 @@
return targets
}
+// TargetNames returns the list of target node names in the graph. (unordered)
+func (lg *LicenseGraph) TargetNames() []string {
+ targets := make([]string, 0, len(lg.targets))
+ for target := range lg.targets {
+ targets = append(targets, target)
+ }
+ return targets
+}
+
// compliance-only LicenseGraph methods
// newLicenseGraph constructs a new, empty instance of LicenseGraph.
diff --git a/tools/releasetools/add_img_to_target_files.py b/tools/releasetools/add_img_to_target_files.py
index d308a55..b45b0a3 100644
--- a/tools/releasetools/add_img_to_target_files.py
+++ b/tools/releasetools/add_img_to_target_files.py
@@ -1132,6 +1132,21 @@
item for item in vbmeta_partitions
if item not in vbmeta_vendor.split()]
vbmeta_partitions.append("vbmeta_vendor")
+ custom_avb_partitions = OPTIONS.info_dict.get("avb_custom_vbmeta_images_partition_list", "").strip().split()
+ if custom_avb_partitions:
+ for avb_part in custom_avb_partitions:
+ partition_name = "vbmeta_" + avb_part
+ included_partitions = OPTIONS.info_dict.get("avb_vbmeta_{}".format(avb_part), "").strip().split()
+ assert included_partitions, "Custom vbmeta partition {0} missing avb_vbmeta_{0} prop".format(avb_part)
+ banner(partition_name)
+ logger.info("VBMeta partition {} needs {}".format(partition_name, included_partitions))
+ partitions[partition_name] = AddVBMeta(
+ output_zip, partitions, partition_name, included_partitions)
+ vbmeta_partitions = [
+ item for item in vbmeta_partitions
+ if item not in included_partitions]
+ vbmeta_partitions.append(partition_name)
+
if OPTIONS.info_dict.get("avb_building_vbmeta_image") == "true":
banner("vbmeta")
diff --git a/tools/releasetools/check_target_files_vintf.py b/tools/releasetools/check_target_files_vintf.py
index a254cab..5b71c72 100755
--- a/tools/releasetools/check_target_files_vintf.py
+++ b/tools/releasetools/check_target_files_vintf.py
@@ -237,7 +237,7 @@
if OPTIONS.search_path:
debugfs_path = os.path.join(OPTIONS.search_path, 'bin', 'debugfs_static')
deapexer_path = os.path.join(OPTIONS.search_path, 'bin', 'deapexer')
- blkid_path = os.path.join(OPTIONS.search_path, 'bin', 'blkid')
+ blkid_path = os.path.join(OPTIONS.search_path, 'bin', 'blkid_static')
fsckerofs_path = os.path.join(OPTIONS.search_path, 'bin', 'fsck.erofs')
if os.path.isfile(deapexer_path):
deapexer = deapexer_path
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index 2f05d44..9919029 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -1503,12 +1503,14 @@
custom_partitions = OPTIONS.info_dict.get(
"avb_custom_images_partition_list", "").strip().split()
+ custom_avb_partitions = ["vbmeta_" + part for part in OPTIONS.info_dict.get("avb_custom_vbmeta_images_partition_list", "").strip().split()]
for partition, path in partitions.items():
if partition not in needed_partitions:
continue
assert (partition in AVB_PARTITIONS or
partition in AVB_VBMETA_PARTITIONS or
+ partition in custom_avb_partitions or
partition in custom_partitions), \
'Unknown partition: {}'.format(partition)
assert os.path.exists(path), \
diff --git a/tools/releasetools/non_ab_ota.py b/tools/releasetools/non_ab_ota.py
index ac85aa4..7078d67 100644
--- a/tools/releasetools/non_ab_ota.py
+++ b/tools/releasetools/non_ab_ota.py
@@ -48,17 +48,12 @@
# if the filesystem is ext4.
partition_source_info = source_info["fstab"]["/" + name]
check_first_block = partition_source_info.fs_type == "ext4"
- # Disable using imgdiff for squashfs. 'imgdiff -z' expects input files to be
- # in zip formats. However with squashfs, a) all files are compressed in LZ4;
- # b) the blocks listed in block map may not contain all the bytes for a
- # given file (because they're rounded to be 4K-aligned).
- partition_target_info = target_info["fstab"]["/" + name]
- disable_imgdiff = (partition_source_info.fs_type == "squashfs" or
- partition_target_info.fs_type == "squashfs")
+ # Disable imgdiff because it relies on zlib to produce stable output
+ # across different versions, which is often not the case.
return common.BlockDifference(name, partition_tgt, partition_src,
check_first_block,
version=blockimgdiff_version,
- disable_imgdiff=disable_imgdiff)
+ disable_imgdiff=True)
if source_zip:
# See notes in common.GetUserImage()
@@ -282,7 +277,7 @@
needed_property_files = (
NonAbOtaPropertyFiles(),
)
- FinalizeMetadata(metadata, staging_file, output_file, needed_property_files)
+ FinalizeMetadata(metadata, staging_file, output_file, needed_property_files, package_key=OPTIONS.package_key)
def WriteBlockIncrementalOTAPackage(target_zip, source_zip, output_file):
@@ -409,7 +404,7 @@
if updating_boot:
boot_type, boot_device_expr = common.GetTypeAndDeviceExpr("/boot",
source_info)
- d = common.Difference(target_boot, source_boot)
+ d = common.Difference(target_boot, source_boot, "bsdiff")
_, _, d = d.ComputePatch()
if d is None:
include_full_boot = True
@@ -537,7 +532,7 @@
needed_property_files = (
NonAbOtaPropertyFiles(),
)
- FinalizeMetadata(metadata, staging_file, output_file, needed_property_files)
+ FinalizeMetadata(metadata, staging_file, output_file, needed_property_files, package_key=OPTIONS.package_key)
def GenerateNonAbOtaPackage(target_file, output_file, source_file=None):
diff --git a/tools/releasetools/ota_from_target_files.py b/tools/releasetools/ota_from_target_files.py
index 60e95ad..d6c39c6 100755
--- a/tools/releasetools/ota_from_target_files.py
+++ b/tools/releasetools/ota_from_target_files.py
@@ -205,7 +205,8 @@
--partial "<PARTITION> [<PARTITION>[...]]"
Generate partial updates, overriding ab_partitions list with the given
- list.
+ list. Specify --partial= without partition list to let tooling auto detect
+ partial partition list.
--custom_image <custom_partition=custom_image>
Use the specified custom_image to update custom_partition when generating
@@ -856,6 +857,31 @@
target_info = common.BuildInfo(OPTIONS.info_dict, OPTIONS.oem_dicts)
source_info = None
+ if OPTIONS.partial == []:
+ logger.info(
+ "Automatically detecting partial partition list from input target files.")
+ OPTIONS.partial = target_info.get(
+ "partial_ota_update_partitions_list").split()
+ assert OPTIONS.partial, "Input target_file does not have"
+ " partial_ota_update_partitions_list defined, failed to auto detect partial"
+ " partition list. Please specify list of partitions to update manually via"
+ " --partial=a,b,c , or generate a complete OTA by removing the --partial"
+ " option"
+ OPTIONS.partial.sort()
+ if source_info:
+ source_partial_list = source_info.get(
+ "partial_ota_update_partitions_list").split()
+ if source_partial_list:
+ source_partial_list.sort()
+ if source_partial_list != OPTIONS.partial:
+ logger.warning("Source build and target build have different partial partition lists. Source: %s, target: %s, taking the intersection.",
+ source_partial_list, OPTIONS.partial)
+ OPTIONS.partial = list(
+ set(OPTIONS.partial) and set(source_partial_list))
+ OPTIONS.partial.sort()
+ logger.info("Automatically deduced partial partition list: %s",
+ OPTIONS.partial)
+
if target_info.vendor_suppressed_vabc:
logger.info("Vendor suppressed VABC. Disabling")
OPTIONS.disable_vabc = True
@@ -1107,9 +1133,12 @@
elif o == "--boot_variable_file":
OPTIONS.boot_variable_file = a
elif o == "--partial":
- partitions = a.split()
- if not partitions:
- raise ValueError("Cannot parse partitions in {}".format(a))
+ if a:
+ partitions = a.split()
+ if not partitions:
+ raise ValueError("Cannot parse partitions in {}".format(a))
+ else:
+ partitions = []
OPTIONS.partial = partitions
elif o == "--custom_image":
custom_partition, custom_image = a.split("=")
@@ -1190,13 +1219,12 @@
"vabc_compression_param=",
"security_patch_level=",
], extra_option_handler=option_handler)
+ common.InitLogging()
if len(args) != 2:
common.Usage(__doc__)
sys.exit(1)
- common.InitLogging()
-
# Load the build info dicts from the zip directly or the extracted input
# directory. We don't need to unzip the entire target-files zips, because they
# won't be needed for A/B OTAs (brillo_update_payload does that on its own).
diff --git a/tools/releasetools/ota_utils.py b/tools/releasetools/ota_utils.py
index e36a2be..e2ce31d 100644
--- a/tools/releasetools/ota_utils.py
+++ b/tools/releasetools/ota_utils.py
@@ -132,8 +132,10 @@
# Re-sign the package after updating the metadata entry.
if no_signing:
+ logger.info(f"Signing disabled for output file {output_file}")
shutil.copy(prelim_signing, output_file)
else:
+ logger.info(f"Signing the output file {output_file} with key {package_key}")
SignOutput(prelim_signing, output_file, package_key, pw)
# Reopen the final signed zip to double check the streaming metadata.
diff --git a/tools/zipalign/ZipEntry.cpp b/tools/zipalign/ZipEntry.cpp
index fcad96c..689999e 100644
--- a/tools/zipalign/ZipEntry.cpp
+++ b/tools/zipalign/ZipEntry.cpp
@@ -40,14 +40,10 @@
*/
status_t ZipEntry::initFromCDE(FILE* fp)
{
- status_t result;
- long posn; // NOLINT(google-runtime-int), for ftell/fseek
- bool hasDD;
-
//ALOGV("initFromCDE ---\n");
/* read the CDE */
- result = mCDE.read(fp);
+ status_t result = mCDE.read(fp);
if (result != OK) {
ALOGD("mCDE.read failed\n");
return result;
@@ -56,8 +52,8 @@
//mCDE.dump();
/* using the info in the CDE, go load up the LFH */
- posn = ftell(fp);
- if (fseek(fp, mCDE.mLocalHeaderRelOffset, SEEK_SET) != 0) {
+ off_t posn = ftello(fp);
+ if (fseeko(fp, mCDE.mLocalHeaderRelOffset, SEEK_SET) != 0) {
ALOGD("local header seek failed (%" PRIu32 ")\n",
mCDE.mLocalHeaderRelOffset);
return UNKNOWN_ERROR;
@@ -69,7 +65,7 @@
return result;
}
- if (fseek(fp, posn, SEEK_SET) != 0)
+ if (fseeko(fp, posn, SEEK_SET) != 0)
return UNKNOWN_ERROR;
//mLFH.dump();
@@ -80,7 +76,7 @@
* compressed size, and uncompressed size will be zero. In practice
* these seem to be rare.
*/
- hasDD = (mLFH.mGPBitFlag & kUsesDataDescr) != 0;
+ bool hasDD = (mLFH.mGPBitFlag & kUsesDataDescr) != 0;
if (hasDD) {
// do something clever
//ALOGD("+++ has data descriptor\n");
diff --git a/tools/zipalign/ZipFile.cpp b/tools/zipalign/ZipFile.cpp
index ff15b15..42cc349 100644
--- a/tools/zipalign/ZipFile.cpp
+++ b/tools/zipalign/ZipFile.cpp
@@ -35,6 +35,8 @@
#include <assert.h>
#include <inttypes.h>
+_Static_assert(sizeof(off_t) == 8, "off_t too small");
+
namespace android {
/*
@@ -205,56 +207,43 @@
*/
status_t ZipFile::readCentralDir(void)
{
- status_t result = OK;
- uint8_t* buf = NULL;
- off_t fileLength, seekStart;
- long readAmount;
- int i;
-
- fseek(mZipFp, 0, SEEK_END);
- fileLength = ftell(mZipFp);
+ fseeko(mZipFp, 0, SEEK_END);
+ off_t fileLength = ftello(mZipFp);
rewind(mZipFp);
/* too small to be a ZIP archive? */
if (fileLength < EndOfCentralDir::kEOCDLen) {
- ALOGD("Length is %ld -- too small\n", (long)fileLength);
- result = INVALID_OPERATION;
- goto bail;
+ ALOGD("Length is %lld -- too small\n", (long long) fileLength);
+ return INVALID_OPERATION;
}
- buf = new uint8_t[EndOfCentralDir::kMaxEOCDSearch];
- if (buf == NULL) {
- ALOGD("Failure allocating %d bytes for EOCD search",
- EndOfCentralDir::kMaxEOCDSearch);
- result = NO_MEMORY;
- goto bail;
- }
-
+ off_t seekStart;
+ size_t readAmount;
if (fileLength > EndOfCentralDir::kMaxEOCDSearch) {
seekStart = fileLength - EndOfCentralDir::kMaxEOCDSearch;
readAmount = EndOfCentralDir::kMaxEOCDSearch;
} else {
seekStart = 0;
- readAmount = (long) fileLength;
+ readAmount = fileLength;
}
- if (fseek(mZipFp, seekStart, SEEK_SET) != 0) {
- ALOGD("Failure seeking to end of zip at %ld", (long) seekStart);
- result = UNKNOWN_ERROR;
- goto bail;
+ if (fseeko(mZipFp, seekStart, SEEK_SET) != 0) {
+ ALOGD("Failure seeking to end of zip at %lld", (long long) seekStart);
+ return UNKNOWN_ERROR;
}
/* read the last part of the file into the buffer */
- if (fread(buf, 1, readAmount, mZipFp) != (size_t) readAmount) {
+ uint8_t buf[EndOfCentralDir::kMaxEOCDSearch];
+ if (fread(buf, 1, readAmount, mZipFp) != readAmount) {
if (feof(mZipFp)) {
- ALOGW("fread %ld bytes failed, unexpected EOF", readAmount);
+ ALOGW("fread %zu bytes failed, unexpected EOF", readAmount);
} else {
- ALOGW("fread %ld bytes failed, %s", readAmount, strerror(errno));
+ ALOGW("fread %zu bytes failed, %s", readAmount, strerror(errno));
}
- result = UNKNOWN_ERROR;
- goto bail;
+ return UNKNOWN_ERROR;
}
/* find the end-of-central-dir magic */
+ int i;
for (i = readAmount - 4; i >= 0; i--) {
if (buf[i] == 0x50 &&
ZipEntry::getLongLE(&buf[i]) == EndOfCentralDir::kSignature)
@@ -265,15 +254,14 @@
}
if (i < 0) {
ALOGD("EOCD not found, not Zip\n");
- result = INVALID_OPERATION;
- goto bail;
+ return INVALID_OPERATION;
}
/* extract eocd values */
- result = mEOCD.readBuf(buf + i, readAmount - i);
+ status_t result = mEOCD.readBuf(buf + i, readAmount - i);
if (result != OK) {
- ALOGD("Failure reading %ld bytes of EOCD values", readAmount - i);
- goto bail;
+ ALOGD("Failure reading %zu bytes of EOCD values", readAmount - i);
+ return result;
}
//mEOCD.dump();
@@ -281,8 +269,7 @@
mEOCD.mNumEntries != mEOCD.mTotalNumEntries)
{
ALOGD("Archive spanning not supported\n");
- result = INVALID_OPERATION;
- goto bail;
+ return INVALID_OPERATION;
}
/*
@@ -299,11 +286,10 @@
* The only thing we really need right now is the file comment, which
* we're hoping to preserve.
*/
- if (fseek(mZipFp, mEOCD.mCentralDirOffset, SEEK_SET) != 0) {
+ if (fseeko(mZipFp, mEOCD.mCentralDirOffset, SEEK_SET) != 0) {
ALOGD("Failure seeking to central dir offset %" PRIu32 "\n",
mEOCD.mCentralDirOffset);
- result = UNKNOWN_ERROR;
- goto bail;
+ return UNKNOWN_ERROR;
}
/*
@@ -318,7 +304,7 @@
if (result != OK) {
ALOGD("initFromCDE failed\n");
delete pEntry;
- goto bail;
+ return result;
}
mEntries.add(pEntry);
@@ -336,20 +322,16 @@
} else {
ALOGW("fread EOCD failed, %s", strerror(errno));
}
- result = INVALID_OPERATION;
- goto bail;
+ return INVALID_OPERATION;
}
if (ZipEntry::getLongLE(checkBuf) != EndOfCentralDir::kSignature) {
ALOGD("EOCD read check failed\n");
- result = UNKNOWN_ERROR;
- goto bail;
+ return UNKNOWN_ERROR;
}
ALOGV("+++ EOCD read check passed\n");
}
-bail:
- delete[] buf;
- return result;
+ return OK;
}
@@ -370,8 +352,7 @@
{
ZipEntry* pEntry = NULL;
status_t result = OK;
- long lfhPosn, startPosn, endPosn, uncompressedLen;
- FILE* inputFp = NULL;
+ off_t lfhPosn, startPosn, endPosn, uncompressedLen;
uint32_t crc = 0;
time_t modWhen;
@@ -389,13 +370,14 @@
if (getEntryByName(storageName) != NULL)
return ALREADY_EXISTS;
+ FILE* inputFp = NULL;
if (!data) {
inputFp = fopen(fileName, FILE_OPEN_RO);
if (inputFp == NULL)
return errnoToStatus(errno);
}
- if (fseek(mZipFp, mEOCD.mCentralDirOffset, SEEK_SET) != 0) {
+ if (fseeko(mZipFp, mEOCD.mCentralDirOffset, SEEK_SET) != 0) {
result = UNKNOWN_ERROR;
goto bail;
}
@@ -413,9 +395,9 @@
* as a place-holder. In theory the LFH isn't necessary, but in
* practice some utilities demand it.
*/
- lfhPosn = ftell(mZipFp);
+ lfhPosn = ftello(mZipFp);
pEntry->mLFH.write(mZipFp);
- startPosn = ftell(mZipFp);
+ startPosn = ftello(mZipFp);
/*
* Copy the data in, possibly compressing it as we go.
@@ -432,11 +414,11 @@
* to be set through an API call, but I don't expect our
* criteria to change over time.
*/
- long src = inputFp ? ftell(inputFp) : size;
- long dst = ftell(mZipFp) - startPosn;
+ off_t src = inputFp ? ftello(inputFp) : size;
+ off_t dst = ftello(mZipFp) - startPosn;
if (dst + (dst / 10) > src) {
- ALOGD("insufficient compression (src=%ld dst=%ld), storing\n",
- src, dst);
+ ALOGD("insufficient compression (src=%lld dst=%lld), storing\n",
+ (long long) src, (long long) dst);
failed = true;
}
}
@@ -444,7 +426,7 @@
if (failed) {
compressionMethod = ZipEntry::kCompressStored;
if (inputFp) rewind(inputFp);
- fseek(mZipFp, startPosn, SEEK_SET);
+ fseeko(mZipFp, startPosn, SEEK_SET);
/* fall through to kCompressStored case */
}
}
@@ -463,7 +445,7 @@
}
// currently seeked to end of file
- uncompressedLen = inputFp ? ftell(inputFp) : size;
+ uncompressedLen = inputFp ? ftello(inputFp) : size;
/*
* We could write the "Data Descriptor", but there doesn't seem to
@@ -471,7 +453,7 @@
*
* Update file offsets.
*/
- endPosn = ftell(mZipFp); // seeked to end of compressed data
+ endPosn = ftello(mZipFp); // seeked to end of compressed data
/*
* Success! Fill out new values.
@@ -489,7 +471,7 @@
/*
* Go back and write the LFH.
*/
- if (fseek(mZipFp, lfhPosn, SEEK_SET) != 0) {
+ if (fseeko(mZipFp, lfhPosn, SEEK_SET) != 0) {
result = UNKNOWN_ERROR;
goto bail;
}
@@ -522,7 +504,7 @@
// Calculate where the entry payload offset will end up if we were to write
// it as-is.
- uint64_t expectedPayloadOffset = ftell(mZipFp) +
+ uint64_t expectedPayloadOffset = ftello(mZipFp) +
android::ZipEntry::LocalFileHeader::kLFHLen +
pEntry->mLFH.mFileNameLength +
pEntry->mLFH.mExtraFieldLength;
@@ -548,7 +530,7 @@
{
ZipEntry* pEntry = NULL;
status_t result;
- long lfhPosn, endPosn;
+ off_t lfhPosn, endPosn;
if (mReadOnly)
return INVALID_OPERATION;
@@ -557,7 +539,7 @@
assert(mZipFp != NULL);
assert(mEntries.size() == mEOCD.mTotalNumEntries);
- if (fseek(mZipFp, mEOCD.mCentralDirOffset, SEEK_SET) != 0) {
+ if (fseeko(mZipFp, mEOCD.mCentralDirOffset, SEEK_SET) != 0) {
result = UNKNOWN_ERROR;
goto bail;
}
@@ -585,7 +567,7 @@
* Write the LFH. Since we're not recompressing the data, we already
* have all of the fields filled out.
*/
- lfhPosn = ftell(mZipFp);
+ lfhPosn = ftello(mZipFp);
pEntry->mLFH.write(mZipFp);
/*
@@ -595,8 +577,7 @@
* fields as well. This is a fixed-size area immediately following
* the data.
*/
- if (fseek(pSourceZip->mZipFp, pSourceEntry->getFileOffset(), SEEK_SET) != 0)
- {
+ if (fseeko(pSourceZip->mZipFp, pSourceEntry->getFileOffset(), SEEK_SET) != 0) {
result = UNKNOWN_ERROR;
goto bail;
}
@@ -617,7 +598,7 @@
/*
* Update file offsets.
*/
- endPosn = ftell(mZipFp);
+ endPosn = ftello(mZipFp);
/*
* Success! Fill out new values.
@@ -654,7 +635,7 @@
{
ZipEntry* pEntry = NULL;
status_t result;
- long lfhPosn, uncompressedLen;
+ off_t lfhPosn, uncompressedLen;
if (mReadOnly)
return INVALID_OPERATION;
@@ -663,7 +644,7 @@
assert(mZipFp != NULL);
assert(mEntries.size() == mEOCD.mTotalNumEntries);
- if (fseek(mZipFp, mEOCD.mCentralDirOffset, SEEK_SET) != 0) {
+ if (fseeko(mZipFp, mEOCD.mCentralDirOffset, SEEK_SET) != 0) {
result = UNKNOWN_ERROR;
goto bail;
}
@@ -688,7 +669,7 @@
* as a place-holder. In theory the LFH isn't necessary, but in
* practice some utilities demand it.
*/
- lfhPosn = ftell(mZipFp);
+ lfhPosn = ftello(mZipFp);
pEntry->mLFH.write(mZipFp);
/*
@@ -698,8 +679,7 @@
* fields as well. This is a fixed-size area immediately following
* the data.
*/
- if (fseek(pSourceZip->mZipFp, pSourceEntry->getFileOffset(), SEEK_SET) != 0)
- {
+ if (fseeko(pSourceZip->mZipFp, pSourceEntry->getFileOffset(), SEEK_SET) != 0) {
result = UNKNOWN_ERROR;
goto bail;
}
@@ -712,7 +692,7 @@
result = NO_MEMORY;
goto bail;
}
- long startPosn = ftell(mZipFp);
+ off_t startPosn = ftello(mZipFp);
uint32_t crc;
if (compressFpToFp(mZipFp, NULL, buf, uncompressedLen, &crc) != OK) {
ALOGW("recompress of '%s' failed\n", pEntry->mCDE.mFileName);
@@ -720,13 +700,12 @@
free(buf);
goto bail;
}
- long endPosn = ftell(mZipFp);
+ off_t endPosn = ftello(mZipFp);
pEntry->setDataInfo(uncompressedLen, endPosn - startPosn,
pSourceEntry->getCRC32(), ZipEntry::kCompressDeflated);
free(buf);
} else {
- off_t copyLen;
- copyLen = pSourceEntry->getCompressedLen();
+ off_t copyLen = pSourceEntry->getCompressedLen();
if ((pSourceEntry->mLFH.mGPBitFlag & ZipEntry::kUsesDataDescr) != 0)
copyLen += ZipEntry::kDataDescriptorLen;
@@ -746,12 +725,12 @@
mEOCD.mNumEntries++;
mEOCD.mTotalNumEntries++;
mEOCD.mCentralDirSize = 0; // mark invalid; set by flush()
- mEOCD.mCentralDirOffset = ftell(mZipFp);
+ mEOCD.mCentralDirOffset = ftello(mZipFp);
/*
* Go back and write the LFH.
*/
- if (fseek(mZipFp, lfhPosn, SEEK_SET) != 0) {
+ if (fseeko(mZipFp, lfhPosn, SEEK_SET) != 0) {
result = UNKNOWN_ERROR;
goto bail;
}
@@ -978,7 +957,7 @@
status_t ZipFile::flush(void)
{
status_t result = OK;
- long eocdPosn;
+ off_t eocdPosn;
int i, count;
if (mReadOnly)
@@ -992,8 +971,7 @@
if (result != OK)
return result;
- if (fseek(mZipFp, mEOCD.mCentralDirOffset, SEEK_SET) != 0)
- return UNKNOWN_ERROR;
+ if (fseeko(mZipFp, mEOCD.mCentralDirOffset, SEEK_SET) != 0) return UNKNOWN_ERROR;
count = mEntries.size();
for (i = 0; i < count; i++) {
@@ -1001,7 +979,7 @@
pEntry->mCDE.write(mZipFp);
}
- eocdPosn = ftell(mZipFp);
+ eocdPosn = ftello(mZipFp);
mEOCD.mCentralDirSize = eocdPosn - mEOCD.mCentralDirOffset;
mEOCD.write(mZipFp);
@@ -1011,8 +989,8 @@
* with plain files, or if we deleted some entries, there's a lot
* of wasted space at the end of the file. Remove it now.
*/
- if (ftruncate(fileno(mZipFp), ftell(mZipFp)) != 0) {
- ALOGW("ftruncate failed %ld: %s\n", ftell(mZipFp), strerror(errno));
+ if (ftruncate(fileno(mZipFp), ftello(mZipFp)) != 0) {
+ ALOGW("ftruncate failed %lld: %s\n", (long long) ftello(mZipFp), strerror(errno));
// not fatal
}
@@ -1141,32 +1119,32 @@
if (getSize > n)
getSize = n;
- if (fseek(fp, (long) src, SEEK_SET) != 0) {
- ALOGW("filemove src seek %ld failed, %s",
- (long) src, strerror(errno));
+ if (fseeko(fp, src, SEEK_SET) != 0) {
+ ALOGW("filemove src seek %lld failed, %s",
+ (long long) src, strerror(errno));
return UNKNOWN_ERROR;
}
if (fread(readBuf, 1, getSize, fp) != getSize) {
if (feof(fp)) {
- ALOGW("fread %zu bytes off=%ld failed, unexpected EOF",
- getSize, (long) src);
+ ALOGW("fread %zu bytes off=%lld failed, unexpected EOF",
+ getSize, (long long) src);
} else {
- ALOGW("fread %zu bytes off=%ld failed, %s",
- getSize, (long) src, strerror(errno));
+ ALOGW("fread %zu bytes off=%lld failed, %s",
+ getSize, (long long) src, strerror(errno));
}
return UNKNOWN_ERROR;
}
- if (fseek(fp, (long) dst, SEEK_SET) != 0) {
- ALOGW("filemove dst seek %ld failed, %s",
- (long) dst, strerror(errno));
+ if (fseeko(fp, dst, SEEK_SET) != 0) {
+ ALOGW("filemove dst seek %lld failed, %s",
+ (long long) dst, strerror(errno));
return UNKNOWN_ERROR;
}
if (fwrite(readBuf, 1, getSize, fp) != getSize) {
- ALOGW("filemove write %zu off=%ld failed, %s",
- getSize, (long) dst, strerror(errno));
+ ALOGW("filemove write %zu off=%lld failed, %s",
+ getSize, (long long) dst, strerror(errno));
return UNKNOWN_ERROR;
}
@@ -1263,10 +1241,10 @@
bool ReadAtOffset(uint8_t* buf, size_t len, off64_t offset) const {
// Data is usually requested sequentially, so this helps avoid pointless
- // fseeks every time we perform a read. There's an impedence mismatch
+ // seeks every time we perform a read. There's an impedence mismatch
// here because the original API was designed around pread and pwrite.
if (offset != current_offset_) {
- if (fseek(fp_, offset, SEEK_SET) != 0) {
+ if (fseeko(fp_, offset, SEEK_SET) != 0) {
return false;
}
@@ -1298,10 +1276,10 @@
return NULL;
}
- fseek(mZipFp, 0, SEEK_SET);
+ fseeko(mZipFp, 0, SEEK_SET);
off_t offset = entry->getFileOffset();
- if (fseek(mZipFp, offset, SEEK_SET) != 0) {
+ if (fseeko(mZipFp, offset, SEEK_SET) != 0) {
goto bail;
}
diff --git a/tools/ziptime/ZipEntry.cpp b/tools/ziptime/ZipEntry.cpp
index e7b52ed..c8eb377 100644
--- a/tools/ziptime/ZipEntry.cpp
+++ b/tools/ziptime/ZipEntry.cpp
@@ -43,19 +43,16 @@
*/
status_t ZipEntry::initAndRewriteFromCDE(FILE* fp)
{
- status_t result;
- long posn;
-
/* read the CDE */
- result = mCDE.rewrite(fp);
+ status_t result = mCDE.rewrite(fp);
if (result != 0) {
LOG("mCDE.rewrite failed\n");
return result;
}
/* using the info in the CDE, go load up the LFH */
- posn = ftell(fp);
- if (fseek(fp, mCDE.mLocalHeaderRelOffset, SEEK_SET) != 0) {
+ off_t posn = ftello(fp);
+ if (fseeko(fp, mCDE.mLocalHeaderRelOffset, SEEK_SET) != 0) {
LOG("local header seek failed (%" PRIu32 ")\n",
mCDE.mLocalHeaderRelOffset);
return -1;
@@ -67,7 +64,7 @@
return result;
}
- if (fseek(fp, posn, SEEK_SET) != 0)
+ if (fseeko(fp, posn, SEEK_SET) != 0)
return -1;
return 0;
diff --git a/tools/ziptime/ZipFile.cpp b/tools/ziptime/ZipFile.cpp
index 1d111af..3002a65 100644
--- a/tools/ziptime/ZipFile.cpp
+++ b/tools/ziptime/ZipFile.cpp
@@ -40,8 +40,7 @@
/* open the file */
mZipFp = fopen(zipFileName, "r+b");
if (mZipFp == NULL) {
- int err = errno;
- LOG("fopen failed: %d\n", err);
+ LOG("fopen \"%s\" failed: %s\n", zipFileName, strerror(errno));
return -1;
}
@@ -72,52 +71,39 @@
*/
status_t ZipFile::rewriteCentralDir(void)
{
- status_t result = 0;
- uint8_t* buf = NULL;
- off_t fileLength, seekStart;
- long readAmount;
- int i;
-
- fseek(mZipFp, 0, SEEK_END);
- fileLength = ftell(mZipFp);
+ fseeko(mZipFp, 0, SEEK_END);
+ off_t fileLength = ftello(mZipFp);
rewind(mZipFp);
/* too small to be a ZIP archive? */
if (fileLength < EndOfCentralDir::kEOCDLen) {
- LOG("Length is %ld -- too small\n", (long)fileLength);
- result = -1;
- goto bail;
+ LOG("Length is %lld -- too small\n", (long long) fileLength);
+ return -1;
}
- buf = new uint8_t[EndOfCentralDir::kMaxEOCDSearch];
- if (buf == NULL) {
- LOG("Failure allocating %d bytes for EOCD search",
- EndOfCentralDir::kMaxEOCDSearch);
- result = -1;
- goto bail;
- }
-
+ off_t seekStart;
+ size_t readAmount;
if (fileLength > EndOfCentralDir::kMaxEOCDSearch) {
seekStart = fileLength - EndOfCentralDir::kMaxEOCDSearch;
readAmount = EndOfCentralDir::kMaxEOCDSearch;
} else {
seekStart = 0;
- readAmount = (long) fileLength;
+ readAmount = fileLength;
}
- if (fseek(mZipFp, seekStart, SEEK_SET) != 0) {
- LOG("Failure seeking to end of zip at %ld", (long) seekStart);
- result = -1;
- goto bail;
+ if (fseeko(mZipFp, seekStart, SEEK_SET) != 0) {
+ LOG("Failure seeking to end of zip at %lld", (long long) seekStart);
+ return -1;
}
/* read the last part of the file into the buffer */
- if (fread(buf, 1, readAmount, mZipFp) != (size_t) readAmount) {
- LOG("short file? wanted %ld\n", readAmount);
- result = -1;
- goto bail;
+ uint8_t buf[EndOfCentralDir::kMaxEOCDSearch];
+ if (fread(buf, 1, readAmount, mZipFp) != readAmount) {
+ LOG("short file? wanted %zu\n", readAmount);
+ return -1;
}
/* find the end-of-central-dir magic */
+ int i;
for (i = readAmount - 4; i >= 0; i--) {
if (buf[i] == 0x50 &&
ZipEntry::getLongLE(&buf[i]) == EndOfCentralDir::kSignature)
@@ -127,15 +113,14 @@
}
if (i < 0) {
LOG("EOCD not found, not Zip\n");
- result = -1;
- goto bail;
+ return -1;
}
/* extract eocd values */
- result = mEOCD.readBuf(buf + i, readAmount - i);
+ status_t result = mEOCD.readBuf(buf + i, readAmount - i);
if (result != 0) {
- LOG("Failure reading %ld bytes of EOCD values", readAmount - i);
- goto bail;
+ LOG("Failure reading %zu bytes of EOCD values", readAmount - i);
+ return result;
}
/*
@@ -152,49 +137,39 @@
* The only thing we really need right now is the file comment, which
* we're hoping to preserve.
*/
- if (fseek(mZipFp, mEOCD.mCentralDirOffset, SEEK_SET) != 0) {
+ if (fseeko(mZipFp, mEOCD.mCentralDirOffset, SEEK_SET) != 0) {
LOG("Failure seeking to central dir offset %" PRIu32 "\n",
mEOCD.mCentralDirOffset);
- result = -1;
- goto bail;
+ return -1;
}
/*
* Loop through and read the central dir entries.
*/
- int entry;
- for (entry = 0; entry < mEOCD.mTotalNumEntries; entry++) {
+ for (int entry = 0; entry < mEOCD.mTotalNumEntries; entry++) {
ZipEntry* pEntry = new ZipEntry;
-
result = pEntry->initAndRewriteFromCDE(mZipFp);
+ delete pEntry;
if (result != 0) {
LOG("initFromCDE failed\n");
- delete pEntry;
- goto bail;
+ return -1;
}
-
- delete pEntry;
}
-
/*
* If all went well, we should now be back at the EOCD.
*/
uint8_t checkBuf[4];
if (fread(checkBuf, 1, 4, mZipFp) != 4) {
LOG("EOCD check read failed\n");
- result = -1;
- goto bail;
+ return -1;
}
if (ZipEntry::getLongLE(checkBuf) != EndOfCentralDir::kSignature) {
LOG("EOCD read check failed\n");
- result = -1;
- goto bail;
+ return -1;
}
-bail:
- delete[] buf;
- return result;
+ return 0;
}
/*