Apply any patches for the Recipe. .. versionchanged:: 0.6.0 Add ability to apply patches from any dir via kwarg `build_dir`
(self, arch, build_dir=None)
| 559 | return exists(join(build_dir, '.patched')) |
| 560 | |
| 561 | def apply_patches(self, arch, build_dir=None): |
| 562 | '''Apply any patches for the Recipe. |
| 563 | |
| 564 | .. versionchanged:: 0.6.0 |
| 565 | Add ability to apply patches from any dir via kwarg `build_dir`''' |
| 566 | if self.patches: |
| 567 | info_main('Applying patches for {}[{}]' |
| 568 | .format(self.name, arch.arch)) |
| 569 | |
| 570 | if self.is_patched(arch): |
| 571 | info_main('{} already patched, skipping'.format(self.name)) |
| 572 | return |
| 573 | |
| 574 | build_dir = build_dir if build_dir else self.get_build_dir(arch.arch) |
| 575 | for patch in self.patches: |
| 576 | if isinstance(patch, (tuple, list)): |
| 577 | patch, patch_check = patch |
| 578 | if not patch_check(arch=arch, recipe=self): |
| 579 | continue |
| 580 | |
| 581 | self.apply_patch( |
| 582 | patch.format(version=self.version, arch=arch.arch), |
| 583 | arch.arch, build_dir=build_dir) |
| 584 | |
| 585 | touch(join(build_dir, '.patched')) |
| 586 | |
| 587 | def should_build(self, arch): |
| 588 | '''Should perform any necessary test and return True only if it needs |
no test coverage detected