Skip to content
Snippets Groups Projects
Commit 75484e52 authored by Elliott Hughes's avatar Elliott Hughes Committed by android-build-merger
Browse files

Improve error handling. am: 1c3a4f46 am: 26ec9bd8 am: 4d49d279

am: 0d67f5f8

Change-Id: I2f75b467bce834c6bcda829cdf1d26c6ee5f999f
parents 2a248f6c 0d67f5f8
No related branches found
No related tags found
No related merge requests found
...@@ -118,5 +118,7 @@ class GithubArchiveUpdater(): ...@@ -118,5 +118,7 @@ class GithubArchiveUpdater():
self._write_metadata(latest_url, package_dir) self._write_metadata(latest_url, package_dir)
updater_utils.replace_package(package_dir, self.proj_path) updater_utils.replace_package(package_dir, self.proj_path)
finally: finally:
shutil.rmtree(temporary_dir, ignore_errors=True) # Don't remove the temporary directory, or it'll be impossible
# to debug the failure...
# shutil.rmtree(temporary_dir, ignore_errors=True)
urllib.request.urlcleanup() urllib.request.urlcleanup()
...@@ -15,36 +15,50 @@ ...@@ -15,36 +15,50 @@
# limitations under the License. # limitations under the License.
# This script is used by external_updater to replace a package. Don't # This script is used by external_updater to replace a package. Don't
# invoke directly # invoke directly.
cd $1 set -e
# Copies all files we want to reserve. tmp_dir=$1
cp -a -n $2/Android.bp $1/ 2> /dev/null external_dir=$2
cp -a -n $2/Android.mk $1/ 2> /dev/null
cp -a -n $2/LICENSE $1/ 2> /dev/null echo "Entering $tmp_dir..."
cp -a -n $2/NOTICE $1/ 2> /dev/null cd $tmp_dir
cp -a -n $2/MODULE_LICENSE_* $1/ 2> /dev/null
cp -a -n $2/METADATA $1/ 2> /dev/null function CopyIfPresent() {
cp -a -n $2/.git $1/ 2> /dev/null if [ -e $external_dir/$1 ]; then
cp -a -n $2/.gitignore $1/ 2> /dev/null cp -a -n $external_dir/$1 .
cp -a -n $2/patches $1/ 2> /dev/null fi
cp -a -n $2/post_update.sh $1/ 2> /dev/null }
# Applies all patches echo "Copying preserved files..."
for p in $1/patches/*.diff CopyIfPresent "Android.bp"
CopyIfPresent "Android.mk"
CopyIfPresent "LICENSE"
CopyIfPresent "NOTICE"
cp -a -f -n $external_dir/MODULE_LICENSE_* .
CopyIfPresent "METADATA"
CopyIfPresent ".git"
CopyIfPresent ".gitignore"
CopyIfPresent "patches"
CopyIfPresent "post_update.sh"
echo "Applying patches..."
for p in $tmp_dir/patches/*.diff
do do
[ -e "$p" ] || continue [ -e "$p" ] || continue
echo Applying $p echo "Applying $p..."
patch -p1 -d $1 < $p; patch -p1 -d $tmp_dir < $p;
done done
if [ -f $1/post_update.sh ] if [ -f $tmp_dir/post_update.sh ]
then then
echo Running post update script echo "Running post update script"
$1/post_update.sh $1 $2 $tmp_dir/post_update.sh $tmp_dir $external_dir
fi fi
# Swap old and new. echo "Swapping old and new..."
rm -rf $2 rm -rf $external_dir
mv $1 $2 mv $tmp_dir $external_dir
exit 0
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
set -e
cd $(dirname "$0")/../.. cd $(dirname "$0")/../..
source build/envsetup.sh source build/envsetup.sh
lunch aosp_arm-eng lunch aosp_arm-eng
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment