aboutsummaryrefslogtreecommitdiff
path: root/toolchain-tools
blob: 75f624a47fc233ef418e31593681c4318a15975e (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#!/bin/bash
#
# This script is used to sync the upstream gcc repository, plus a series of
# other related toolchain repositories.
#
# It is highly dependant on the git setup Linaro has on its server. Setup that
# is done with gitolite and gitweb.
#
# How the mirrorin has been done:
# - mirrorin happens in /srv/mirror on the server
# - depending on the mirror type, we can create a git-svn clone in a separate
#   directory, add a new remote on the "original" repo, and then make sure
#   everything is pushed to the real bare repo.
#
# For more info: https://wiki.linaro.org/Platform/LAVA/Infrastructure/ToolchainsMirror
#

GITOLITE_BIN="/home/git/bin/gitolite"
REPOSITORIES_DIR="/srv/repositories"
TOOLCHAIN_DIR="$REPOSITORIES_DIR/toolchain"
GCC_REPO="$TOOLCHAIN_DIR/gcc.git"
BINUTILS_GDB_REPO="$TOOLCHAIN_DIR/binutils-gdb.git"
MIRROR_DIR="/srv/mirror"
GCC_MIRROR_DIR="$MIRROR_DIR/gcc.git/"
BZR_BRANCH="bzr/linaro-4.7-branch"
UPSTREAM_48_BRANCH="4.8-branch"
UPSTREAM_47_BRANCH="4.7-branch"
SVN_UPSTREAM_48_BRANCH="$MIRROR_DIR/linaro-gcc-4_8-branch"
SVN_UPSTREAM_47_BRANCH="$MIRROR_DIR/gcc-4_7-branch"
SVN_UPSTREAM_49_BRANCH="$MIRROR_DIR/linaro-gcc-4_9-branch"
LINARO_UPSTREAM_48_BRANCH="linaro-4.8-branch"
LINARO_UPSTREAM_49_BRANCH="linaro-4.9-branch"


function push_changes() {
    cd $GCC_MIRROR_DIR
    # gitolite, not git, this is important since the push has to happen on the
    # local filesystem and the repository is controlled by gitolite.
    $GITOLITE_BIN push --all 2>&1 > /dev/null
    $GITOLITE_BIN push --tags 2>&1 > /dev/null
}

function update_server_info() {
    git --git-dir=$GCC_REPO update-server-info
}

function update_bzr_branch() {
    cd $GCC_MIRROR_DIR
    git bzr sync $BZR_BRANCH 2>&1 > /dev/null
    push_changes
    update_server_info
}

function update_upstream_48_branch() {
    cd $GCC_MIRROR_DIR
    git checkout $UPSTREAM_48_BRANCH 2>&1 > /dev/null
    git pull --rebase 2>&1 > /dev/null
    git checkout master 2>&1 > /dev/null
}

function update_linaro_upstream_48_branch() {
    cd $GCC_MIRROR_DIR
    git checkout $LINARO_UPSTREAM_48_BRANCH 2>&1 > /dev/null
    git pull --rebase 2>&1 > /dev/null
    git checkout master 2>&1 > /dev/null
}

function update_linaro_upstream_49_branch() {
    cd $GCC_MIRROR_DIR
    git checkout $LINARO_UPSTREAM_49_BRANCH 2>&1 > /dev/null
    git pull --rebase 2>&1 > /dev/null
    git checkout master 2>&1 > /dev/null
}

function update_svn_upstream_48_branch() {
    cd $SVN_UPSTREAM_48_BRANCH
    git svn rebase 2>&1 > /dev/null
}

function update_svn_upstream_47_branch() {
    cd $SVN_UPSTREAM_47_BRANCH
    git svn rebase 2>&1 > /dev/null
}

function update_svn_upstream_49_branch() {
    cd $SVN_UPSTREAM_49_BRANCH
    git svn rebase 2>&1 > /dev/null
}

function update_upstream_47_branch() {
    cd $GCC_MIRROR_DIR
    git checkout $UPSTREAM_47_BRANCH 2>&1 > /dev/null
    git pull --rebase 2>&1 > /dev/null
    git checkout master 2>&1 > /dev/null
}

function update_gcc_repo_remote() {
    cd $GCC_MIRROR_DIR
    git remote update 2>&1 > /dev/null
    git pull --all 2>&1 > /dev/null
}

function update_newlib_mirror() {
    cd $TOOLCHAIN_DIR/newlib.git
    git remote update 2>&1 > /dev/null
}

function update_glibc_mirror() {
    cd $TOOLCHAIN_DIR/glibc.git
    git remote update 2>&1 > /dev/null
}

function pull_git_changes() {
    update_svn_upstream_47_branch
    update_svn_upstream_48_branch
    update_svn_upstream_49_branch
    update_gcc_repo_remote

    update_upstream_47_branch
    update_upstream_48_branch
    update_linaro_upstream_48_branch
    update_linaro_upstream_49_branch

    push_changes
    update_server_info
}

function update_binutils_gdb() {
    cd $BINUTILS_GDB_REPO
    git remote update 2>&1 >/dev/null
    git update-server-info
}

function update_dejagnu_mirror() {
    cd "$MIRROR_DIR/dejagnu.git"
    git remote update 2>&1 > /dev/null && $GITOLITE_BIN push 2>&1 > /dev/null
}

function all() {
    update_bzr_branch
    pull_git_changes
    update_binutils_gdb
}

$@