mirror of
https://github.com/odoo/runbot.git
synced 2025-03-27 13:25:47 +07:00
[FIX] runbot_merge: tarfile deprecation warning
Starting in 3.12 `TarFile.extact(all)` can take a `filter` parameter which alters the behaviour of the extractor as it relates to the application of tar metadata. Not passing this parameter is deprecated unless the also new `TarFile.extraction_filter` attribute is set. Now there are a few wrinkles here: 1. Both parameter and attributes were added in older patch releases e.g. 3.9.17 and 3.10.12 and 3.11.4. 2. The attribute form will *not* resolve string filters, it needs the callables. As such just to be on the safe side of things set the attribute using a `getattr`, in releases with the feature it will be set to a proper value (the future default which ignores most or all metadata from the archive), and in releases without it just sets the attribute to `None` which should do no harm.
This commit is contained in:
parent
3c88e033f6
commit
751154514a
@ -403,6 +403,7 @@ class Patch(models.Model):
|
|||||||
if read:
|
if read:
|
||||||
out = stack.enter_context(archiver.archive(parent, *read))
|
out = stack.enter_context(archiver.archive(parent, *read))
|
||||||
tf = stack.enter_context(tarfile.open(fileobj=out.stdout, mode='r|'))
|
tf = stack.enter_context(tarfile.open(fileobj=out.stdout, mode='r|'))
|
||||||
|
tf.extraction_filter = getattr(tarfile, 'data_filter', None)
|
||||||
tf.extractall(tmpdir)
|
tf.extractall(tmpdir)
|
||||||
patch = subprocess.run(
|
patch = subprocess.run(
|
||||||
['patch', f'-p{prefix}', '--directory', tmpdir, '--verbose'],
|
['patch', f'-p{prefix}', '--directory', tmpdir, '--verbose'],
|
||||||
|
Loading…
Reference in New Issue
Block a user