Can now tell init-repository to only use a subset of modules

Still useful to use init-repository because of all the other logic, such
as repository urls. More general than --no-webkit, although it is still
a valid convenience as the most common case.

Also makes qt.pro check for existence of modules, since it is no longer
certain that you'll have everything but webkit.

Change-Id: Iaaaa30e24e0a793218e2e307bdde56067760c513
Reviewed-on: http://codereview.qt.nokia.com/1258
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
This commit is contained in:
Alan Alpert
2011-07-06 17:53:58 +10:00
committed by Qt by Nokia
parent 3be6eb3042
commit 435a7c7739
2 changed files with 54 additions and 19 deletions

View File

@@ -87,6 +87,10 @@ Skip webkit and webkit examples submodules.
It may be desirable to skip these modules due to the large size of the webkit It may be desirable to skip these modules due to the large size of the webkit
git repository. git repository.
=item --module-subset=<module1>,<module2>...
Only initialize the specified subset of modules given as the argument. Specified
modules must already exist in .gitmodules.
=item --no-update =item --no-update
@@ -300,6 +304,7 @@ sub parse_arguments
'protocol' => "", 'protocol' => "",
'update' => 1 , 'update' => 1 ,
'webkit' => 1 , 'webkit' => 1 ,
'module-subset' => "",
); );
GetOptionsFromArray(\@args, GetOptionsFromArray(\@args,
@@ -314,6 +319,7 @@ sub parse_arguments
'quiet' => \$self->{qw{ quiet }}, 'quiet' => \$self->{qw{ quiet }},
'update!' => \$self->{qw{ update }}, 'update!' => \$self->{qw{ update }},
'webkit!' => \$self->{qw{ webkit }}, 'webkit!' => \$self->{qw{ webkit }},
'module-subset=s' => \$self->{qw{ module-subset }},
'help|?' => sub { pod2usage(1); }, 'help|?' => sub { pod2usage(1); },
'http' => sub { $self->{protocol} = 'http'; }, 'http' => sub { $self->{protocol} = 'http'; },
@@ -349,6 +355,12 @@ sub parse_arguments
# Replace any double trailing slashes from end of mirror # Replace any double trailing slashes from end of mirror
$self->{'mirror-url'} =~ s{//+$}{/}; $self->{'mirror-url'} =~ s{//+$}{/};
if ($self->{'module-subset'}) {
$self->{'module-subset'} = {
map { $_ => 1 } split(qr{,}, $self->{'module-subset'})
};
}
return; return;
} }
@@ -405,6 +417,21 @@ sub git_disable_webkit_submodule
return; return;
} }
sub git_prune_submodules
{
my ($self) = @_;
my @configresult = qx(git config -l);
foreach my $line (@configresult) {
if ($line =~ /submodule\.([^.=]+)\.url=/) {
my $module_name = $1;
if (!$self->{'module-subset'}{$module_name}) {
$self->exe('git', 'config', '--remove', "submodule.$module_name");
}
}
}
}
sub git_set_submodule_config sub git_set_submodule_config
{ {
my ($self) = @_; my ($self) = @_;
@@ -593,6 +620,10 @@ sub run
$self->git_disable_webkit_submodule; $self->git_disable_webkit_submodule;
} }
if ($self->{'module-subset'}) {
$self->git_prune_submodules;
}
$self->git_set_submodule_config; $self->git_set_submodule_config;
if ($self->{update}) { if ($self->{update}) {

42
qt.pro
View File

@@ -87,25 +87,29 @@ module_qtfeedback.depends = module_qtbase module_qtdeclarative
# not yet enabled by default # not yet enabled by default
module_qtfeedback.CONFIG = no_default_target no_default_install module_qtfeedback.CONFIG = no_default_target no_default_install
SUBDIRS = \ # only qtbase is required to exist. The others may not - but it is the
module_qtbase \ # users responsibility to ensure that all needed dependencies exist, or
module_qtsvg \ # it may not build.
module_qtphonon \
module_qtxmlpatterns \ SUBDIRS = module_qtbase
module_qtscript \
module_qtdeclarative \ exists(qtsvg/qtsvg.pro): SUBDIRS += module_qtsvg
module_qtmultimedia \ exists(qtphonon/qtphonon.pro): SUBDIRS += module_qtphonon
module_qttools \ exists(qtxmlpatterns/qtxmlpatterns.pro): SUBDIRS += module_qtxmlpatterns
module_qttranslations \ exists(qtscript/qtscript.pro): SUBDIRS += module_qtscript
module_qtdoc \ exists(qtdeclarative/qtdeclarative.pro): SUBDIRS += module_qtdeclarative
module_qlalr \ exists(qtmultimedia/qtmultimedia.pro): SUBDIRS += module_qtmultimedia
module_qtqa \ exists(qttools/qttools.pro): SUBDIRS += module_qttools
module_qtlocation \ exists(qttranslations/qttranslations.pro): SUBDIRS += module_qttranslations
module_qtactiveqt \ exists(qtdoc/qtdoc.pro): SUBDIRS += module_qtdoc
module_qtsensors \ exists(qlalr/qlalr.pro): SUBDIRS += module_qlalr
module_qtsystems \ exists(qtqa/qtqa.pro): SUBDIRS += module_qtqa
module_qtmultimediakit \ exists(qtlocation/qtlocation.pro): SUBDIRS += module_qtlocation
module_qtfeedback \ exists(qtactiveqt/qtactiveqt.pro): SUBDIRS += module_qtactiveqt
exists(qtsensors/qtsensors.pro): SUBDIRS += module_qtsensors
exists(qtsystems/qtsystems.pro): SUBDIRS += module_qtsystems
exists(qtmultimediakit/qtmultimediakit.pro): SUBDIRS += module_qtmultimediakit
exists(qtfeedback/qtfeedback.pro): SUBDIRS += module_qtfeedback
exists(qtwebkit/Tools/Scripts/build-webkit) { exists(qtwebkit/Tools/Scripts/build-webkit) {
SUBDIRS += module_qtwebkit \ SUBDIRS += module_qtwebkit \