-
Notifications
You must be signed in to change notification settings - Fork 0
/
yast-update-patches
executable file
·38 lines (31 loc) · 1.11 KB
/
yast-update-patches
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/python3
import os
import shutil
import yaml
import argparse
from common import log, check_call
repos = yaml.safe_load("""
- git: yast-yast2
obs: yast2
- git: yast-network
obs: yast2-network
reference: 6854df49232e965e04b63e3a2ce9b8018dfad134
""")
path = os.path.dirname(__file__)
path_patches = os.path.join(path, "patches")
parser = argparse.ArgumentParser()
parser.add_argument("--commit", action="store_true")
options = parser.parse_args()
for repo in repos:
git = os.path.join(path, repo['git'])
obs = os.path.join(path, "obs", "home:pavlix:Networking", repo['obs'])
reference = repo.get("reference", "HEAD")
os.makedirs(path_patches, exist_ok=True)
patch = os.path.join(path_patches, "{obs}.patch".format(**repo))
with open(patch, "w") as stream:
check_call(["git", "diff", reference, "--"], cwd=git, stdout=stream)
if options.commit:
shutil.copy(patch, os.path.join(obs, "pavlix-changes.patch"))
check_call(["osc", "update"], cwd=obs)
check_call(["osc", "add", "pavlix-changes.patch"], cwd=obs)
check_call(["osc", "commit", "-n"], cwd=obs)