summaryrefslogtreecommitdiff
path: root/scripts/check-clean-repos.py
blob: 2b50fd938b75ab182e48009efb8d64e6c072ef76 (plain)
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
#!/usr/bin/env python3

import os
import subprocess
import sys
from common import git


SCRIPTDIR = os.path.realpath(os.path.dirname(__file__))


if __name__ == "__main__":
    subprojects_dir = os.path.join(SCRIPTDIR, "..", "subprojects")
    exitcode = 0
    for repo_name in os.listdir(subprojects_dir):
        repo_dir = os.path.normpath(os.path.join(SCRIPTDIR, subprojects_dir, repo_name))
        if not os.path.exists(os.path.join(repo_dir, '.git')):
            continue

        diff = git('diff', repository_path=repo_dir).strip('\n')
        if diff:
            print('ERROR: Repository %s is not clean' % repo_dir)
            print('NOTE: Make sure to commit necessary changes in the gst_plugins_cache.json files')
            print(diff)
            exitcode += 1

    sys.exit(exitcode)