Francois Gouget : testbot/build: Simplify Build.pl by reusing the patch analyser.
Alexandre Julliard
julliard at winehq.org
Tue May 29 12:31:59 CDT 2018
Module: tools
Branch: master
Commit: 6641ea6dea6368169786b3018525abb9f23775fa
URL: https://source.winehq.org/git/tools.git/?a=commit;h=6641ea6dea6368169786b3018525abb9f23775fa
Author: Francois Gouget <fgouget at codeweavers.com>
Date: Tue May 29 00:42:30 2018 +0200
testbot/build: Simplify Build.pl by reusing the patch analyser.
Also better identify patches that require rebuilding the native tools.
Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
testbot/bin/build/Build.pl | 41 +++++------------------------------
testbot/lib/WineTestBot/PatchUtils.pm | 31 +++++++++++++++++++++-----
2 files changed, 30 insertions(+), 42 deletions(-)
diff --git a/testbot/bin/build/Build.pl b/testbot/bin/build/Build.pl
index c72489c..5e6b370 100755
--- a/testbot/bin/build/Build.pl
+++ b/testbot/bin/build/Build.pl
@@ -40,6 +40,7 @@ sub BEGIN
}
use WineTestBot::Config;
+use WineTestBot::PatchUtils;
sub InfoMsg(@)
{
@@ -74,39 +75,6 @@ sub ApplyPatch($)
{
my ($PatchFile) = @_;
- my ($NeedMakeMakefiles, $NeedAutoconf, $HasConfigure, $NeedBuildNative);
- if (open (FH, "<$PatchFile"))
- {
- my $Line;
- while (defined($Line = <FH>) &&
- (!$NeedMakeMakefiles || !$NeedAutoconf || !$HasConfigure ||
- !$NeedBuildNative))
- {
- if ($Line =~ m=^diff.*(?:aclocal\.m4|configure\.ac)=)
- {
- $NeedAutoconf = 1;
- }
- elsif ($Line =~ m=^diff.*configure=)
- {
- $HasConfigure = 1;
- }
- elsif ($Line =~ m=^new file= || $Line =~ m=^deleted file= || $Line =~ m=^rename= ||
- $Line =~ m=diff.*tools/make_makefiles=)
- {
- $NeedMakeMakefiles = 1;
- }
- elsif ($Line =~ m=^diff.*tools/makedep\.c=)
- {
- $NeedMakeMakefiles = $NeedBuildNative = 1;
- }
- elsif ($Line =~ m=^diff.*tools/(?:makedep\.c|make_xftmpl\.c|sfnt2fon|winebuild|winegcc|widl|wmc|wrc)=)
- {
- $NeedBuildNative = 1;
- }
- }
- close FH;
- }
-
InfoMsg "Applying patch\n";
system("( cd $DataDir/wine && set -x && " .
" git apply --verbose $PatchFile && " .
@@ -118,7 +86,8 @@ sub ApplyPatch($)
return -1;
}
- if ($NeedMakeMakefiles)
+ my $Impacts = GetPatchImpact($PatchFile, "nounits");
+ if ($Impacts->{Makefiles})
{
InfoMsg "Running make_makefiles\n";
system("( cd $DataDir/wine && set -x && " .
@@ -131,7 +100,7 @@ sub ApplyPatch($)
}
}
- if ($NeedAutoconf && !$HasConfigure)
+ if ($Impacts->{Autoconf} && !$Impacts->{HasConfigure})
{
InfoMsg "Running autoconf\n";
system("( cd $DataDir/wine && set -x && " .
@@ -144,7 +113,7 @@ sub ApplyPatch($)
}
}
- return $NeedBuildNative;
+ return $Impacts->{Tools};
}
my $ncpus;
diff --git a/testbot/lib/WineTestBot/PatchUtils.pm b/testbot/lib/WineTestBot/PatchUtils.pm
index 74599ba..8dde61b 100644
--- a/testbot/lib/WineTestBot/PatchUtils.pm
+++ b/testbot/lib/WineTestBot/PatchUtils.pm
@@ -86,8 +86,8 @@ sub _AddTest($$$)
};
}
- # Assume makefile modifications may break the build but not the tests.
- return if ($File eq "Makefile.in");
+ # Assume makefile modifications may break the build but not the tests
+ return if ($File eq "Makefile.in" or $Impacts->{NoUnits});
if (!$Tests->{$Module}->{Files})
{
@@ -118,18 +118,37 @@ configure, whether it impacts the tests, etc.
=back
=cut
-sub GetPatchImpact($)
+sub GetPatchImpact($;$)
{
- my ($PatchFileName) = @_;
+ my ($PatchFileName, $NoUnits) = @_;
my $fh;
return undef if (!open($fh, "<", $PatchFileName));
- my $Impacts = { Tests => {} };
+ my $Impacts = {
+ NoUnits => $NoUnits,
+ Tests => {},
+ };
my ($Path, $Change);
while (my $Line = <$fh>)
{
- if ($Line =~ m=^--- /dev/null$=)
+ if ($Line =~ m=^--- \w+/(?:aclocal\.m4|configure\.ac)$=)
+ {
+ $Impacts->{Autoconf} = 1;
+ }
+ elsif ($Line =~ m=^--- \w+/configure$=)
+ {
+ $Impacts->{HasConfigure} = 1;
+ }
+ elsif ($Line =~ m=^--- \w+/tools/make_makefiles$=)
+ {
+ $Impacts->{Makefiles} = $Impacts->{Tools} = 1;
+ }
+ elsif ($Line =~ m=^--- \w+/tools/(?:makedep\.c|make_xftmpl\.c|sfnt2fon|winebuild|winegcc|widl|wmc|wrc)$=)
+ {
+ $Impacts->{Tools} = 1;
+ }
+ elsif ($Line =~ m=^--- /dev/null$=)
{
$Change = "new";
}
More information about the wine-cvs
mailing list