summaryrefslogtreecommitdiffstats
path: root/init-repository
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>2016-01-27 14:45:35 +0100
committerFrederik Gladhorn <frederik.gladhorn@theqtcompany.com>2016-02-07 09:09:27 +0000
commit3de19487d90a8035c78af4668a953d7330845705 (patch)
tree2cce0c1f91e3a88aa8ca241bc81fac6b25b6a936 /init-repository
parentf5ba19c3f053990480bc958dd585a7ed5e5874ed (diff)
replace 'initrepo' with more fine-grained 'status'
instead of a simple bool, we now have five states: preview, active, addon, obsolete, and ignore (the default). the default includes the first three. the CI system is expected to use --module-subset=all,-ignore to include everything that is expected to build (in some configurations). Change-Id: Ifb43412054a8e42db0425f24f8e53acfce363caa Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'init-repository')
-rwxr-xr-xinit-repository43
1 files changed, 36 insertions, 7 deletions
diff --git a/init-repository b/init-repository
index f0407f63..966e0c16 100755
--- a/init-repository
+++ b/init-repository
@@ -71,9 +71,12 @@ Options:
--module-subset=<module1>,<module2>...
Only initialize the specified subset of modules given as the
argument. Specified modules must already exist in .gitmodules. The
- string "all" results in cloning all known modules. The default is
- the set of maintained modules. Module names may be prefixed with a
- dash to exclude them from a bigger set.
+ string "all" results in cloning all known modules. The strings
+ "essential", "addon", "preview", "obsolete", and "ignore" refer to
+ classes of modules; "default" maps to "essential,addon,preview",
+ which corresponds with the set of maintained modules and is also
+ the default set. Module names may be prefixed with a dash to
+ exclude them from a bigger set, e.g. "all,-ignore".
--no-update
Skip the `git submodule update' command.
@@ -234,6 +237,7 @@ sub parse_arguments
# Replace any double trailing slashes from end of mirror
$self->{'mirror-url'} =~ s{//+$}{/};
+ $self->{'module-subset'} =~ s/\bdefault\b/preview,essential,addon/;
$self->{'module-subset'} = [ split(/,/, $self->{'module-subset'}) ];
return;
@@ -272,6 +276,13 @@ sub git_submodule_init
return;
}
+use constant {
+ STS_PREVIEW => 1,
+ STS_ESSENTIAL => 2,
+ STS_ADDON => 3,
+ STS_OBSOLETE => 4
+};
+
sub git_clone_all_submodules
{
my ($self, $my_repo_base, $co_branch, @subset) = @_;
@@ -296,8 +307,20 @@ sub git_clone_all_submodules
$subbases{$mod} = $base;
} elsif ($2 eq "update") {
push @subset, '-'.$1 if ($3 eq 'none');
- } elsif ($2 eq "initrepo") {
- $subinits{$1} = ($3 eq "yes" or $3 eq "true");
+ } elsif ($2 eq "status") {
+ if ($3 eq "preview") {
+ $subinits{$1} = STS_PREVIEW;
+ } elsif ($3 eq "essential") {
+ $subinits{$1} = STS_ESSENTIAL;
+ } elsif ($3 eq "addon") {
+ $subinits{$1} = STS_ADDON;
+ } elsif ($3 eq "obsolete") {
+ $subinits{$1} = STS_OBSOLETE;
+ } elsif ($3 eq "ignore") {
+ delete $subinits{$1};
+ } else {
+ die("Invalid subrepo status '$3' for '$1'.\n");
+ }
}
}
@@ -305,8 +328,14 @@ sub git_clone_all_submodules
foreach my $mod (@subset) {
if ($mod eq "all") {
map { $include{$_} = 1; } keys %subbases;
- } elsif ($mod eq "default") {
- map { $include{$_} = 1; } grep { $subinits{$_} } keys %subbases;
+ } elsif ($mod eq "essential") {
+ map { $include{$_} = 1; } grep { ($subinits{$_} || 0) eq STS_ESSENTIAL } keys %subbases;
+ } elsif ($mod eq "addon") {
+ map { $include{$_} = 1; } grep { ($subinits{$_} || 0) eq STS_ADDON } keys %subbases;
+ } elsif ($mod eq "preview") {
+ map { $include{$_} = 1; } grep { ($subinits{$_} || 0) eq STS_PREVIEW } keys %subbases;
+ } elsif ($mod eq "obsolete") {
+ map { $include{$_} = 1; } grep { ($subinits{$_} || 0) eq STS_OBSOLETE } keys %subbases;
} elsif ($mod =~ s/^-//) {
delete $include{$mod};
} else {