diff options
author | elliott_c <ocielliottc@users.noreply.github.com> | 2005-11-14 13:41:33 +0000 |
---|---|---|
committer | elliott_c <ocielliottc@users.noreply.github.com> | 2005-11-14 13:41:33 +0000 |
commit | 38f34d898106d8a4c84326e9a7721535b10e3cdf (patch) | |
tree | 8b42070a44db91c6f652fc429e535d780aac635f | |
parent | 34ea43f4708c34c6fe49662834480ade6a92a6a3 (diff) | |
download | MPC-38f34d898106d8a4c84326e9a7721535b10e3cdf.tar.gz |
ChangeLogTag: Mon Nov 14 07:40:19 2005 Chad Elliott <elliott_c@ociweb.com>
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | modules/WorkspaceCreator.pm | 34 |
2 files changed, 31 insertions, 12 deletions
@@ -1,3 +1,12 @@ +Mon Nov 14 07:40:19 2005 Chad Elliott <elliott_c@ociweb.com> + + * modules/WorkspaceCreator.pm: + + Fixed a bug where sorting the projects (with a circular + dependency) would run infinitely. This was identical to the + problem fixed on Thu Apr 15 13:16:03 2004 just in a different + scenario. + Thu Nov 10 12:23:43 2005 Chad Elliott <elliott_c@ociweb.com> * modules/TemplateParser.pm: diff --git a/modules/WorkspaceCreator.pm b/modules/WorkspaceCreator.pm index 19a551ca..808a0091 100644 --- a/modules/WorkspaceCreator.pm +++ b/modules/WorkspaceCreator.pm @@ -953,15 +953,7 @@ sub generate_hierarchy { ## It is necessary to sort the projects to get the correct ordering. ## Projects in the current directory must come before projects in ## other directories. - my(@projects) = sort { my($sa) = ($a =~ /\//); - my($sb) = ($b =~ /\//); - if ($sa && !$sb) { - return 1; - } - elsif ($sb && !$sa) { - return -1; - } - return $a cmp $b; + my(@projects) = sort { return $self->sort_projects_by_directory($a, $b) + 0; } @{$origproj}; my(%projinfo) = %{$originfo}; @@ -1486,7 +1478,7 @@ sub sort_by_groups { ($self->{'current_input'} eq '' ? 'default' : $self->{'current_input'}) . ' workspace. ' . - 'The following directories are involved: ' . + 'The following directories or projects are involved: ' . join(' and ', @dirs)); return; } @@ -1561,7 +1553,8 @@ sub sort_by_groups { sub sort_dependencies { my($self) = shift; my($projects) = shift; - my(@list) = sort @$projects; + my(@list) = sort { return $self->sort_projects_by_directory($a, $b) + 0; + } @$projects; ## Put the projects in the order specified ## by the project dpendencies. We only need to do @@ -1580,7 +1573,7 @@ sub sort_dependencies { $previous = [$li, $dir]; } } - push(@grindex, [$previous->[0], $#list]); + push(@grindex, [$previous->[0], $#list]); ## Next, sort the individual groups foreach my $gr (@grindex) { @@ -1952,6 +1945,23 @@ sub source_listing_callback { $cwd, \@files ]; } + +sub sort_projects_by_directory { + my($self) = shift; + my($left) = shift; + my($right) = shift; + my($sa) = ($left =~ /\//); + my($sb) = ($right =~ /\//); + + if ($sa && !$sb) { + return 1; + } + elsif ($sb && !$sa) { + return -1; + } + return $left cmp $right; +} + # ************************************************************ # Virtual Methods To Be Overridden # ************************************************************ |