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