mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-11-21 16:46:54 -08:00
patchupdate.py: Move logic to extract patches into separate function.
This commit is contained in:
parent
f30b0e34fb
commit
c0f9ca2ab5
34
debian/tools/patchupdate.py
vendored
34
debian/tools/patchupdate.py
vendored
@ -335,26 +335,28 @@ def get_wine_file(filename):
|
||||
result.flush() # shouldn't be necessary because the subprocess writes directly to the fd
|
||||
return result
|
||||
|
||||
def extract_patch(patchset, filename):
|
||||
"""Extract all changes to a specific file from a patchset."""
|
||||
p = tempfile.NamedTemporaryFile()
|
||||
m = hashlib.sha256()
|
||||
|
||||
for patch in patchset.patches:
|
||||
if patch.modified_file != filename:
|
||||
continue
|
||||
for chunk in patch.read_chunks():
|
||||
p.write(chunk)
|
||||
m.update(chunk)
|
||||
p.write("\n")
|
||||
m.update("\n")
|
||||
|
||||
p.flush()
|
||||
return (m.digest(), p)
|
||||
|
||||
def select_patches(all_patches, indices, filename):
|
||||
"""Create a temporary patch file for each patchset and calculate the checksum."""
|
||||
selected_patches = {}
|
||||
|
||||
for i in indices:
|
||||
p = tempfile.NamedTemporaryFile()
|
||||
m = hashlib.sha256()
|
||||
|
||||
for patch in all_patches[i].patches:
|
||||
if patch.modified_file != filename:
|
||||
continue
|
||||
for chunk in patch.read_chunks():
|
||||
p.write(chunk)
|
||||
m.update(chunk)
|
||||
p.write("\n")
|
||||
m.update("\n")
|
||||
|
||||
p.flush()
|
||||
selected_patches[i] = (m.digest(), p)
|
||||
|
||||
selected_patches[i] = extract_patch(all_patches[i], filename)
|
||||
return selected_patches
|
||||
|
||||
def verify_patch_order(all_patches, indices, filename, pool):
|
||||
|
Loading…
Reference in New Issue
Block a user