Handle symlinks consistently in extract-from-apex.
Address missed comments on https://r.android.com/1314060.
Test: m installclean && m build-art-target-golem
before and after CL, compare output of
`sha1sum out/target/product/armv8/system/*/* | sort -k2`
Bug: 152255951
Change-Id: Id529f27bc458f85bf3dc2cedc276dea7e9fbfb09
diff --git a/Android.mk b/Android.mk
index c46504e..9d76b2d 100644
--- a/Android.mk
+++ b/Android.mk
@@ -581,6 +581,9 @@
# root.
# $(1): APEX base name
# $(2): List of files to extract, with paths relative to the APEX root
+#
+# "cp -d" below doesn't work on Darwin, but this is only used for Golem builds
+# and won't run on mac anyway.
define extract-from-apex
apex_root=$(TARGET_OUT)/apex && \
apex_file=$$apex_root/$(1).apex && \
@@ -594,7 +597,7 @@
for f in $(2); do \
sf=$$apex_dir/$$f && \
df=$(TARGET_OUT)/$$f && \
- if [ -e $$sf ]; then \
+ if [ -f $$sf -o -h $$sf ]; then \
mkdir -p $$(dirname $$df) && \
cp -fd $$sf $$df; \
fi || exit 1; \