summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorelliott_c <ocielliottc@users.noreply.github.com>2003-04-30 13:38:56 +0000
committerelliott_c <ocielliottc@users.noreply.github.com>2003-04-30 13:38:56 +0000
commit46875a42f1142c113489ed8034b5b0f025fd4a4f (patch)
treee501cf21343f5d6c5b2079c9e1e4554edc0f07ee
parent8203919207bd17fb8d8fe0d9595c76f4ba77af1a (diff)
downloadMPC-46875a42f1142c113489ed8034b5b0f025fd4a4f.tar.gz
ChangeLogTag: Wed Apr 30 08:37:29 2003 Chad Elliott <elliott_c@ociweb.com>
-rw-r--r--modules/Parser.pm2
-rw-r--r--modules/ProjectCreator.pm12
-rw-r--r--modules/WorkspaceCreator.pm41
3 files changed, 50 insertions, 5 deletions
diff --git a/modules/Parser.pm b/modules/Parser.pm
index 54d4409a..b8cea113 100644
--- a/modules/Parser.pm
+++ b/modules/Parser.pm
@@ -158,7 +158,7 @@ sub search_include_path {
my($file) = shift;
my($found) = undef;
- foreach my $include (@{$self->{'include'}}, '.') {
+ foreach my $include ('.', @{$self->{'include'}}) {
if (-r "$include/$file") {
$found = "$include/$file";
last;
diff --git a/modules/ProjectCreator.pm b/modules/ProjectCreator.pm
index 4370875e..a5fbac74 100644
--- a/modules/ProjectCreator.pm
+++ b/modules/ProjectCreator.pm
@@ -285,14 +285,15 @@ sub parse_line {
## Set up some initial values
if (defined $name) {
- $name =~ s/^\(\s*//;
- $name =~ s/\s*\)$//;
if ($name =~ /[\/\\]/) {
$status = 0;
$errorString = 'ERROR: Projects can not have a slash ' .
'or a back slash in the name';
}
else {
+ $name =~ s/^\(\s*//;
+ $name =~ s/\s*\)$//;
+ $name =~ s/\s/_/g;
$self->process_assignment('project_name', $name);
}
}
@@ -1271,13 +1272,18 @@ sub generate_defaults {
if (!defined $self->get_assignment('project_name')) {
my($current) = $self->get_current_input();
if ($current eq '') {
- $self->process_assignment('project_name', $self->base_directory());
+ my($base) = $self->base_directory();
+ $base =~ s/\s/_/g;
+ $self->process_assignment('project_name', $base);
}
else {
## Since files on UNIX can have back slashes, we transform them
## into underscores.
$current =~ s/\\/_/g;
+ ## Convert spaces to underscores
+ $current =~ s/\s/_/g;
+
## Take off the extension
$current =~ s/\.[^\.]+$//;
$self->process_assignment('project_name', $current);
diff --git a/modules/WorkspaceCreator.pm b/modules/WorkspaceCreator.pm
index cfad36c0..331a5a4d 100644
--- a/modules/WorkspaceCreator.pm
+++ b/modules/WorkspaceCreator.pm
@@ -127,7 +127,6 @@ sub parse_line {
$status = 0;
}
- $self->{'current_workspace_name'} = undef;
$self->{'modified_count'} = 0;
$self->{'workspace_name'} = undef;
$self->{'projects'} = [];
@@ -465,6 +464,11 @@ sub write_workspace {
my($fh) = new FileHandle();
my($dir) = dirname($name);
+ ## Verify and possibly modify the dependencies
+ if ($addfile) {
+ $self->verify_build_ordering();
+ }
+
if ($dir ne '.') {
mkpath($dir, 0, 0777);
}
@@ -857,6 +861,7 @@ sub get_modified_workspace_name {
if (!defined $previous_workspace_name{$type}->{$pwd}) {
$previous_workspace_name{$type}->{$pwd} = $wsname;
+ $self->{'current_workspace_name'} = undef;
}
else {
my($prefix) = ($name eq $wsname ? $name : "$name.$wsname");
@@ -883,6 +888,40 @@ sub generate_recursive_input_list {
return $self->extension_recursive_input_list($dir, $wsext);
}
+
+sub verify_build_ordering {
+ my($self) = shift;
+ my($projects) = $self->get_projects();
+ my($pjs) = $self->get_project_info();
+
+ foreach my $project (@$projects) {
+ my($name, $deps) = @{$$pjs{$project}};
+ if (defined $deps && $deps ne '') {
+ my($darr) = $self->create_array($deps);
+ foreach my $dep (@$darr) {
+ my($found) = 0;
+ ## Avoid cirular dependencies
+ if ($dep ne $name && $dep ne basename($project)) {
+ foreach my $p (@$projects) {
+ if ($dep eq $$pjs{$p}->[0] || $dep eq basename($p)) {
+ $found = 1;
+ last;
+ }
+ }
+ if (!$found) {
+ if (defined $ENV{MPC_VERBOSE_ORDERING}) {
+ print "WARNING: '$name' references '$dep' which has " .
+ "not been processed\n";
+ }
+ $deps =~ s/\s*"$dep"\s*/ /g;
+ }
+ }
+ }
+ $$pjs{$project}->[1] = $deps;
+ }
+ }
+}
+
# ************************************************************
# Virtual Methods To Be Overridden
# ************************************************************