5 'config' => 'modules.versions',
18 @arg = split(/=/, $arg);
19 $arguments{$arg[0]} = $arg[1];
23 if ($arguments{'path'} ne "")
25 if (!(-d $arguments{'path'}))
27 die "Unable to find path: " . $arguments{'path'} ."\n";
29 chdir($arguments{'path'});
32 if (!open(CONFIG, $arguments{'config'}))
34 die "Unable to open config file for reading: " . $arguments{'config'} . "\n";
38 my $cur_module = undef;
44 if ($line =~ /^\[([^\]]+)\]$/)
53 if ($line =~ /^([^=]+) = (.+)$/)
55 $modules{$cur_module}{$1} = $2;
61 #Copy global configuration options...
62 if (exists($modules{'PRODUCT'}))
64 if (exists($modules{'PRODUCT'}{'major'}))
66 $arguments{'major'} = $modules{'PRODUCT'}{'major'};
68 if (exists($modules{'PRODUCT'}{'minor'}))
70 $arguments{'minor'} = $modules{'PRODUCT'}{'minor'};
72 if (exists($modules{'PRODUCT'}{'revision'}))
74 $arguments{'revision'} = $modules{'PRODUCT'}{'revision'};
76 if (exists($modules{'PRODUCT'}{'svnrev'}))
78 $arguments{'svnrev'} = $modules{'PRODUCT'}{'svnrev'};
82 #Get the global SVN revision if we have none
84 if ($arguments{'build'} == undef)
86 $rev = GetRevision(undef);
88 $rev = int($arguments{'build'});
91 my $major = $arguments{'major'};
92 my $minor = $arguments{'minor'};
93 my $revision = $arguments{'revision'};
94 my $svnrev = $arguments{'svnrev'};
96 #Go through everything now
98 while ( ($cur_module, $mod_i) = each(%modules) )
101 if ($cur_module eq "PRODUCT")
107 my $infile = $mod{'in'};
108 my $outfile = $mod{'out'};
111 if (!(-d $mod{'folder'}))
113 die "Folder " . $mod{'folder'} . " not found.\n";
115 $infile = $mod{'folder'} . '/' . $infile;
116 $outfile = $mod{'folder'} . '/' . $outfile;
120 die "File $infile is not a file.\n";
122 my $global_rev = $rev;
123 my $local_rev = GetRevision($mod{'folder'});
124 if ($arguments{'svnrev'} eq 'local')
126 $global_rev = $local_rev;
129 open(INFILE, $infile) or die "Could not open file for reading: $infile\n";
130 open(OUTFILE, '>'.$outfile) or die "Could not open file for writing: $outfile\n";
133 s/\$PMAJOR\$/$major/g;
134 s/\$PMINOR\$/$minor/g;
135 s/\$PREVISION\$/$revision/g;
136 s/\$GLOBAL_BUILD\$/$rev/g;
137 s/\$LOCAL_BUILD\$/$local_rev/g;
150 $rev = `svnversion --committed`;
152 $rev = `svnversion --committed $path`;
154 if ($rev =~ /exported/)
156 die "Path specified is not a working copy\n";
157 } elsif ($rev =~ /(\d+):(\d+)/) {
159 } elsif ($rev =~ /(\d+)/) {
162 die "Unknown svnversion response: $rev\n";