blob: 8c63d9c1632d037ff7b76a6c96eb6a80dde0b8ab [file] [log] [blame]
Steve Kondikd4801a22013-05-13 18:43:44 -07001# Copyright (C) 2009 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15import common
16import re
17import os
18
19TARGET_DIR = os.getenv('OUT')
20
21def FullOTA_Assertions(info):
22 AddBootloaderAssertion(info, info.input_zip)
23
24
25def IncrementalOTA_Assertions(info):
26 AddBootloaderAssertion(info, info.target_zip)
27
28
29def AddBootloaderAssertion(info, input_zip):
30 android_info = input_zip.read("OTA/android-info.txt")
31 m = re.search(r"require\s+version-bootloader\s*=\s*(\S+)", android_info)
32 if m:
33 bootloaders = m.group(1).split("|")
34 if "*" not in bootloaders:
35 info.script.AssertSomeBootloader(*bootloaders)
36 info.metadata["pre-bootloader"] = m.group(1)
37