Steve Kondik | d4801a2 | 2013-05-13 18:43:44 -0700 | [diff] [blame^] | 1 | # 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 | |
| 15 | import common |
| 16 | import re |
| 17 | import os |
| 18 | |
| 19 | TARGET_DIR = os.getenv('OUT') |
| 20 | |
| 21 | def FullOTA_Assertions(info): |
| 22 | AddBootloaderAssertion(info, info.input_zip) |
| 23 | |
| 24 | |
| 25 | def IncrementalOTA_Assertions(info): |
| 26 | AddBootloaderAssertion(info, info.target_zip) |
| 27 | |
| 28 | |
| 29 | def 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 | |