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 die("Illegal argument: $arg");
104 if (`git config --get submodule.qtbase.url`) {
106 my @configresult = `git config -l`;
107 foreach (@configresult) {
108 if (/(submodule\.[^.=]+\.url)=.*/) {
109 system_v("git config --unset $1");
114 print("Will not reinitialize already initialized repository (use -f to force)!\n");
120 $init_args = "-q" if ($quiet);
121 system_v("git submodule init $init_args");
123 system_v("git config --remove submodule.qtwebkit");
124 system_v("git config --remove submodule.qtwebkit-examples-and-demos");
127 my @configresult = `git config -l`;
128 foreach (@configresult) {
129 if (/(submodule\.[^.=]+\.url)=(.*)/) {
132 if ($nokia_developer) {
133 # WebKit is special, and has only external link.
134 if ($key ne "submodule.qtwebkit.url") {
135 # qt-labs projects are still hosted under qt internally.
136 $value =~ s,^git://gitorious\.org/qt-labs/,git://scm.dev.nokia.troll.no/qt/,;
137 $value =~ s,^git://gitorious\.org/,git://scm.dev.nokia.troll.no/,;
141 $value =~ s,git://([^/:]+)/(.*),git\@$1:$2,;
143 system_v("git config \"$key\" \"$value\"");
147 if ($nokia_developer) {
148 if ($brisbane_mirror) {
149 my $mirror_url = "git://bq-git.apac.nokia.com/qtsoftware/qt/";
150 my %exceptions = ("qtwebkit", "git://bq-git.apac.nokia.com/qtsoftware/research/gitorious-org-webkit-qtwebkit-mirror.git");
151 my @configresult2 = `git config -l`;
152 foreach (@configresult2) {
153 if(/submodule\.([^.=]+)\.url=(.*)/){
157 no warnings 'uninitialized';
158 if($exceptions{$repo} ne undef){
159 $this_mirror_url = $exceptions{$repo};
161 $this_mirror_url = "$mirror_url$repo.git";
163 print("Using mirror $this_mirror_url to clone $url\n");
164 unless ($no_update) {
165 system_v("git clone $this_mirror_url $repo");
166 chdir($repo) or die "cd failed";
167 system_v("git config remote.origin.url $url");
168 system_v("git remote add mirror $this_mirror_url");
169 chdir("..") or die "cd fail";
177 system_v("git submodule update");