build: export matching patches (#41174)
* build: make patches/config.json an array of objects This file was previously an object of patch_dir keys to repo values; Now is an array of objects containing `patch_dir` and `repo` properties. This makes other per-target properties (e.g. `grep`) possible. * build: include Note metadata when exporting patches * build: support keyword filtering in export_patches() * build: add optional `--grep` arg to git-export-patches script * build: update export_all_patches to understand new config file * fixup! build: update export_all_patches to understand new config file chore: make lint happy * fixup! build: make patches/config.json an array of objects chore: fix oops * refactor: remove support for the old file format There is more code using config.json than I thought, so the effort-to-reward of supporting the old format is not worth it. * build: update apply_all_patches to understand new config file * build: update lint.js to understand new config file * build: update patches-mtime-cache.py to understand new config file * fixup! build: update apply_all_patches to understand new config file fix: oops * fixup! build: update apply_all_patches to understand new config file fix minor syntax wart * fixup! build: support keyword filtering in export_patches() refactor: use idiomatic python * refactor: warn if config.json has an invalid repo
This commit is contained in:
parent
4d060afc98
commit
b253d52faf
7 changed files with 75 additions and 48 deletions
|
@ -3,14 +3,27 @@
|
|||
import argparse
|
||||
import json
|
||||
import os
|
||||
import warnings
|
||||
|
||||
from lib import git
|
||||
|
||||
|
||||
def export_patches(dirs, dry_run):
|
||||
for patch_dir, repo in dirs.items():
|
||||
if os.path.exists(repo):
|
||||
git.export_patches(repo=repo, out_dir=patch_dir, dry_run=dry_run)
|
||||
def export_patches(target, dry_run):
|
||||
repo = target.get('repo')
|
||||
if not os.path.exists(repo):
|
||||
warnings.warn('repo not found: %s' % repo)
|
||||
return
|
||||
git.export_patches(
|
||||
dry_run=dry_run,
|
||||
grep=target.get('grep'),
|
||||
out_dir=target.get('patch_dir'),
|
||||
repo=repo
|
||||
)
|
||||
|
||||
|
||||
def export_config(config, dry_run):
|
||||
for target in config:
|
||||
export_patches(target, dry_run)
|
||||
|
||||
|
||||
def parse_args():
|
||||
|
@ -28,7 +41,7 @@ def main():
|
|||
configs = parse_args().config
|
||||
dry_run = parse_args().dry_run
|
||||
for config_json in configs:
|
||||
export_patches(json.load(config_json), dry_run)
|
||||
export_config(json.load(config_json), dry_run)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue