aboutsummaryrefslogtreecommitdiff
path: root/sync2git-ara-mdk.py
blob: b79bd908c41200819ecdd01848ab787fcdcd66d6 (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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env python
#
# This is simple adhoc script to mirror public branch(es) of
# public projects from projectara-git.linaro.org to git-ara-mdk.linaro.org
# It is intended to run on projectara-git, at the root of project tree
# (/srv/repositories).
#
from __future__ import print_function
import sys
import os
import urllib
import time

# We mirror projects one-to-one, projectara-spiral2-5.0.0 and projectara-5.1 branch,
# unless spcified otherwise in this dict.
exceptions = {
    "platform/manifest.git": None,
    "platform/external/sepolicy.git": {"branches": ["projectara-spiral2-5.0.0"]},
    "platform/hardware/ara/endod.git": {"branches": ["master"]},
    "boot/u-boot-ara.git": {"branches": ["v2014.10-ara"]},
    "external/i2c-tools.git": {"branches": ["master"] },
    "kernel/pxa1928.git": {"repo": "marvell/vendor/marvell/ose/mrvl-3.10.git", "branches": ["projectara-spiral2-5.0.0-v3", "projectara-5.1" ] },
    "vendor/marvell/generic/graphics/driver.git": {"repo": "marvell/vendor/marvell/generic/graphics/driver5x.git", "branches": [ "projectara-5.1" ] },
    "vendor/google/ara.git": {"repo": "vendor/google/ara.git", "branches": [ "master" ] },
}
push_opts = "-q --force"


top_dir = os.getcwd()

#print(time.asctime())

#for p in open(sys.argv[1]):
# Get list of projects from git-ara-mdk.*, as provided by gitweb.
for p in urllib.urlopen("https://git-ara-mdk.linaro.org/?a=project_index"):
    src_p = p = p.strip()
    #print(p)
    branches = ["projectara-spiral2-5.0.0", "projectara-5.1"]
    if p in exceptions:
        if exceptions[p] is None:
            continue
        src_p = exceptions[p].get("repo", p)
        branches = exceptions[p].get("branches", branches)
    try:
        #print(src_p)
        os.chdir(src_p)
        for branch in branches:
            cmd = "git push %s ssh://git@git-ara-mdk.linaro.org/%s %s" % (push_opts, p, branch)
            #print(cmd)
            os.system(cmd)
    except Exception as e:
        print("%s: %s" % (p, e))
    finally:
        os.chdir(top_dir)