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
The list can later be used by the TestBot to better identify Wine patches.
Signed-off-by: Francois Gouget fgouget@codeweavers.com --- testbot/lib/WineTestBot/PatchUtils.pm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/testbot/lib/WineTestBot/PatchUtils.pm b/testbot/lib/WineTestBot/PatchUtils.pm index 3a555af9d..14a598545 100644 --- a/testbot/lib/WineTestBot/PatchUtils.pm +++ b/testbot/lib/WineTestBot/PatchUtils.pm @@ -42,7 +42,7 @@ use WineTestBot::Config; =item C<UpdateWineData()>
Updates the summary information about the Wine source such as the list of -tests (testlist.txt). +tests (testlist.txt) and the full list of Wine files.
=back =cut @@ -51,6 +51,11 @@ sub UpdateWineData($) { my ($WineDir) = @_;
+ mkdir "$DataDir/latest" if (!-d "$DataDir/latest"); + + my $ErrMessage = `cd '$WineDir' && git ls-tree -r --name-only HEAD 2>&1 >'$DataDir/latest/winefiles.txt'`; + return $ErrMessage if ($? != 0); + if (open(my $fh, ">", "$DataDir/testlist.txt")) { foreach my $TestFile (glob("$WineDir/*/*/tests/*.c"),