summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorelliott_c <ocielliottc@users.noreply.github.com>2003-09-12 18:33:35 +0000
committerelliott_c <ocielliottc@users.noreply.github.com>2003-09-12 18:33:35 +0000
commitd400b223fbc2d57a7a03078a262f2df7d009dea1 (patch)
treeef19b4f931c358da16ec7f485e609066f4d69df7
parentdb04476eb509c04827cf048d151b608178bf63f5 (diff)
downloadATCD-d400b223fbc2d57a7a03078a262f2df7d009dea1.tar.gz
ChangeLogTag: Fri Sep 12 13:31:50 2003 Chad Elliott <elliott_c@ociweb.com>
-rw-r--r--ChangeLog8
-rw-r--r--bin/MakeProjectCreator/modules/WorkspaceCreator.pm84
2 files changed, 68 insertions, 24 deletions
diff --git a/ChangeLog b/ChangeLog
index 91ad1496f0b..e5dd49ec8d4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Fri Sep 12 13:31:50 2003 Chad Elliott <elliott_c@ociweb.com>
+
+ * bin/MakeProjectCreator/modules/WorkspaceCreator.pm:
+
+ Updated the code to detect and drop circular dependencies. The
+ original code was wrong and would drop dependencies that didn't
+ need to be.
+
Fri Sep 12 11:51:17 2003 Jeff Parsons <j.parsons@vanderbilt.edu>
* Kokyu/Kokyu.dsp:
diff --git a/bin/MakeProjectCreator/modules/WorkspaceCreator.pm b/bin/MakeProjectCreator/modules/WorkspaceCreator.pm
index afbe15780e8..c7d5dde75b2 100644
--- a/bin/MakeProjectCreator/modules/WorkspaceCreator.pm
+++ b/bin/MakeProjectCreator/modules/WorkspaceCreator.pm
@@ -943,6 +943,33 @@ sub get_project_info {
}
+sub generate_circular_tree {
+ my($self) = shift;
+ my($circular) = shift;
+ my($prepend) = shift;
+ my($into) = shift;
+ my($current) = shift;
+
+ if (!defined $$circular{$into}) {
+ $$circular{$into} = {};
+ }
+ my($deps) = $self->get_validated_ordering($current);
+
+ if ($deps ne '') {
+ my($darr) = $self->create_array($deps);
+ foreach my $dep (@$darr) {
+ my($base) = basename($dep);
+ my($full) = (defined $$prepend{$base} ?
+ "$$prepend{$base}/" : '') . $base;
+ if (!defined $$circular{$into}->{$full}) {
+ $$circular{$into}->{$full} = 1;
+ $self->generate_circular_tree($circular, $prepend, $current, $full);
+ }
+ }
+ }
+}
+
+
sub sort_dependencies {
my($self) = shift;
my($projects) = shift;
@@ -962,9 +989,8 @@ sub sort_dependencies {
%$prepref = %prepend;
}
- ## These will help us catch circular dependencies
- my($start_project) = '';
- my($moved_project) = '';
+ ## This will help us catch circular dependencies
+ my(%circular) = ();
## Put the projects in the order specified
## by the project dpendencies.
@@ -974,7 +1000,11 @@ sub sort_dependencies {
my($deps) = $self->get_validated_ordering($project);
if ($deps ne '') {
- my($darr) = $self->create_array($deps);
+ my($darr) = $self->create_array($deps);
+
+ ## Set up the circular entry
+ $self->generate_circular_tree(\%circular, \%prepend, $project, $project);
+
my($moved) = 0;
foreach my $dep (@$darr) {
my($base) = basename($dep);
@@ -982,27 +1012,33 @@ sub sort_dependencies {
"$prepend{$base}/" : '') . $base;
if ($project ne $full) {
## See if the dependency is listed after this project
- for(my $j = $i; $j <= $#list; ++$j) {
- if ($i != $j && $list[$j] eq $full &&
- ($list[$i] ne $moved_project ||
- $list[$j] ne $start_project)) {
- ## Keep track of the one we started with and the
- ## one we are going to move. If there is a circular
- ## dependency, the next time through we will catch it.
- $start_project = $list[$i];
- $moved_project = $list[$j];
-
- ## If so, move it in front of the current project.
- ## The original code, which had splices, didn't always
- ## work correctly (especially on AIX for some reason).
- for(my $k = $j; $k > $i; --$k) {
- $list[$k] = $list[$k - 1];
+ for(my $j = $i + 1; $j <= $#list; ++$j) {
+ if ($list[$j] eq $full) {
+ if (defined $circular{$full} &&
+ defined $circular{$full}->{$list[$j]}) {
+ ## Don't warn about circular dependencies if we are
+ ## generating implicit project dependencies. The
+ ## dependencies in question may have been generated and
+ ## that's not the users fault.
+ if (!$self->generate_implicit_project_dependencies() ||
+ defined $ENV{MPC_VERBOSE_CIRCULAR}) {
+ print 'WARNING: Circular dependency between ' .
+ "$list[$j] and $full\n";
+ }
+ }
+ else {
+ ## If so, move it in front of the current project.
+ ## The original code, which had splices, didn't always
+ ## work correctly (especially on AIX for some reason).
+ for(my $k = $j; $k > $i; --$k) {
+ $list[$k] = $list[$k - 1];
+ }
+ $list[$i] = $full;
+
+ ## Mark that an entry has been moved
+ $moved = 1;
+ $j--;
}
- $list[$i] = $full;
-
- ## Mark that an entry has been moved
- $moved = 1;
- $j--;
}
}
}