Title: [280590] trunk/Tools
Revision
280590
Author
[email protected]
Date
2021-08-03 06:26:20 -0700 (Tue, 03 Aug 2021)

Log Message

[WPE][GTK] SVN_REVISION drifting away if bots don't re-run cmake
https://bugs.webkit.org/show_bug.cgi?id=228290

Reviewed by Michael Catanzaro.

The apply-build-revision-to-files.py script wasn't expanding the BUILD_REVISION beyond the
first run, because it processes files generated by CMake already, and expanding the
BUILD_REVISION once prevents further expansions. So the proposed solution is to always
expand BuildRevision.h.in from that script, and for .pc files, to restore the BUILD_REVISION
template before updating the file.

* glib/apply-build-revision-to-files.py:
(main):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (280589 => 280590)


--- trunk/Tools/ChangeLog	2021-08-03 13:15:40 UTC (rev 280589)
+++ trunk/Tools/ChangeLog	2021-08-03 13:26:20 UTC (rev 280590)
@@ -1,3 +1,19 @@
+2021-08-03  Philippe Normand  <[email protected]>
+
+        [WPE][GTK] SVN_REVISION drifting away if bots don't re-run cmake
+        https://bugs.webkit.org/show_bug.cgi?id=228290
+
+        Reviewed by Michael Catanzaro.
+
+        The apply-build-revision-to-files.py script wasn't expanding the BUILD_REVISION beyond the
+        first run, because it processes files generated by CMake already, and expanding the
+        BUILD_REVISION once prevents further expansions. So the proposed solution is to always
+        expand BuildRevision.h.in from that script, and for .pc files, to restore the BUILD_REVISION
+        template before updating the file.
+
+        * glib/apply-build-revision-to-files.py:
+        (main):
+
 2021-08-02  Peng Liu  <[email protected]>
 
         [GPUP] RemoteAudioSession::setPreferredBufferSize() does not change its preferredBufferSize

Modified: trunk/Tools/glib/apply-build-revision-to-files.py (280589 => 280590)


--- trunk/Tools/glib/apply-build-revision-to-files.py	2021-08-03 13:15:40 UTC (rev 280589)
+++ trunk/Tools/glib/apply-build-revision-to-files.py	2021-08-03 13:26:20 UTC (rev 280590)
@@ -26,7 +26,6 @@
 from webkitpy.common.system.executive import Executive  # nopep8
 from webkitpy.common.system.filesystem import FileSystem  # nopep8
 
-
 def main(args):
     scm = SCMDetector(FileSystem(), Executive()).default_scm()
     svn_revision = scm.head_svn_revision()
@@ -33,10 +32,26 @@
     build_revision = "r{}".format(svn_revision)
 
     for in_file in args:
-        with open(in_file) as fd:
-            data = "" build_revision)
+        filename = os.path.basename(in_file)
+        _, extension = os.path.splitext(filename)
+        if filename == "BuildRevision.h":
+            with open("Source/WebKit/Shared/glib/BuildRevision.h.in") as template:
+                data = ""
+        elif extension == '.pc':
+            # Restore a valid BUILD_REVISION template.
+            lines = []
+            with open(in_file) as fd:
+                for line in fd.readlines():
+                    if line.startswith("revision"):
+                        line = "revision=${BUILD_REVISION}\n"
+                    lines.append(line)
+            data = ""
+        else:
+            print("Support for expanding $BUILD_REVISION in {} is missing.".format(in_file))
+            return 1
+
         with open(in_file, 'w') as fd:
-            fd.write(data)
+            fd.write(data.replace('${BUILD_REVISION}', build_revision))
 
     return 0
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to