build: check patches on update (#23103)

This commit is contained in:
Shelley Vohr 2020-06-04 17:43:28 -07:00 committed by GitHub
parent a1c55a13e1
commit 9d960e29eb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 56 additions and 15 deletions

View file

@ -8,9 +8,9 @@ import sys
from lib import git
def export_patches(dirs):
def export_patches(dirs, dry_run):
for patch_dir, repo in dirs.iteritems():
git.export_patches(repo=repo, out_dir=patch_dir)
git.export_patches(repo=repo, out_dir=patch_dir, dry_run=dry_run)
def parse_args():
@ -18,13 +18,17 @@ def parse_args():
parser.add_argument('config', nargs='+',
type=argparse.FileType('r'),
help='patches\' config(s) in the JSON format')
parser.add_argument("-d", "--dry-run",
help="Checks whether the exported patches need to be updated.",
default=False, action='store_true')
return parser.parse_args()
def main():
configs = parse_args().config
dry_run = parse_args().dry_run
for config_json in configs:
export_patches(json.load(config_json))
export_patches(json.load(config_json), dry_run)
if __name__ == '__main__':