]>
Commit | Line | Data |
---|---|---|
96d9651e AS |
1 | #!/usr/bin/python3 |
2 | ||
3 | # https://scan.coverity.com/faq#frequency doesn't allow every push to be scanned. | |
4 | # So this script pushes znc/znc to znc/coverity no more than once a day, with modified .travis.yml | |
5 | ||
6 | import datetime | |
7 | import subprocess | |
8 | import sys | |
9 | import yaml | |
10 | ||
11 | subprocess.check_call(['git remote add coverity github:znc/coverity.git'], shell=True) | |
12 | subprocess.check_call(['git fetch coverity'], shell=True) | |
13 | commits_today = subprocess.check_output(['git log --since=today.midnight --oneline coverity/coverity_scan || true'], shell=True) | |
14 | if len(commits_today) > 0: | |
15 | print('There were already commits today in coverity_scan') | |
16 | sys.exit() | |
17 | ||
18 | # Get "install:" from .travis.yml, the rest from .travis-coverity.yml | |
19 | with open('.travis.yml') as f: | |
20 | t = yaml.load(f) | |
21 | with open('.travis-coverity.yml') as f: | |
22 | c = yaml.load(f) | |
23 | # Travis project of znc/coverity is not multi-os | |
24 | c['install'] = ['export TRAVIS_OS_NAME=linux'] + t['install'] | |
25 | ||
26 | with open('.travis.yml', 'w') as f: | |
27 | print(yaml.dump(c, default_flow_style=False), file=f) | |
28 | ||
29 | subprocess.check_call(['git checkout -b coverity_scan'], shell=True) | |
30 | subprocess.check_call(['git commit .travis.yml -m"Automatic coverity scan for {}"'.format(datetime.date.today())], shell=True) | |
31 | subprocess.check_call(['git push coverity coverity_scan -f'], shell=True) |