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