Title: [125674] trunk/Tools
Revision
125674
Author
[email protected]
Date
2012-08-15 07:17:44 -0700 (Wed, 15 Aug 2012)

Log Message

[jhbuild] move md5sum checking to update-webkit-libs-jhbuild
https://bugs.webkit.org/show_bug.cgi?id=93208

Reviewed by Martin Robinson.

This change makes the md5sum check and saving be done by the script
that performs the dependencies update. build-webkit no longer prefixes
calls to commands with jhbuild-wrapper if jhbuild has not been
bootstrapped by the developer and --update-gtk is not given.

* Scripts/update-webkit-libs-jhbuild:
(getMD5HashForFile): moved from webkitdirs.
(jhbuildConfigurationChanged): ditto.
(saveJhbuildMd5): ditto.
(cleanJhbuild): ditto, and changed to run jhbuild clean before removing
jhbuild.
* Scripts/webkitdirs.pm:
(runAutogenForAutotoolsProjectIfNecessary): use jhbuildWrapperPrefixIfNeeded.
(buildAutotoolsProject): ditto.
(jhbuildWrapperPrefixIfNeeded): add a code branch for GTK+.
(generateBuildSystemFromCMakeProject): call update-webkitefl-libs
unconditionally for EFL.
* jhbuild/jhbuild-wrapper:
(update_webkit_libs_jhbuild): removed, jhbuild-wrapper no longer runs the
update script itself
(ensure_jhbuild): remove update call.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (125673 => 125674)


--- trunk/Tools/ChangeLog	2012-08-15 13:58:40 UTC (rev 125673)
+++ trunk/Tools/ChangeLog	2012-08-15 14:17:44 UTC (rev 125674)
@@ -1,3 +1,32 @@
+2012-08-14  Gustavo Noronha Silva  <[email protected]>
+
+        [jhbuild] move md5sum checking to update-webkit-libs-jhbuild
+        https://bugs.webkit.org/show_bug.cgi?id=93208
+
+        Reviewed by Martin Robinson.
+
+        This change makes the md5sum check and saving be done by the script
+        that performs the dependencies update. build-webkit no longer prefixes
+        calls to commands with jhbuild-wrapper if jhbuild has not been
+        bootstrapped by the developer and --update-gtk is not given.
+
+        * Scripts/update-webkit-libs-jhbuild:
+        (getMD5HashForFile): moved from webkitdirs.
+        (jhbuildConfigurationChanged): ditto.
+        (saveJhbuildMd5): ditto.
+        (cleanJhbuild): ditto, and changed to run jhbuild clean before removing
+        jhbuild.
+        * Scripts/webkitdirs.pm:
+        (runAutogenForAutotoolsProjectIfNecessary): use jhbuildWrapperPrefixIfNeeded.
+        (buildAutotoolsProject): ditto.
+        (jhbuildWrapperPrefixIfNeeded): add a code branch for GTK+.
+        (generateBuildSystemFromCMakeProject): call update-webkitefl-libs
+        unconditionally for EFL.
+        * jhbuild/jhbuild-wrapper:
+        (update_webkit_libs_jhbuild): removed, jhbuild-wrapper no longer runs the
+        update script itself
+        (ensure_jhbuild): remove update call.
+
 2012-08-15  Christophe Dumez  <[email protected]>
 
         [WK2] Add support for Web Intents MessagePorts

Modified: trunk/Tools/Scripts/update-webkit-libs-jhbuild (125673 => 125674)


--- trunk/Tools/Scripts/update-webkit-libs-jhbuild	2012-08-15 13:58:40 UTC (rev 125673)
+++ trunk/Tools/Scripts/update-webkit-libs-jhbuild	2012-08-15 14:17:44 UTC (rev 125674)
@@ -41,6 +41,56 @@
     }
 }
 
+sub getMD5HashForFile($)
+{
+    my $file = shift;
+
+    open(FILE_CONTENTS, $file);
+
+    my $contents = "";
+    while (<FILE_CONTENTS>) {
+        $contents .= $_;
+    }
+
+    close(FILE_CONTENTS);
+
+    return md5_hex($contents);
+}
+
+sub jhbuildConfigurationChanged()
+{
+    foreach my $file (qw(jhbuildrc jhbuild.modules)) {
+        my $path = join('/', getJhbuildPath(), $file . '.md5sum');
+        if (! -e $path) {
+            return 1;
+        }
+
+        # Get the md5 sum of the file we're testing, look in the right platform directory.
+        my $actualFile = join('/', sourceDir(), 'Tools', $platform, $file);
+        my $currentSum = getMD5HashForFile($actualFile);
+
+        # Get our previous record.
+        open(PREVIOUS_MD5, $path);
+        chomp(my $previousSum = <PREVIOUS_MD5>);
+        close(PREVIOUS_MD5);
+
+        if ($previousSum ne $currentSum) {
+            return 1;
+        }
+    }
+}
+
+sub saveJhbuildMd5() {
+    # Save md5sum for jhbuild-related files.saveJhbuildMd5();
+    foreach my $file (qw(jhbuildrc jhbuild.modules)) {
+        my $source = join('/', sourceDir(), "Tools", $platform, $file);
+        my $destination = join('/', getJhbuildPath(), $file);
+        open(SUM, ">$destination" . ".md5sum");
+        print SUM getMD5HashForFile($source);
+        close(SUM);
+    }
+}
+
 sub runJhbuild
 {
     my $command = shift;
@@ -49,10 +99,30 @@
     system(@jhbuildArgs) == 0 or die "Running jhbuild-wrapper " . $command . " failed.\n";
 }
 
+sub cleanJhbuild()
+{
+    runJhbuild("clean");
+
+    # If the configuration changed, dependencies may have been removed.
+    # Since we lack a granular way of uninstalling those we wipe out the
+    # jhbuild root and start from scratch.
+    my $jhbuildPath = getJhbuildPath();
+    if (system("rm -rf $jhbuildPath/Root") ne 0) {
+        die "Cleaning jhbuild root failed!";
+    }
+}
+
 delete $ENV{AR_FLAGS} if exists $ENV{AR_FLAGS};
 
 chdir(relativeScriptsDir() . "/../jhbuild") or die $!;
 
 my %prettyPlatform = ( "efl" => "EFL", "gtk" => "GTK+" );
+
+if (-e getJhbuildPath() && jhbuildConfigurationChanged()) {
+    cleanJhbuild();
+}
+
 print "Updating " . $prettyPlatform{$platform} . " port dependencies using jhbuild...\n";
 runJhbuild("build");
+
+saveJhbuildMd5();

Modified: trunk/Tools/Scripts/webkitdirs.pm (125673 => 125674)


--- trunk/Tools/Scripts/webkitdirs.pm	2012-08-15 13:58:40 UTC (rev 125673)
+++ trunk/Tools/Scripts/webkitdirs.pm	2012-08-15 14:17:44 UTC (rev 125674)
@@ -1894,23 +1894,6 @@
     return $prefix . '-' . $feature;
 }
 
-sub getMD5HashForFile($)
-{
-    my $file = shift;
-
-    open(FILE_CONTENTS, $file);
-
-    # Read the whole file.
-    my $contents = "";
-    while (<FILE_CONTENTS>) {
-        $contents .= $_;
-    }
-
-    close(FILE_CONTENTS);
-
-    return md5_hex($contents);
-}
-
 sub runAutogenForAutotoolsProjectIfNecessary($@)
 {
     my ($dir, $prefix, $sourceDir, $project, @buildArgs) = @_;
@@ -1954,7 +1937,7 @@
 
     # Prefix the command with jhbuild run.
     unshift(@buildArgs, "$relSourceDir/autogen.sh");
-    unshift(@buildArgs, "$sourceDir/Tools/gtk/run-with-jhbuild");
+    unshift(@buildArgs, jhbuildWrapperPrefixIfNeeded());
     if (system(@buildArgs) ne 0) {
         die "Calling autogen.sh failed!\n";
     }
@@ -1965,58 +1948,6 @@
     return join('/', baseProductDir(), "Dependencies");
 }
 
-sub jhbuildConfigurationChanged()
-{
-    foreach my $file (qw(jhbuildrc.md5sum jhbuild.modules.md5sum)) {
-        my $path = join('/', getJhbuildPath(), $file);
-        if (! -e $path) {
-            return 1;
-        }
-
-        # Get the md5 sum of the file we're testing, look in the right platform directory.
-        $file =~ m/(.+)\.md5sum/;
-        my $platformDir = isEfl() ? 'efl' : 'gtk';
-        my $actualFile = join('/', $sourceDir, 'Tools', $platformDir, $1);
-        my $currentSum = getMD5HashForFile($actualFile);
-
-        # Get our previous record.
-        open(PREVIOUS_MD5, $path);
-        chomp(my $previousSum = <PREVIOUS_MD5>);
-        close(PREVIOUS_MD5);
-
-        if ($previousSum ne $currentSum) {
-            return 1;
-        }
-    }
-}
-
-sub saveJhbuildMd5() {
-    my $platform = isEfl() ? 'efl' : 'gtk';
-    # Save md5sum for jhbuild-related files.
-    foreach my $file (qw(jhbuildrc jhbuild.modules)) {
-        my $source = join('/', $sourceDir, "Tools", $platform, $file);
-        my $destination = join('/', getJhbuildPath(), $file);
-        open(SUM, ">$destination" . ".md5sum");
-        print SUM getMD5HashForFile($source);
-        close(SUM);
-    }
-}
-
-sub cleanJhbuild() {
-        # If the configuration changed, dependencies may have been removed.
-        # Since we lack a granular way of uninstalling those we wipe out the
-        # jhbuild root and start from scratch.
-        my $jhbuildPath = getJhbuildPath();
-        if (system("rm -rf $jhbuildPath/Root") ne 0) {
-            die "Cleaning jhbuild root failed!";
-        }
-
-        my $platform = isEfl() ? 'efl' : 'gtk';
-        if (system("perl $sourceDir/Tools/jhbuild/jhbuild-wrapper --$platform clean") ne 0) {
-            die "Cleaning jhbuild modules failed!";
-        }
-}
-
 sub mustReRunAutogen($@)
 {
     my ($sourceDir, $filename, @currentArguments) = @_;
@@ -2106,33 +2037,19 @@
     # Enable unstable features when building through build-webkit.
     push @buildArgs, "--enable-unstable-features";
 
-    # We might need to update jhbuild dependencies.
-    my $needUpdate = 0;
-    if (jhbuildConfigurationChanged()) {
-        cleanJhbuild();
-        $needUpdate = 1;
-    }
-
     if (checkForArgumentAndRemoveFromArrayRef("--update-gtk", \@buildArgs)) {
-        $needUpdate = 1;
-    }
-
-    if ($needUpdate) {
         # Force autogen to run, to catch the possibly updated libraries.
         system("rm -f previous-autogen-arguments.txt");
 
         system("perl", "$sourceDir/Tools/Scripts/update-webkitgtk-libs") == 0 or die $!;
     }
 
-    saveJhbuildMd5();
-
     # If GNUmakefile exists, don't run autogen.sh unless its arguments
     # have changed. The makefile should be smart enough to track autotools
     # dependencies and re-run autogen.sh when build files change.
     runAutogenForAutotoolsProjectIfNecessary($dir, $prefix, $sourceDir, $project, @buildArgs);
 
-    my $gtkScriptsPath = "$sourceDir/Tools/gtk";
-    my $runWithJhbuild = "$gtkScriptsPath/run-with-jhbuild";
+    my $runWithJhbuild = jhbuildWrapperPrefixIfNeeded();
     if (system("$runWithJhbuild $make $makeArgs") ne 0) {
         die "\nFailed to build WebKit using '$make'!\n";
     }
@@ -2140,7 +2057,7 @@
     chdir ".." or die;
 
     if ($project eq 'WebKit' && !isCrossCompilation()) {
-        my @docGenerationOptions = ($runWithJhbuild, "$gtkScriptsPath/generate-gtkdoc", "--skip-html");
+        my @docGenerationOptions = ($runWithJhbuild, "$sourceDir/Tools/gtk/generate-gtkdoc", "--skip-html");
         push(@docGenerationOptions, productDir());
 
         if (system(@docGenerationOptions)) {
@@ -2155,6 +2072,11 @@
 {
     if (isEfl()) {
         return File::Spec->catfile(sourceDir(), "Tools", "efl", "run-with-jhbuild");
+    } elsif (isGtk()) {
+        if (-e getJhbuildPath()) {
+            return File::Spec->catfile(sourceDir(), "Tools", "gtk", "run-with-jhbuild");
+        }
+        return "env";
     }
     return "";
 }
@@ -2195,15 +2117,10 @@
         $ENV{'CXXFLAGS'} = "-march=pentium4 -msse2 -mfpmath=sse " . ($ENV{'CXXFLAGS'} || "");
     }
 
-    if (isEfl() && jhbuildConfigurationChanged()) {
-        cleanJhbuild();
+    if (isEfl()) {
         system("perl", "$sourceDir/Tools/Scripts/update-webkitefl-libs") == 0 or die $!;
     }
 
-    if (isEfl()) {
-        saveJhbuildMd5();
-    }
-
     # We call system("cmake @args") instead of system("cmake", @args) so that @args is
     # parsed for shell metacharacters.
     my $wrapper = jhbuildWrapperPrefixIfNeeded() . " ";

Modified: trunk/Tools/jhbuild/jhbuild-wrapper (125673 => 125674)


--- trunk/Tools/jhbuild/jhbuild-wrapper	2012-08-15 13:58:40 UTC (rev 125673)
+++ trunk/Tools/jhbuild/jhbuild-wrapper	2012-08-15 14:17:44 UTC (rev 125674)
@@ -90,13 +90,6 @@
         raise Exception('jhbuild configure failed with return code: %i' % process.returncode)
 
 
-def update_webkit_libs_jhbuild(platform):
-    process = subprocess.Popen([jhbuildutils.top_level_path('Tools', 'Scripts', 'update-webkit-libs-jhbuild'), '--' + platform])
-    process.wait()
-    if process.returncode != 0:
-        raise Exception('jhbuild configure failed with return code: %i' % process.returncode)
-
-
 def determine_platform():
     if '--efl' in sys.argv:
         return "efl";
@@ -110,7 +103,6 @@
         clone_jhbuild()
         update_jhbuild()
         install_jhbuild()
-        update_webkit_libs_jhbuild(platform)
     elif not jhbuild_installed() \
             or not jhbuild_at_expected_revision():
         update_jhbuild()
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to