am 15604b84
: use imgdiff -z to diff zipfiles
Merge commit '15604b84e246514da6c9721266919003f734380b' into eclair-plus-aosp * commit '15604b84e246514da6c9721266919003f734380b': use imgdiff -z to diff zipfiles
This commit is contained in:
@@ -481,6 +481,15 @@ def GetRecoveryAPIVersion(zip):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
DIFF_METHOD_BY_EXT = {
|
||||||
|
".gz" : "imgdiff",
|
||||||
|
".zip" : ["imgdiff", "-z"],
|
||||||
|
".jar" : ["imgdiff", "-z"],
|
||||||
|
".apk" : ["imgdiff", "-z"],
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip):
|
def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip):
|
||||||
source_version = GetRecoveryAPIVersion(source_zip)
|
source_version = GetRecoveryAPIVersion(source_zip)
|
||||||
|
|
||||||
@@ -526,9 +535,8 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip):
|
|||||||
verbatim_targets.append((fn, tf.size))
|
verbatim_targets.append((fn, tf.size))
|
||||||
elif tf.sha1 != sf.sha1:
|
elif tf.sha1 != sf.sha1:
|
||||||
# File is different; consider sending as a patch
|
# File is different; consider sending as a patch
|
||||||
diff_method = "bsdiff"
|
ext = os.path.splitext(tf.name)[1]
|
||||||
if tf.name.endswith(".gz"):
|
diff_method = DIFF_METHOD_BY_EXT.get(ext, "bsdiff")
|
||||||
diff_method = "imgdiff"
|
|
||||||
d = Difference(tf, sf, diff_method)
|
d = Difference(tf, sf, diff_method)
|
||||||
if d is not None:
|
if d is not None:
|
||||||
print fn, tf.size, len(d), (float(len(d)) / tf.size)
|
print fn, tf.size, len(d), (float(len(d)) / tf.size)
|
||||||
|
Reference in New Issue
Block a user