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

Improve error handling. am: 1c3a4f46

am: 26ec9bd8

Change-Id: Id0661717e117fb4dedf2af9f9048300cfe8122c4
parents 9c44cc08 26ec9bd8
No related branches found
No related tags found
No related merge requests found
......@@ -118,5 +118,7 @@ class GithubArchiveUpdater():
self._write_metadata(latest_url, package_dir)
updater_utils.replace_package(package_dir, self.proj_path)
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()
......@@ -15,36 +15,50 @@
# limitations under the License.
# This script is used by external_updater to replace a package. Don't
# invoke directly
cd $1
# Copies all files we want to reserve.
cp -a -n $2/Android.bp $1/ 2> /dev/null
cp -a -n $2/Android.mk $1/ 2> /dev/null
cp -a -n $2/LICENSE $1/ 2> /dev/null
cp -a -n $2/NOTICE $1/ 2> /dev/null
cp -a -n $2/MODULE_LICENSE_* $1/ 2> /dev/null
cp -a -n $2/METADATA $1/ 2> /dev/null
cp -a -n $2/.git $1/ 2> /dev/null
cp -a -n $2/.gitignore $1/ 2> /dev/null
cp -a -n $2/patches $1/ 2> /dev/null
cp -a -n $2/post_update.sh $1/ 2> /dev/null
# Applies all patches
for p in $1/patches/*.diff
# invoke directly.
set -e
tmp_dir=$1
external_dir=$2
echo "Entering $tmp_dir..."
cd $tmp_dir
function CopyIfPresent() {
if [ -e $external_dir/$1 ]; then
cp -a -n $external_dir/$1 .
fi
}
echo "Copying preserved files..."
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
[ -e "$p" ] || continue
echo Applying $p
patch -p1 -d $1 < $p;
echo "Applying $p..."
patch -p1 -d $tmp_dir < $p;
done
if [ -f $1/post_update.sh ]
if [ -f $tmp_dir/post_update.sh ]
then
echo Running post update script
$1/post_update.sh $1 $2
echo "Running post update script"
$tmp_dir/post_update.sh $tmp_dir $external_dir
fi
# Swap old and new.
rm -rf $2
mv $1 $2
echo "Swapping old and new..."
rm -rf $external_dir
mv $tmp_dir $external_dir
exit 0
......@@ -14,6 +14,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
set -e
cd $(dirname "$0")/../..
source build/envsetup.sh
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