Bug 1790446 - Stop rewriting RNP config.h.in when updating the source from upstream. r=dandarnell

Differential Revision: https://phabricator.services.mozilla.com/D157151

--HG--
extra : rebase_source : 51e8a817c4ea1bb49f379785ee4d058b955643df
extra : histedit_source : 980ff3699015e8f6bf1eb0f51673af32b12a35e8
This commit is contained in:
Rob Lemley 2022-09-12 15:22:10 +00:00
Родитель 2238af4a32
Коммит f2e7148ccd
2 изменённых файлов: 3 добавлений и 30 удалений

Просмотреть файл

@ -13,7 +13,7 @@ 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:
@ -21,7 +21,6 @@ def rnp_source_update(rnp_root, version_str, revision, timestamp, bug_report):
: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
@ -38,16 +37,13 @@ def rnp_source_update(rnp_root, version_str, revision, timestamp, bug_report):
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)
@ -81,26 +77,6 @@ def generate_version_h(template, destination, defines):
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

7
third_party/update_rnp.sh поставляемый
Просмотреть файл

@ -44,8 +44,6 @@ 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}
@ -54,12 +52,11 @@ 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 \