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;
66 print("$0 <options>\n");
67 print("-f\n\tForce initialization\n");
68 print("-q\n\tQuiet operation. Will exit cleanly if repository is already\n");
69 print("\tinitialized\n");
70 print("-nokia-developer\n\tSwitch to internal Nokia URLs.\n");
71 print("-brisbane-nokia-developer\n\tSwitch to internal Nokia URLs, and setup the brisbane mirrors.\n");
72 print("-ssh-protocol\n\tUse SSH protocol, for restrictive firewalls. Note that this requires\n");
73 print("\ta user account with an uploaded SSH key on all servers used.\n");
74 print("-no-webkit\n\tSkip webkit and webkit examples submodules.\n");
75 print("-no-update\n\t Skip the git submodule update command.\n");
82 } elsif ($arg eq "-q") {
84 } elsif ($arg eq "-brisbane-nokia-developer") {
87 } elsif ($arg eq "-nokia-developer") {
89 } elsif ($arg eq "-ssh-protocol") {
91 } elsif ($arg eq "-h" || $arg eq "--help") {
94 } elsif ($arg eq "-no-webkit") {
96 } elsif ($arg eq "-no-update") {
99 print("*** Unknown option: $arg\n");
106 if (`git config --get submodule.qtbase.url`) {
108 my @configresult = `git config -l`;
109 foreach (@configresult) {
110 if (/(submodule\.[^.=]+\.url)=.*/) {
111 system_v("git config --unset $1");
116 print("Will not reinitialize already initialized repository (use -f to force)!\n");
122 $init_args = "-q" if ($quiet);
123 system_v("git submodule init $init_args");
125 system_v("git config --remove submodule.qtwebkit");
126 system_v("git config --remove submodule.qtwebkit-examples-and-demos");
129 my @configresult = `git config -l`;
130 foreach (@configresult) {
131 if (/(submodule\.[^.=]+\.url)=(.*)/) {
134 if ($nokia_developer) {
135 # WebKit is special, and has only external link.
136 if ($key ne "submodule.qtwebkit.url") {
137 # qt-labs projects are still hosted under qt internally.
138 $value =~ s,^git://gitorious\.org/qt-labs/,git://scm.dev.nokia.troll.no/qt/,;
139 $value =~ s,^git://gitorious\.org/,git://scm.dev.nokia.troll.no/,;
143 $value =~ s,git://([^/:]+)/(.*),git\@$1:$2,;
145 system_v("git config \"$key\" \"$value\"");
149 if ($nokia_developer) {
150 if ($brisbane_mirror) {
151 my $mirror_url = "git://bq-git.apac.nokia.com/qtsoftware/qt/";
152 my %exceptions = ("qtwebkit", "git://bq-git.apac.nokia.com/qtsoftware/research/gitorious-org-webkit-qtwebkit-mirror.git");
153 my @configresult2 = `git config -l`;
154 foreach (@configresult2) {
155 if(/submodule\.([^.=]+)\.url=(.*)/){
159 no warnings 'uninitialized';
160 if($exceptions{$repo} ne undef){
161 $this_mirror_url = $exceptions{$repo};
163 $this_mirror_url = "$mirror_url$repo.git";
165 print("Using mirror $this_mirror_url to clone $url\n");
166 unless ($no_update) {
167 system_v("git clone $this_mirror_url $repo");
168 chdir($repo) or die "cd failed";
169 system_v("git config remote.origin.url $url");
170 system_v("git remote add mirror $this_mirror_url");
171 chdir("..") or die "cd fail";
179 system_v("git submodule update");