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