]> jfr.im git - irc/kvirc/KVIrc.git/blob - .travis-coverity-scan.py
Make macos dmg nightlies more orderable (#2560)
[irc/kvirc/KVIrc.git] / .travis-coverity-scan.py
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 kvirc/KVIrc to kvirc/coverity no more than once a day, with modified .travis.yml
5
6 # This script is shamelessly copied from znc/znc (I wrote that one first), but please keep them synchronized...
7
8 import datetime
9 import subprocess
10 import sys
11 import yaml
12
13 subprocess.check_call(['git remote add coverity github:kvirc/coverity.git'], shell=True)
14 subprocess.check_call(['git fetch coverity'], shell=True)
15 commits_today = subprocess.check_output(['git log --since=today.midnight --oneline coverity/coverity_scan || true'], shell=True)
16 if len(commits_today) > 0:
17 print('There were already commits today in coverity_scan')
18 sys.exit()
19
20 # Get "install:" from .travis.yml, the rest from .travis-coverity.yml
21 with open('.travis.yml') as f:
22 t = yaml.load(f)
23 with open('.travis-coverity.yml') as f:
24 c = yaml.load(f)
25 # Travis project of kvirc/coverity is not multi-os
26 c['install'] = ['export TRAVIS_OS_NAME=linux'] + t['install']
27
28 with open('.travis.yml', 'w') as f:
29 print(yaml.dump(c, default_flow_style=False), file=f)
30
31 subprocess.check_call(['git checkout -b coverity_scan'], shell=True)
32 subprocess.check_call(['git commit .travis.yml -m"Automatic coverity scan for {}"'.format(datetime.date.today())], shell=True)
33 subprocess.check_call(['git push coverity coverity_scan -f'], shell=True)