diff options
author | Abseil Team <absl-team@google.com> | 2021-03-17 20:08:11 -0700 |
---|---|---|
committer | Dino Radaković <dinor@google.com> | 2021-03-18 08:44:23 -0700 |
commit | dcf4899377ca63246efb17f5468c40913855777c (patch) | |
tree | 65a6ae9798857f7197b650448a31824175c74ad0 /create_lts.py | |
parent | 2e9532cc6c701a8323d0cffb468999ab804095ab (diff) |
Export of internal Abseil changes
--
8e75347c10d85112296811be6ef35761744ad9bc by Derek Mauro <dmauro@google.com>:
Big update to LTS release process
* Add create_lts.py script to to the LTS modification
This is simpler than copybara since very few changes are needed
* Use the default installation paths instead of a versioned path.
If a versioned path is needed, this is easy to change on the commandline.
* Make the integration test use the LTS transformed version
* Test both static and dynamic linking (fixes pkg-config dynamic linking)
PiperOrigin-RevId: 363566934
--
e00e971a2de3138861f5e1900201c9cc7788f714 by Laramie Leavitt <lar@google.com>:
Add a non-compile test to absl::BitGenRef for temporaries.
PiperOrigin-RevId: 363437284
--
3685644ec115d99789de32aceb76c32a00756fea by Derek Mauro <dmauro@google.com>:
Make OSS code consistent with internal code by using the forward
declaration of absl::Status that contains ABSL_MUST_USE_RESULT.
PiperOrigin-RevId: 363426906
--
b85fec142c3aa3f632fa985f9f8f73a253819723 by Evan Brown <ezb@google.com>:
Move raw_hash_set::infoz_ into raw_hash_set::settings_. This reduces the size of raw_hash_sets by alignof(size_t) bytes when hashtablez is disabled.
PiperOrigin-RevId: 363034264
--
c6fde3b17e5845191eb8b2bfc1760c8bfb9573ff by Mark Barolak <mbar@google.com>:
Internal change
PiperOrigin-RevId: 362990378
--
81713cf964905b43d1cbe32ce5fed97539029625 by Abseil Team <absl-team@google.com>:
Fix typo in comment (execeptions -> exceptions).
PiperOrigin-RevId: 362946191
--
3ee92ca470feca44da417b03ee45a915c6eb5155 by Abseil Team <absl-team@google.com>:
Add absl::FindAndReportLeaks and routes it to the corresponding
__lsan_do_recoverable_leak_check.
PiperOrigin-RevId: 362622199
--
b95b7194b20e02c20d72289fbc79a0d35b82e256 by Abseil Team <absl-team@google.com>:
Add `kWithEverything` to StatusToStringMode
PiperOrigin-RevId: 362595218
--
0a960d96a0014eab7e1c55b479269450ed8e98d7 by Abseil Team <absl-team@google.com>:
Accept e.g. ".__uniq" as a valid clone name. Further, bring the implementation
on par with libiberty's demangler grammar.
Clang introduced option -funique-internal-linkage-names that adds the suffix
".__uniq.[0-9]+" to internal linkage functions to give them a globally unique
identifier. The suffix was designed to work with existing demanglers which do
recognize a "_" along with the alphanumeric string. This change enhances the
demangler to allow "_" with the alphanumeric string.
Please refer to libiberty's cp-demangle.c where function d_clone_suffix
implements the demangling of clone suffixes :
1. '_' is accepted as a valid character with the alphanumeric sequence.
2. The alphanumberic sequence is optional.
3. The digit sequence is optional.
PiperOrigin-RevId: 362557420
--
2ac5ea212c150afd2f58025a5cab8c45d16949c6 by Abseil Team <absl-team@google.com>:
Change variable name 'slots' to 'slot_count' to avoid name-clash with Qt builds.
PiperOrigin-RevId: 362556289
--
934f0f409c9c548716a46363d6e243406fad4028 by Mark Barolak <mbar@google.com>:
Clarify the comment on ABSL_CACHELINE_SIZE to indicate that the macro definition itself shouldn't change, but rather that call sites should change when possible.
This addresses the request for improved documentation in https://github.com/abseil/abseil-cpp/pull/842.
PiperOrigin-RevId: 362354288
GitOrigin-RevId: 8e75347c10d85112296811be6ef35761744ad9bc
Change-Id: I33ec8561d8d645c3353e9d2dd447501d0e1825a7
Diffstat (limited to 'create_lts.py')
-rwxr-xr-x | create_lts.py | 121 |
1 files changed, 121 insertions, 0 deletions
diff --git a/create_lts.py b/create_lts.py new file mode 100755 index 00000000..a98c76b4 --- /dev/null +++ b/create_lts.py @@ -0,0 +1,121 @@ +#!/usr/bin/env python +# +# Copyright 2021 The Abseil Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""A script to do source transformations to create a new LTS release. + + Usage: ./create_lts.py YYYYMMDD +""" + +import sys + + +def ReplaceStringsInFile(filename, replacement_dict): + """Performs textual replacements in a file. + + Rewrites filename with the keys in replacement_dict replaced with + their values. This function assumes the file can fit in memory. + + Args: + filename: the filename to perform the replacement on + replacement_dict: a dictionary of key strings to be replaced with their + values + + Raises: + Exception: A failure occured + """ + f = open(filename, 'r') + content = f.read() + f.close() + + for key, value in replacement_dict.items(): + original = content + content = content.replace(key, value) + if content == original: + raise Exception('Failed to find {} in {}'.format(key, filename)) + + f = open(filename, 'w') + f.write(content) + f.close() + + +def StripContentBetweenTags(filename, strip_begin_tag, strip_end_tag): + """Strip contents from a file. + + Rewrites filename with by removing all content between + strip_begin_tag and strip_end_tag, including the tags themselves. + + Args: + filename: the filename to perform the replacement on + strip_begin_tag: the start of the content to be removed + strip_end_tag: the end of the content to be removed + + Raises: + Exception: A failure occured + """ + f = open(filename, 'r') + content = f.read() + f.close() + + while True: + begin = content.find(strip_begin_tag) + if begin == -1: + break + end = content.find(strip_end_tag, begin + len(strip_begin_tag)) + if end == -1: + raise Exception('{}: imbalanced strip begin ({}) and ' + 'end ({}) tags'.format(filename, strip_begin_tag, + strip_end_tag)) + content = content.replace(content[begin:end + len(strip_end_tag)], '') + + f = open(filename, 'w') + f.write(content) + f.close() + + +def main(argv): + if len(argv) != 2: + print('Usage: {} YYYYMMDD'.format(sys.argv[0], file=sys.stderr)) + sys.exit(1) + + datestamp = sys.argv[1] + if len(datestamp) != 8 or not datestamp.isdigit(): + raise Exception( + 'datestamp={} is not in the YYYYMMDD format'.format(datestamp)) + + # Replacement directives go here. + ReplaceStringsInFile( + 'absl/base/options.h', { + '#define ABSL_OPTION_USE_INLINE_NAMESPACE 0': + '#define ABSL_OPTION_USE_INLINE_NAMESPACE 1', + '#define ABSL_OPTION_INLINE_NAMESPACE_NAME head': + '#define ABSL_OPTION_INLINE_NAMESPACE_NAME lts_{}'.format( + datestamp) + }) + ReplaceStringsInFile( + 'CMakeLists.txt', { + 'project(absl LANGUAGES CXX)': + 'project(absl LANGUAGES CXX VERSION {})'.format(datestamp) + }) + # Set the SOVERSION to YYYYMMDD.0.0 - The first 0 means we only have + # ABI compatible changes, and the second 0 means we can increment it + # to mark changes as ABI-compatible, for patch releases. + ReplaceStringsInFile('CMake/AbseilHelpers.cmake', + {'SOVERSION 0': 'SOVERSION "{}.0.0"'.format(datestamp)}) + StripContentBetweenTags('CMakeLists.txt', '# absl:lts-remove-begin', + '# absl:lts-remove-end') + + +if __name__ == '__main__': + main(sys.argv) |