2 #############################################################################
4 ## Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
5 ## All rights reserved.
6 ## Contact: Nokia Corporation (qt-info@nokia.com)
8 ## This file is part of the utilities of the Qt Toolkit.
10 ## $QT_BEGIN_LICENSE:LGPL$
11 ## No Commercial Usage
12 ## This file contains pre-release code and may not be distributed.
13 ## You may use this file in accordance with the terms and conditions
14 ## contained in the Technology Preview License Agreement accompanying
17 ## GNU Lesser General Public License Usage
18 ## Alternatively, this file may be used under the terms of the GNU Lesser
19 ## General Public License version 2.1 as published by the Free Software
20 ## Foundation and appearing in the file LICENSE.LGPL included in the
21 ## packaging of this file. Please review the following information to
22 ## ensure the GNU Lesser General Public License version 2.1 requirements
23 ## will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
25 ## In addition, as a special exception, Nokia gives you certain additional
26 ## rights. These rights are described in the Nokia Qt LGPL Exception
27 ## version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
29 ## If you have questions regarding the use of this file, please contact
30 ## Nokia at qt-info@nokia.com.
41 #############################################################################
48 my $nokia_developer = 0;
49 my $brisbane_mirror = 0;
53 my $ignore_submodules = 0;
68 print("$0 <options>\n");
69 print("-f\n\tForce initialization\n");
70 print("-q\n\tQuiet operation. Will exit cleanly if repository is already\n");
71 print("\tinitialized\n");
72 print("-nokia-developer\n\tSwitch to internal Nokia URLs.\n");
73 print("-brisbane-nokia-developer\n\tSwitch to internal Nokia URLs, and setup the brisbane mirrors.\n");
74 print("-ssh-protocol\n\tUse SSH protocol, for restrictive firewalls. Note that this requires\n");
75 print("\ta user account with an uploaded SSH key on all servers used.\n");
76 print("-no-webkit\n\tSkip webkit and webkit examples submodules.\n");
77 print("-no-update\n\t Skip the git submodule update command.\n");
78 print(" -ignore-submodules\n");
79 print(" Ignores submodules when doing operations on qt5 repo, such\n");
80 print(" as 'pull', 'fetch', 'diff' etc. Use\n");
81 print(" --ignore-submodules=none to override, when needed\n\n");
89 } elsif ($arg eq "-q") {
91 } elsif ($arg eq "-brisbane-nokia-developer") {
94 } elsif ($arg eq "-nokia-developer") {
96 } elsif ($arg eq "-ssh-protocol") {
98 } elsif ($arg eq "-h" || $arg eq "--help") {
101 } elsif ($arg eq "-no-webkit") {
103 } elsif ($arg eq "-no-update") {
105 } elsif ($arg eq "-ignore-submodules") {
106 $ignore_submodules = 1;
108 print("*** Unknown option: $arg\n");
115 if (`git config --get submodule.qtbase.url`) {
117 my @configresult = `git config -l`;
118 foreach (@configresult) {
119 if (/(submodule\.[^.=]+)\.url=.*/) {
120 system_v("git config --remove-section $1");
125 print("Will not reinitialize already initialized repository (use -f to force)!\n");
131 $init_args = "-q" if ($quiet);
132 system_v("git submodule init $init_args");
134 system_v("git config --remove submodule.qtwebkit");
135 system_v("git config --remove submodule.qtwebkit-examples-and-demos");
138 my @configresult = `git config -l`;
139 foreach (@configresult) {
140 if (/(submodule\.[^.=]+\.url)=(.*)/) {
143 if ($nokia_developer) {
144 # WebKit is special, and has only external link.
145 if ($key ne "submodule.qtwebkit.url") {
146 # qt-labs projects are still hosted under qt internally.
147 $value =~ s,^git://gitorious\.org/qt-labs/,git://scm.dev.nokia.troll.no/qt/,;
148 $value =~ s,^git://gitorious\.org/,git://scm.dev.nokia.troll.no/,;
152 $value =~ s,git://([^/:]+)/(.*),git\@$1:$2,;
154 system_v("git config \"$key\" \"$value\"");
155 if ($ignore_submodules) {
156 $key =~ s,\.url,.ignore,;
157 system_v("git config \"$key\" \"all\"");
162 if ($nokia_developer) {
163 if ($brisbane_mirror) {
164 my $mirror_url = "git://bq-git.apac.nokia.com/qtsoftware/qt/";
165 my %exceptions = ("qtwebkit", "git://bq-git.apac.nokia.com/qtsoftware/research/gitorious-org-webkit-qtwebkit-mirror.git");
166 my @configresult2 = `git config -l`;
167 foreach (@configresult2) {
168 if(/submodule\.([^.=]+)\.url=(.*)/){
172 no warnings 'uninitialized';
173 if($exceptions{$repo} ne undef){
174 $this_mirror_url = $exceptions{$repo};
176 $this_mirror_url = "$mirror_url$repo.git";
178 print("Using mirror $this_mirror_url to clone $url\n");
179 unless ($no_update) {
180 system_v("git clone $this_mirror_url $repo");
181 chdir($repo) or die "cd failed";
182 system_v("git config remote.origin.url $url");
183 system_v("git remote add mirror $this_mirror_url");
184 chdir("..") or die "cd fail";
192 system_v("git submodule update");