aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2021-04-08 17:06:37 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2021-04-08 17:06:37 +0000
commitc4722aec2fe35cb3521a29e603f576a0f88ebb2f (patch)
treede0f9b381557d7ce6c91c3d254e7a9e77b3cb8ec
parentd808ac926a35576d43c8ffbc000f688cfc6f668b (diff)
parent7f57890e45256611855c97562969245ff7a1c50c (diff)
downloadexternal_updater-c4722aec2fe35cb3521a29e603f576a0f88ebb2f.tar.gz
Merge "Fixes for upgrading Rust crates" am: 7f57890e45
Original change: https://android-review.googlesource.com/c/platform/tools/external_updater/+/1664157 Change-Id: Ia4deaf5d498657dbbfbe9ee8fa7f4c11dd5b5401
-rw-r--r--update_package.sh16
1 files changed, 15 insertions, 1 deletions
diff --git a/update_package.sh b/update_package.sh
index 8e1592e..78addd4 100644
--- a/update_package.sh
+++ b/update_package.sh
@@ -58,13 +58,27 @@ then
fi
echo "Applying patches..."
-for p in $tmp_dir/patches/*.diff
+for p in $tmp_dir/patches/*.{diff,patch}
do
[ -e "$p" ] || continue
+ # Do not patch the Android.bp file, as we assume it will
+ # patch itself.
+ if [ -f $tmp_dir/Cargo.toml ]
+ then
+ [ "$(basename $p)" != "Android.bp.diff" ] || continue
+ [ "$(basename $p)" != "Android.bp.patch" ] || continue
+ fi
echo "Applying $p..."
patch -p1 -d $tmp_dir < $p;
done
+if [ -f $tmp_dir/Cargo.toml -a -f $tmp_dir/Android.bp ]
+then
+ # regenerate Android.bp after local patches, as they may
+ # have deleted files that it uses.
+ /bin/bash `dirname $0`/regen_bp.sh $root_dir $external_dir
+fi
+
if [ -f $tmp_dir/post_update.sh ]
then
echo "Running post update script"