external_updater.sh: Fix copying of .bp files
I2420f0ee1d38ec536449eff2640f6cd80aeee19b introduces
regressions for crates with more than one .bp file, or
not .bp file in subdirectories;
this change addresses these issues.
Test: tools/external_updater/update.sh external/rust/crate/pdl-compiler
Test: tools/external_updater/update.sh external/rust/crate/pdl-runtime
Change-Id: Id56f77975efaf63c09073cbd643f2d89c5e70b5e
diff --git a/update_package.sh b/update_package.sh
index 96c9680..38c0007 100644
--- a/update_package.sh
+++ b/update_package.sh
@@ -37,6 +37,7 @@
echo "Copying preserved files..."
CopyIfPresent "Android.mk"
+CopyIfPresent "Android.bp"
CopyIfPresent "CleanSpec.mk"
CopyIfPresent "LICENSE"
CopyIfPresent "NOTICE"
@@ -51,8 +52,10 @@
if compgen -G "$external_dir/cargo_embargo*"; then
cp -a -f --update=none $external_dir/cargo_embargo* .
fi
-if compgen -G "$external_dir/*.bp"; then
- cp -a -f --update=none $external_dir/**/*.bp .
+if compgen -G "$external_dir/**/*.bp"; then
+ pushd "$external_dir"
+ cp -a -f --update=none --parents **/*.bp "$tmp_dir"
+ popd
fi
CopyIfPresent "patches"
CopyIfPresent "post_update.sh"