This makes it possible to reuse the code in other build scripts.
Signed-off-by: Francois Gouget fgouget@codeweavers.com ---
Like the script to update the VMs for testing patches in Wine...
testbot/bin/build/Reconfig.pl | 18 ++++----------- testbot/lib/WineTestBot/PatchUtils.pm | 33 ++++++++++++++++++++++++++- 2 files changed, 37 insertions(+), 14 deletions(-)
diff --git a/testbot/bin/build/Reconfig.pl b/testbot/bin/build/Reconfig.pl index 32cbad7c7..c950d4974 100755 --- a/testbot/bin/build/Reconfig.pl +++ b/testbot/bin/build/Reconfig.pl @@ -41,6 +41,7 @@ sub BEGIN }
use WineTestBot::Config; +use WineTestBot::PatchUtils;
my $LogFileName = "$LogDir/Reconfig.log";
@@ -133,20 +134,11 @@ sub GitPull() return !1; }
- if (open(my $fh, ">", "$DataDir/testlist.txt")) + my $ErrMessage = UpdateWineData("$DataDir/wine"); + if ($ErrMessage) { - foreach my $TestFile (glob("$DataDir/wine/*/*/tests/*.c"), - glob("$DataDir/wine/*/*/tests/*.spec")) - { - next if ($TestFile =~ m=/testlist.c$=); - $TestFile =~ s=^$DataDir/wine/==; - print $fh "$TestFile\n"; - } - close($fh); - } - else - { - LogMsg "Could not open 'testlist.txt' for writing: $!\n"; + LogMsg "$ErrMessage\n"; + return !1; }
return 1; diff --git a/testbot/lib/WineTestBot/PatchUtils.pm b/testbot/lib/WineTestBot/PatchUtils.pm index 833394abe..3a555af9d 100644 --- a/testbot/lib/WineTestBot/PatchUtils.pm +++ b/testbot/lib/WineTestBot/PatchUtils.pm @@ -31,11 +31,42 @@ the Wine builds. =cut
use Exporter 'import'; -our @EXPORT = qw(GetPatchImpact); +our @EXPORT = qw(GetPatchImpact UpdateWineData);
use WineTestBot::Config;
+=pod +=over 12 + +=item C<UpdateWineData()> + +Updates the summary information about the Wine source such as the list of +tests (testlist.txt). + +=back +=cut + +sub UpdateWineData($) +{ + my ($WineDir) = @_; + + if (open(my $fh, ">", "$DataDir/testlist.txt")) + { + foreach my $TestFile (glob("$WineDir/*/*/tests/*.c"), + glob("$WineDir/*/*/tests/*.spec")) + { + next if ($TestFile =~ m=/testlist.c$=); + $TestFile =~ s=^$WineDir/==; + print $fh "$TestFile\n"; + } + close($fh); + return undef; + } + + return "Could not open 'testlist.txt' for writing: $!"; +} + =pod =over 12