Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
halo
build
Commits
6937a447
Commit
6937a447
authored
12 years ago
by
Doug Zongker
Committed by
Android (Google) Code Review
12 years ago
Browse files
Options
Download
Plain Diff
Merge "load SYSTEM/build.prop into the info_dict" into jb-mr1-dev
parents
5ad1d7ec
1eb74dd9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
22 deletions
+40
-22
tools/releasetools/common.py
tools/releasetools/common.py
+16
-0
tools/releasetools/ota_from_target_files
tools/releasetools/ota_from_target_files
+24
-22
No files found.
tools/releasetools/common.py
View file @
6937a447
...
...
@@ -143,6 +143,22 @@ def LoadInfoDict(zip):
makeint
(
"boot_size"
)
d
[
"fstab"
]
=
LoadRecoveryFSTab
(
zip
)
d
[
"build.prop"
]
=
LoadBuildProp
(
zip
)
return
d
def
LoadBuildProp
(
zip
):
try
:
data
=
zip
.
read
(
"SYSTEM/build.prop"
)
except
KeyError
:
print
"Warning: could not find SYSTEM/build.prop in %s"
%
zip
data
=
""
d
=
{}
for
line
in
data
.
split
(
"
\n
"
):
line
=
line
.
strip
()
if
not
line
or
line
.
startswith
(
"#"
):
continue
name
,
value
=
line
.
split
(
"="
,
1
)
d
[
name
]
=
value
return
d
def
LoadRecoveryFSTab
(
zip
):
...
...
This diff is collapsed.
Click to expand it.
tools/releasetools/ota_from_target_files
View file @
6937a447
...
...
@@ -303,8 +303,8 @@ def SignOutput(temp_zip_name, output_zip_name):
whole_file
=
True
)
def
AppendAssertions
(
script
,
in
put_zip
):
device
=
GetBuildProp
(
"ro.product.device"
,
in
put_zip
)
def
AppendAssertions
(
script
,
in
fo_dict
):
device
=
GetBuildProp
(
"ro.product.device"
,
in
fo_dict
)
script
.
AssertDevice
(
device
)
...
...
@@ -358,9 +358,12 @@ def WriteFullOTAPackage(input_zip, output_zip):
# change very often.
script
=
edify_generator
.
EdifyGenerator
(
3
,
OPTIONS
.
info_dict
)
metadata
=
{
"post-build"
:
GetBuildProp
(
"ro.build.fingerprint"
,
input_zip
),
"pre-device"
:
GetBuildProp
(
"ro.product.device"
,
input_zip
),
"post-timestamp"
:
GetBuildProp
(
"ro.build.date.utc"
,
input_zip
),
metadata
=
{
"post-build"
:
GetBuildProp
(
"ro.build.fingerprint"
,
OPTIONS
.
info_dict
),
"pre-device"
:
GetBuildProp
(
"ro.product.device"
,
OPTIONS
.
info_dict
),
"post-timestamp"
:
GetBuildProp
(
"ro.build.date.utc"
,
OPTIONS
.
info_dict
),
}
device_specific
=
common
.
DeviceSpecificParams
(
...
...
@@ -373,10 +376,10 @@ def WriteFullOTAPackage(input_zip, output_zip):
info_dict
=
OPTIONS
.
info_dict
)
if
not
OPTIONS
.
omit_prereq
:
ts
=
GetBuildProp
(
"ro.build.date.utc"
,
input_zip
)
ts
=
GetBuildProp
(
"ro.build.date.utc"
,
OPTIONS
.
info_dict
)
script
.
AssertOlderBuild
(
ts
)
AppendAssertions
(
script
,
input_zip
)
AppendAssertions
(
script
,
OPTIONS
.
info_dict
)
device_specific
.
FullOTA_Assertions
()
device_specific
.
FullOTA_InstallBegin
()
...
...
@@ -446,16 +449,12 @@ def LoadSystemFiles(z):
return
out
def
GetBuildProp
(
property
,
z
):
"""Return the fingerprint of the build of a given target-files
ZipFile object."""
bp
=
z
.
read
(
"SYSTEM/build.prop"
)
if
not
property
:
return
bp
m
=
re
.
search
(
re
.
escape
(
property
)
+
r
"=(.*)\n"
,
bp
)
if
not
m
:
def
GetBuildProp
(
prop
,
info_dict
):
"""Return the fingerprint of the build of a given target-files info_dict."""
try
:
return
info_dict
.
get
(
"build.prop"
,
{})[
prop
]
except
KeyError
:
raise
common
.
ExternalError
(
"couldn't find %s in build.prop"
%
(
property
,))
return
m
.
group
(
1
).
strip
()
def
WriteIncrementalOTAPackage
(
target_zip
,
source_zip
,
output_zip
):
...
...
@@ -465,10 +464,13 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip):
if
source_version
==
0
:
print
(
"WARNING: generating edify script for a source that "
"can't install it."
)
script
=
edify_generator
.
EdifyGenerator
(
source_version
,
OPTIONS
.
target_info_dict
)
script
=
edify_generator
.
EdifyGenerator
(
source_version
,
OPTIONS
.
target_info_dict
)
metadata
=
{
"pre-device"
:
GetBuildProp
(
"ro.product.device"
,
source_zip
),
"post-timestamp"
:
GetBuildProp
(
"ro.build.date.utc"
,
target_zip
),
metadata
=
{
"pre-device"
:
GetBuildProp
(
"ro.product.device"
,
OPTIONS
.
source_info_dict
),
"post-timestamp"
:
GetBuildProp
(
"ro.build.date.utc"
,
OPTIONS
.
target_info_dict
),
}
device_specific
=
common
.
DeviceSpecificParams
(
...
...
@@ -522,8 +524,8 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip):
patch_list
.
append
((
tf
.
name
,
tf
,
sf
,
tf
.
size
,
common
.
sha1
(
d
).
hexdigest
()))
largest_source_size
=
max
(
largest_source_size
,
sf
.
size
)
source_fp
=
GetBuildProp
(
"ro.build.fingerprint"
,
source_zip
)
target_fp
=
GetBuildProp
(
"ro.build.fingerprint"
,
target_zip
)
source_fp
=
GetBuildProp
(
"ro.build.fingerprint"
,
OPTIONS
.
source_info_dict
)
target_fp
=
GetBuildProp
(
"ro.build.fingerprint"
,
OPTIONS
.
target_info_dict
)
metadata
[
"pre-build"
]
=
source_fp
metadata
[
"post-build"
]
=
target_fp
...
...
@@ -550,7 +552,7 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip):
# 0.1 for unpacking verbatim files, symlinking, and doing the
# device-specific commands.
AppendAssertions
(
script
,
target_zip
)
AppendAssertions
(
script
,
OPTIONS
.
target_info_dict
)
device_specific
.
IncrementalOTA_Assertions
()
script
.
Print
(
"Verifying current system..."
)
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment