⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 280590 in webkit


Ignore:
Timestamp:
Aug 3, 2021, 6:26:20 AM (5 years ago)
Author:
Philippe Normand
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):

Location:
trunk/Tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r280576 r280590  
     12021-08-03  Philippe Normand  <pnormand@igalia.com>
     2
     3        [WPE][GTK] SVN_REVISION drifting away if bots don't re-run cmake
     4        https://bugs.webkit.org/show_bug.cgi?id=228290
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        The apply-build-revision-to-files.py script wasn't expanding the BUILD_REVISION beyond the
     9        first run, because it processes files generated by CMake already, and expanding the
     10        BUILD_REVISION once prevents further expansions. So the proposed solution is to always
     11        expand BuildRevision.h.in from that script, and for .pc files, to restore the BUILD_REVISION
     12        template before updating the file.
     13
     14        * glib/apply-build-revision-to-files.py:
     15        (main):
     16
    1172021-08-02  Peng Liu  <peng.liu6@apple.com>
    218
  • trunk/Tools/glib/apply-build-revision-to-files.py

    r280466 r280590  
    2727from webkitpy.common.system.filesystem import FileSystem  # nopep8
    2828
    29 
    3029def main(args):
    3130    scm = SCMDetector(FileSystem(), Executive()).default_scm()
     
    3433
    3534    for in_file in args:
    36         with open(in_file) as fd:
    37             data = fd.read().replace('${BUILD_REVISION}', build_revision)
     35        filename = os.path.basename(in_file)
     36        _, extension = os.path.splitext(filename)
     37        if filename == "BuildRevision.h":
     38            with open("Source/WebKit/Shared/glib/BuildRevision.h.in") as template:
     39                data = template.read()
     40        elif extension == '.pc':
     41            # Restore a valid BUILD_REVISION template.
     42            lines = []
     43            with open(in_file) as fd:
     44                for line in fd.readlines():
     45                    if line.startswith("revision"):
     46                        line = "revision=${BUILD_REVISION}\n"
     47                    lines.append(line)
     48            data = "".join(lines)
     49        else:
     50            print("Support for expanding $BUILD_REVISION in {} is missing.".format(in_file))
     51            return 1
     52
    3853        with open(in_file, 'w') as fd:
    39             fd.write(data)
     54            fd.write(data.replace('${BUILD_REVISION}', build_revision))
    4055
    4156    return 0
Note: See TracChangeset for help on using the changeset viewer.