Title: [223536] trunk/Tools
Revision
223536
Author
[email protected]
Date
2017-10-17 06:54:55 -0700 (Tue, 17 Oct 2017)

Log Message

[GStreamer][GTK][WPE] update-webkit-libs-jhbuild fails to detect changes in included moduleset files
https://bugs.webkit.org/show_bug.cgi?id=178206

Reviewed by Michael Catanzaro.

The update-webkit-libs-jhbuild scripts computes MD5 sum of GTK/WPE jhbuild configuration files to check if it
needs to rebuild the dependencies libraries. This patch fixes a bug when main GTK/WPE jhbuild modules
configuration file includes additional files (for example GStreamer module). It parses jhbuild.modules file to
check if additional files are included. If any, it computes MD5 sum for each of these included files.

* Scripts/update-webkit-libs-jhbuild:
(getJhbuildIncludedFilePaths): New function that returns included files in jhbuild.modules
(jhbuildConfigurationCheckFile): New function to check if MD5 sum file changes.
(jhbuildConfigurationChanged): Add MD5 sum check for included files.
(saveMd5File): New function to save MD5 sum of a file.
(saveJhbuildMd5): Add saving included files MD5 sum.
(deleteJhbuildMd5): Delete included files MD5 sum
* gtk/install-dependencies: Add perl-libXML lib that is used to parse jhbuild file.
* wpe/install-dependencies: Ditto.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (223535 => 223536)


--- trunk/Tools/ChangeLog	2017-10-17 13:14:09 UTC (rev 223535)
+++ trunk/Tools/ChangeLog	2017-10-17 13:54:55 UTC (rev 223536)
@@ -1,3 +1,25 @@
+2017-10-17  Nael Ouedraogo  <[email protected]>
+
+        [GStreamer][GTK][WPE] update-webkit-libs-jhbuild fails to detect changes in included moduleset files
+        https://bugs.webkit.org/show_bug.cgi?id=178206
+
+        Reviewed by Michael Catanzaro.
+
+        The update-webkit-libs-jhbuild scripts computes MD5 sum of GTK/WPE jhbuild configuration files to check if it
+        needs to rebuild the dependencies libraries. This patch fixes a bug when main GTK/WPE jhbuild modules
+        configuration file includes additional files (for example GStreamer module). It parses jhbuild.modules file to
+        check if additional files are included. If any, it computes MD5 sum for each of these included files.
+
+        * Scripts/update-webkit-libs-jhbuild:
+        (getJhbuildIncludedFilePaths): New function that returns included files in jhbuild.modules
+        (jhbuildConfigurationCheckFile): New function to check if MD5 sum file changes.
+        (jhbuildConfigurationChanged): Add MD5 sum check for included files.
+        (saveMd5File): New function to save MD5 sum of a file.
+        (saveJhbuildMd5): Add saving included files MD5 sum.
+        (deleteJhbuildMd5): Delete included files MD5 sum
+        * gtk/install-dependencies: Add perl-libXML lib that is used to parse jhbuild file.
+        * wpe/install-dependencies: Ditto.
+
 2017-10-17  Tomas Popela  <[email protected]>
 
         Undefined WK_API_ENABLED warning when compiling COCOA content on WebKitGTK+

Modified: trunk/Tools/Scripts/update-webkit-libs-jhbuild (223535 => 223536)


--- trunk/Tools/Scripts/update-webkit-libs-jhbuild	2017-10-17 13:14:09 UTC (rev 223535)
+++ trunk/Tools/Scripts/update-webkit-libs-jhbuild	2017-10-17 13:54:55 UTC (rev 223536)
@@ -2,6 +2,7 @@
 # Copyright (C) 2011 Igalia S.L.
 # Copyright (C) 2012 Intel Corporation
 # Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies).
+# Copyright (C) 2016 Canon Inc.
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -21,6 +22,7 @@
 use lib $FindBin::Bin;
 use webkitdirs;
 use Getopt::Long qw(:config pass_through);
+use XML::LibXML;
 
 my $platform = "";
 $platform = "gtk" if isGtk();
@@ -38,6 +40,18 @@
     'force' => \$force
 );
 
+sub getJhbuildIncludedFilePaths
+{
+    my $jhbuildFile = shift;
+    my $dom = XML::LibXML->load_xml(location => $jhbuildFile);
+    my @includes;
+
+    foreach my $includeFile ($dom->findnodes('/moduleset/include/@href')) {
+        push(@includes, $includeFile->to_literal());
+    }
+    return @includes;
+}
+
 sub getMD5HashForFile($)
 {
     my $file = shift;
@@ -54,39 +68,65 @@
     return md5_hex($contents);
 }
 
-sub jhbuildConfigurationChanged()
+sub jhbuildConfigurationCheckFile
 {
-    foreach my $file (qw(jhbuildrc jhbuild.modules)) {
-        my $path = join('/', getJhbuildPath(), $file . '.md5sum');
-        if (! -e $path) {
-            return 1;
-        }
+    my $file = shift;
+    my $path = join('/', getJhbuildPath(), $platform, $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 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);
+    # Get our previous record.
+    open(PREVIOUS_MD5, $path);
+    chomp(my $previousSum = <PREVIOUS_MD5>);
+    close(PREVIOUS_MD5);
 
-        if ($previousSum ne $currentSum) {
+    if ($previousSum ne $currentSum) {
+        return 1;
+    }
+}
+
+sub jhbuildConfigurationChanged()
+{
+    my $jhbuildMain = join('/', sourceDir(), 'Tools', $platform, 'jhbuild.modules');
+    my @jhbuildFiles = qw(jhbuildrc jhbuild.modules);
+    push(@jhbuildFiles, getJhbuildIncludedFilePaths($jhbuildMain));
+
+    foreach my $file (@jhbuildFiles) {
+        if (jhbuildConfigurationCheckFile($file)) {
             return 1;
         }
     }
 }
 
+sub saveMd5File
+{
+    my $file = shift;
+    my $path = realpath(dirname(join('/', getJhbuildPath(), $platform, $file)));
+    (-d $path) || mkpath $path;
+
+    $path = join('/', getJhbuildPath(), $platform);
+    my $source = join('/', sourceDir(), "Tools", $platform, $file);
+    my $destination = join('/', $path, $file);
+    open(SUM, ">$destination" . ".md5sum");
+    print SUM getMD5HashForFile($source);
+    close(SUM);
+}
+
 sub saveJhbuildMd5() {
     # Save md5sum for jhbuild-related files.saveJhbuildMd5();
     my $jhbuildPath = getJhbuildPath();
+    my $jhbuildMain = join('/', sourceDir(), 'Tools', $platform, 'jhbuild.modules');
+    my @jhbuildFiles = qw(jhbuildrc jhbuild.modules);
+    push(@jhbuildFiles, getJhbuildIncludedFilePaths($jhbuildMain));
+
     (-d $jhbuildPath) || mkpath $jhbuildPath;
-    foreach my $file (qw(jhbuildrc jhbuild.modules)) {
-        my $source = join('/', sourceDir(), "Tools", $platform, $file);
-        my $destination = join('/', $jhbuildPath, $file);
-        open(SUM, ">$destination" . ".md5sum");
-        print SUM getMD5HashForFile($source);
-        close(SUM);
+    foreach my $file (@jhbuildFiles) {
+        saveMd5File($file);
     }
 }
 
@@ -95,8 +135,13 @@
     if (!-d $jhbuildPath) {
         return;
     }
-    foreach my $file (qw(jhbuildrc jhbuild.modules)) {
-        my $md5File = join('/', $jhbuildPath, $file) . ".md5sum";
+
+    my $jhbuildMain = join('/', sourceDir(), 'Tools', $platform, 'jhbuild.modules');
+    my @jhbuildFiles = qw(jhbuildrc jhbuild.modules);
+    push(@jhbuildFiles, getJhbuildIncludedFilePaths($jhbuildMain));
+
+    foreach my $file (@jhbuildFiles) {
+        my $md5File = join('/', $jhbuildPath, $platform, $file) . ".md5sum";
         unlink($md5File) if -e $md5File;
     }
 }

Modified: trunk/Tools/gtk/install-dependencies (223535 => 223536)


--- trunk/Tools/gtk/install-dependencies	2017-10-17 13:14:09 UTC (rev 223535)
+++ trunk/Tools/gtk/install-dependencies	2017-10-17 13:54:55 UTC (rev 223536)
@@ -203,6 +203,7 @@
         libxkbcommon-x11-dev \
         libtool-bin \
         libudev-dev \
+        libxml-libxml-perl \
         python-dev \
         ragel \
         x11proto-bigreqs-dev \
@@ -351,6 +352,7 @@
         libxkbcommon-x11 \
         mtdev \
         orc \
+        perl-xml-libxml\
         python2 \
         python2-lxml \
         ragel \
@@ -494,6 +496,7 @@
         mesa-libEGL-devel \
         mtdev-devel \
         orc-devel \
+        perl-libxml-perl \
         ragel \
         systemd-devel \
         xorg-x11-font-utils \

Modified: trunk/Tools/wpe/install-dependencies (223535 => 223536)


--- trunk/Tools/wpe/install-dependencies	2017-10-17 13:14:09 UTC (rev 223535)
+++ trunk/Tools/wpe/install-dependencies	2017-10-17 13:54:55 UTC (rev 223536)
@@ -120,6 +120,7 @@
         libvorbis-dev \
         libvpx-dev \
         libxcb-xkb-dev \
+        libxml-libxml-perl \
         luajit"
 
     # These are dependencies necessary for using webkit-patch
@@ -207,6 +208,7 @@
         mesa-libgl \
         opus \
         orc \
+        perl-xml-libxml\
         v4l-utils"
 
     # These are dependencies necessary for using webkit-patch
@@ -284,6 +286,7 @@
         mesa-libGLES-devel \
         opus-devel \
         orc-devel \
+        perl-libxml-perl \
         pulseaudio-libs-devel"
 
     # These are dependencies necessary for using webkit-patch
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to