119 lines
4.1 KiB
Diff
119 lines
4.1 KiB
Diff
# HG changeset patch
|
|
# User Rob Lemley <rob@thunderbird.net>
|
|
# Date 1662996130 0
|
|
# Mon Sep 12 15:22:10 2022 +0000
|
|
# Node ID 5dfb405f325609c62215f9d74e01dba029b84611
|
|
# Parent 9998ed5c2bcee289b03828eba670053614fa26da
|
|
Bug 1790446 - Stop rewriting RNP config.h.in when updating the source from upstream. r=dandarnell
|
|
|
|
Differential Revision: https://phabricator.services.mozilla.com/D157151
|
|
|
|
diff --git a/comm/python/thirdroc/thirdroc/rnp.py b/comm/python/thirdroc/thirdroc/rnp.py
|
|
--- a/comm/python/thirdroc/thirdroc/rnp.py
|
|
+++ b/comm/python/thirdroc/thirdroc/rnp.py
|
|
@@ -11,19 +11,18 @@ import re
|
|
from packaging.version import parse
|
|
|
|
from mozbuild.preprocessor import Preprocessor
|
|
|
|
|
|
-def rnp_source_update(rnp_root, version_str, revision, timestamp, bug_report):
|
|
+def rnp_source_update(rnp_root, version_str, revision, timestamp):
|
|
"""
|
|
Update RNP source files: generate version.h and mangle config.h.in
|
|
:param rnp_root:
|
|
:type rnp_root:
|
|
:param string version_str: latest version
|
|
:param string revision: revision hash (short form)
|
|
:param float timestamp: UNIX timestamp from revision
|
|
- :param string bug_report: where to report bugs for this RNP build
|
|
"""
|
|
version = parse(version_str)
|
|
version_major = version.major
|
|
version_minor = version.minor
|
|
version_patch = version.micro
|
|
@@ -36,20 +35,17 @@ def rnp_source_update(rnp_root, version_
|
|
RNP_VERSION_MINOR=version_minor,
|
|
RNP_VERSION_PATCH=version_patch,
|
|
RNP_VERSION=version_str,
|
|
RNP_VERSION_FULL=version_full,
|
|
RNP_VERSION_COMMIT_TIMESTAMP=str(timestamp),
|
|
- BUGREPORT_EMAIL=bug_report,
|
|
)
|
|
src_lib = os.path.join(rnp_root, "src", "lib")
|
|
version_h_in = os.path.join(src_lib, "version.h.in")
|
|
version_h = os.path.join(src_lib, "version.h")
|
|
- config_h_in = os.path.join(src_lib, "config.h.in")
|
|
readme_rnp = os.path.join(rnp_root, "..", "README.rnp")
|
|
|
|
generate_version_h(version_h_in, version_h, defines)
|
|
- mangle_config_h_in(config_h_in, defines)
|
|
update_readme(readme_rnp, revision)
|
|
|
|
|
|
def rnp_preprocess(tmpl, dest, defines):
|
|
"""
|
|
@@ -79,30 +75,10 @@ def generate_version_h(template, destina
|
|
with open(template) as tmpl:
|
|
with open(destination, "w") as dest:
|
|
rnp_preprocess(tmpl, dest, defines)
|
|
|
|
|
|
-def mangle_config_h_in(template, defines):
|
|
- """
|
|
- Mangle RNP's config.h.in so that it will work with CONFIGURE_DEFINE_FILES
|
|
- :param string template: path to config.h.in
|
|
- :param dict defines: result of get_defines()
|
|
- """
|
|
- with open(template) as tmpl:
|
|
- tmp_string = StringIO()
|
|
- rnp_preprocess(tmpl, tmp_string, defines)
|
|
-
|
|
- tmp_string.seek(0)
|
|
-
|
|
- with open(template, "w") as dest:
|
|
- for line in tmp_string:
|
|
- if line.startswith("#cmakedefine"):
|
|
- line = line.replace("#cmakedefine", "#undef")
|
|
- dest.write(line)
|
|
- dest.write("\n")
|
|
-
|
|
-
|
|
def update_readme(path, revision):
|
|
"""
|
|
Updates the commit hash in README.rnp
|
|
:param string path: Path to README.rnp
|
|
:param string revision: revision to insert
|
|
diff --git a/comm/third_party/update_rnp.sh b/comm/third_party/update_rnp.sh
|
|
--- a/comm/third_party/update_rnp.sh
|
|
+++ b/comm/third_party/update_rnp.sh
|
|
@@ -42,26 +42,23 @@ TAGLIST=$(git -C "${RNPgit}" tag --list
|
|
|
|
LATEST_VERSION=$($THIRDROC latest_version $TAGLIST)
|
|
REVISION=$(git -C "${RNPgit}" rev-parse --verify HEAD)
|
|
TIMESTAMP=$(git -C "${RNPgit}" show -s --format=%ct)
|
|
|
|
-BUGREPORT="https://bugzilla.mozilla.org/enter_bug.cgi?product=Thunderbird"
|
|
-
|
|
# Cleanup rnp checkout
|
|
rm -rf ${RNPgit}/{.git,.github,.cirrus.yml,.clang-format,.gitignore}
|
|
rm -rf ${RNPgit}/{_config.yml,docker.sh,ci,cmake,git-hooks,travis.sh,vcpkg.txt}
|
|
rm -rf ${RNPgit}/{Brewfile,CMakeLists.txt,CMakeSettings.json}
|
|
|
|
# Do the switch
|
|
rm -rf rnp
|
|
mv "${RNPgit}" rnp
|
|
-# Build version.h/config.h.in
|
|
+# Build version.h
|
|
$THIRDROC rnp_source_update rnp/ \
|
|
"${LATEST_VERSION}" \
|
|
"${REVISION}" \
|
|
- "${TIMESTAMP}" \
|
|
- "${BUGREPORT}"
|
|
+ "${TIMESTAMP}"
|
|
|
|
# Restore moz.build
|
|
hg revert rnp/moz.build rnp/module.ver rnp/rnp.symbols rnp/src/lib/rnp/rnp_export.h \
|
|
rnp/src/rnp/moz.build rnp/src/rnpkeys/moz.build
|
|
|