]> git.xonotic.org Git - xonotic/xonotic.git/blob - misc/tools/all/config.subr
Merge branch 'master' of git://de.git.xonotic.org/xonotic/xonotic
[xonotic/xonotic.git] / misc / tools / all / config.subr
1 devsite_url="http://dev.xonotic.org/"
2 pushsite_url="ssh://xonotic@push.git.xonotic.org/"
3 httppushsite_url="http://push.git.xonotic.org/login/xonotic/"
4 gitsite_url="git://git.xonotic.org/xonotic/"
5 httpsite_url="http://git.xonotic.org/xonotic/"
6
7 repos_urls="
8 .                             |                                                   | master         |
9 data/xonotic-data.pk3dir      |                                                   | master         |
10 data/xonotic-music.pk3dir     |                                                   | master         |
11 data/xonotic-nexcompat.pk3dir |                                                   | master         | no
12 darkplaces                    |                                                   | div0-stable    | svn
13 netradiant                    |                                                   | master         |
14 div0-gittools                 |                                                   | master         | no
15 d0_blind_id                   |                                                   | master         |
16 data/xonotic-maps.pk3dir      |                                                   | master         |
17 mediasource                   |                                                   | master         | no
18 fteqcc                        |                                                   | xonotic-stable | noautocrlf
19 "
20 # todo: in darkplaces, change repobranch to div0-stable
21
22 repos=`$ECHO "$repos_urls" | grep . | cut -d '|' -f 1 | tr -d ' '`
23
24 base=`git config remote.origin.url`
25 case "$base" in
26         */xonotic.git)
27                 base=${base%xonotic.git}
28                 ;;
29         *)
30                 $ECHO "The main repo is not xonotic.git, what have you done?"
31                 exit 1
32                 ;;
33 esac
34 pushbase=`git config remote.origin.pushurl || true`
35 case "$pushbase" in
36         */xonotic.git)
37                 pushbase=${pushbase%xonotic.git}
38                 ;;
39         '')
40                 ;;
41         *)
42                 $ECHO "The main repo is not xonotic.git, what have you done?"
43                 exit 1
44                 ;;
45 esac
46
47 repourl()
48 {
49         repo_t=`$ECHO "$repos_urls" | grep "^$1 " | cut -d '|' -f 2 | tr -d ' '`
50         if [ -n "$repo_t" ]; then
51                 case "$repo_t" in
52                         *://*)
53                                 $ECHO "$repo_t"
54                                 ;;
55                         *)
56                                 $ECHO "$base$repo_t"
57                                 ;;
58                 esac
59         else
60                 if [ x"$1" = x"." ]; then
61                         $ECHO "$base""xonotic.git"
62                 else
63                         $ECHO "$base${1##*/}.git"
64                 fi
65         fi
66 }
67
68 repopushurl()
69 {
70         [ -n "$pushbase" ] || return 0
71         repo_t=`$ECHO "$repos_urls" | grep "^$1 " | cut -d '|' -f 2 | tr -d ' '`
72         if [ -n "$repo_t" ]; then
73                 case "$repo_t" in
74                         *://*)
75                                 ;;
76                         *)
77                                 $ECHO "$pushbase$repo_t"
78                                 ;;
79                 esac
80         else
81                 if [ x"$1" = x"." ]; then
82                         $ECHO "$pushbase""xonotic.git"
83                 else
84                         $ECHO "$pushbase${1##*/}.git"
85                 fi
86         fi
87 }
88
89 repobranch()
90 {
91         repo_t=`$ECHO "$repos_urls" | grep "^$1 " | cut -d '|' -f 3 | tr -d ' '`
92         if [ -n "$repo_t" ]; then
93                 $ECHO "$repo_t"
94         else
95                 $ECHO "master"
96         fi
97 }
98
99 repoflags()
100 {
101         $ECHO "$repos_urls" | grep "^$1 " | cut -d '|' -f 4 | tr -d ' '
102 }
103
104 listrepos()
105 {
106         for d in $repos; do
107                 p="${d%dir}"
108                 f="`repoflags "$d"`"
109                 # if we have .no file, skip
110                 if [ -f "$d.no" ]; then
111                         msg "Repository $d disabled by a .no file, delete $d.no to enable"
112                         continue
113                 fi
114                 # if .yes file exists, always keep it
115                 if [ -f "$d.yes" ]; then
116                         msg "Repository $d enabled by a .yes file"
117                         $ECHO "$d"
118                         continue
119                 fi
120                 # remove broken clones so they don't mess up stuff
121                 if [ x"$d" != x"." ] && [ -d "$d" ] && ! [ -d "$d/.git" ]; then
122                         msg "$d exists but has no .git subdir. Probably a broken clone. Deleting."
123                         verbose rm -rf "$d"
124                         continue
125                 fi
126                 # if we have the dir, always keep it
127                 if [ -d "$d" ]; then
128                         msg "Repository $d enabled because it already exists"
129                         $ECHO "$d"
130                         continue
131                 fi
132                 # if we have matching pk3, skip
133                 if [ x"$p" != x"$d" ] && [ -f "$p" ]; then
134                         msg "Repository $d disabled by matching .pk3 file, delete $p or create $d.yes to enable"
135                         continue
136                 fi
137                 # if "no" flag is set, skip
138                 case ",$f," in
139                         *,no,*)
140                                 msg "Repository $d disabled by default, create $d.yes to enable"
141                                 continue
142                                 ;;
143                 esac
144                 # default: enable
145                 msg "Repository $d enabled by default"
146                 $ECHO "$d"
147         done
148 }
149
150 repos=`listrepos`