Merge "mkbootimg: use int for os_version and os_patch_level"
This commit is contained in:
commit
adbe06db48
1 changed files with 5 additions and 5 deletions
|
|
@ -102,12 +102,12 @@ def parse_int(x):
|
||||||
def parse_os_version(x):
|
def parse_os_version(x):
|
||||||
match = re.search(r'^(\d{1,3})(?:\.(\d{1,3})(?:\.(\d{1,3}))?)?', x)
|
match = re.search(r'^(\d{1,3})(?:\.(\d{1,3})(?:\.(\d{1,3}))?)?', x)
|
||||||
if match:
|
if match:
|
||||||
a = parse_int(match.group(1))
|
a = int(match.group(1))
|
||||||
b = c = 0
|
b = c = 0
|
||||||
if match.lastindex >= 2:
|
if match.lastindex >= 2:
|
||||||
b = parse_int(match.group(2))
|
b = int(match.group(2))
|
||||||
if match.lastindex == 3:
|
if match.lastindex == 3:
|
||||||
c = parse_int(match.group(3))
|
c = int(match.group(3))
|
||||||
# 7 bits allocated for each field
|
# 7 bits allocated for each field
|
||||||
assert a < 128
|
assert a < 128
|
||||||
assert b < 128
|
assert b < 128
|
||||||
|
|
@ -118,8 +118,8 @@ def parse_os_version(x):
|
||||||
def parse_os_patch_level(x):
|
def parse_os_patch_level(x):
|
||||||
match = re.search(r'^(\d{4})-(\d{2})-(\d{2})', x)
|
match = re.search(r'^(\d{4})-(\d{2})-(\d{2})', x)
|
||||||
if match:
|
if match:
|
||||||
y = parse_int(match.group(1)) - 2000
|
y = int(match.group(1)) - 2000
|
||||||
m = parse_int(match.group(2))
|
m = int(match.group(2))
|
||||||
# 7 bits allocated for the year, 4 bits for the month
|
# 7 bits allocated for the year, 4 bits for the month
|
||||||
assert y >= 0 and y < 128
|
assert y >= 0 and y < 128
|
||||||
assert m > 0 and m <= 12
|
assert m > 0 and m <= 12
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue