From 71f808219d06dc1ec40b35c7ae086525ea959bfd Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Mar 31 2022 09:59:49 +0000 Subject: Backport abseil-cpp from Fedora's rawhide at: 4b8d306dee6fabf63810a20dcd81a957ff632fcb Signed-off-by: Pierre-Yves Chibon --- diff --git a/README.md b/README.md new file mode 100644 index 0000000..0165d03 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# abseil-cpp + +The abseil-cpp package \ No newline at end of file diff --git a/abseil-cpp-20211102.0-disable-nominalcpufrequency.patch b/abseil-cpp-20211102.0-disable-nominalcpufrequency.patch new file mode 100644 index 0000000..e1351d8 --- /dev/null +++ b/abseil-cpp-20211102.0-disable-nominalcpufrequency.patch @@ -0,0 +1,44 @@ +From d984ddf1a64ce9fae36395b423cf6e52afc9a07a Mon Sep 17 00:00:00 2001 +From: "Benjamin A. Beasley" +Date: Wed, 16 Mar 2022 14:33:41 -0400 +Subject: [PATCH] Disable SysinfoTest.NominalCPUFrequency + +SysinfoTest.NominalCPUFrequency in absl_sysinfo_test fails occasionally +on aarch64, but see: + +NominalCPUFrequency Test from SysInfoTest Suite Fails on M1 Mac +https://github.com/abseil/abseil-cpp/issues/1053#issuecomment-961432444 + +in which an upstream author opines: + + If the only problem you are trying to solve is a failing test, this is safe + to ignore since this code is never called. I should consider stripping this + test out of the open source release. NominalCPUFrequency is only called in + code private to Google and we do have tests on the platforms we use it on. + +We therefore disable it on all architectures, since any future failures +will also not be meaningful. + +Note also that this test is removed upstream in commit +732b5580f089101ce4b8cdff55bb6461c59a6720 (internal commit +7e8da4f14afd25d11713eee6b743ba31605332bf). +--- + absl/base/internal/sysinfo_test.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/absl/base/internal/sysinfo_test.cc b/absl/base/internal/sysinfo_test.cc +index 5f9e45f..1a944f0 100644 +--- a/absl/base/internal/sysinfo_test.cc ++++ b/absl/base/internal/sysinfo_test.cc +@@ -44,7 +44,7 @@ TEST(SysinfoTest, NumCPUs) { + // frequency, while others do not. Since we can't predict a priori what a given + // machine is going to do, just disable this test on POWER on Linux. + #if !(defined(__linux) && (defined(__ppc64__) || defined(__PPC64__))) +-TEST(SysinfoTest, NominalCPUFrequency) { ++TEST(SysinfoTest, DISABLED_NominalCPUFrequency) { + // Linux only exposes the CPU frequency on certain architectures, and + // Emscripten doesn't expose it at all. + #if defined(__linux__) && \ +-- +2.35.1 + diff --git a/abseil-cpp-20211102.0-gtest-unreleased-features.patch b/abseil-cpp-20211102.0-gtest-unreleased-features.patch new file mode 100644 index 0000000..a77bcc0 --- /dev/null +++ b/abseil-cpp-20211102.0-gtest-unreleased-features.patch @@ -0,0 +1,111 @@ +diff -Naur abseil-cpp-20211102.0-original/absl/strings/internal/cord_rep_btree_test.cc abseil-cpp-20211102.0/absl/strings/internal/cord_rep_btree_test.cc +--- abseil-cpp-20211102.0-original/absl/strings/internal/cord_rep_btree_test.cc 2021-11-03 11:26:14.000000000 -0400 ++++ abseil-cpp-20211102.0/absl/strings/internal/cord_rep_btree_test.cc 2021-12-17 08:44:54.254485697 -0500 +@@ -59,7 +59,6 @@ + using ::testing::_; + using ::testing::AllOf; + using ::testing::AnyOf; +-using ::testing::Conditional; + using ::testing::ElementsAre; + using ::testing::ElementsAreArray; + using ::testing::Eq; +@@ -381,7 +380,6 @@ + flats.push_back(MakeHexFlat(i)); + auto* result = CordRepBtree::Append(leaf, flats.back()); + EXPECT_THAT(result->height(), Eq(0)); +- EXPECT_THAT(result, Conditional(shared(), Ne(leaf), Eq(leaf))); + EXPECT_THAT(result->Edges(), ElementsAreArray(flats)); + leaf = result; + } +@@ -399,7 +397,6 @@ + flats.push_front(MakeHexFlat(i)); + auto* result = CordRepBtree::Prepend(leaf, flats.front()); + EXPECT_THAT(result->height(), Eq(0)); +- EXPECT_THAT(result, Conditional(shared(), Ne(leaf), Eq(leaf))); + EXPECT_THAT(result->Edges(), ElementsAreArray(flats)); + leaf = result; + } +@@ -426,7 +423,6 @@ + result = CordRepBtree::Append(leaf, flats.back()); + } + EXPECT_THAT(result->height(), Eq(0)); +- EXPECT_THAT(result, Conditional(shared(), Ne(leaf), Eq(leaf))); + EXPECT_THAT(result->Edges(), ElementsAreArray(flats)); + leaf = result; + } +@@ -483,7 +479,6 @@ + flats.push_back(MakeHexFlat(i)); + CordRepBtree* result = CordRepBtree::Append(tree, flats.back()); + ASSERT_THAT(result, IsNode(1)); +- ASSERT_THAT(result, Conditional(shared(), Ne(tree), Eq(tree))); + std::vector edges = GetLeafEdges(result); + ASSERT_THAT(edges, ElementsAreArray(flats)); + tree = result; +@@ -514,7 +509,6 @@ + flats.push_back(MakeHexFlat(i)); + CordRepBtree* result = CordRepBtree::Append(tree, flats.back()); + ASSERT_THAT(result, IsNode(2)); +- ASSERT_THAT(result, Conditional(shared(), Ne(tree), Eq(tree))); + std::vector edges = GetLeafEdges(result); + ASSERT_THAT(edges, ElementsAreArray(flats)); + tree = result; +@@ -544,7 +538,6 @@ + flats.push_front(MakeHexFlat(i)); + CordRepBtree* result = CordRepBtree::Prepend(tree, flats.front()); + ASSERT_THAT(result, IsNode(1)); +- ASSERT_THAT(result, Conditional(shared(), Ne(tree), Eq(tree))); + std::vector edges = GetLeafEdges(result); + ASSERT_THAT(edges, ElementsAreArray(flats)); + tree = result; +@@ -575,7 +568,6 @@ + flats.push_front(MakeHexFlat(i)); + CordRepBtree* result = CordRepBtree::Prepend(tree, flats.front()); + ASSERT_THAT(result, IsNode(2)); +- ASSERT_THAT(result, Conditional(shared(), Ne(tree), Eq(tree))); + std::vector edges = GetLeafEdges(result); + ASSERT_THAT(edges, ElementsAreArray(flats)); + tree = result; +@@ -889,7 +881,6 @@ + for (size_t i = 1; i < n; ++i) { + refs.RefIf(shared(), leaf); + CordRepBtree* result = BtreeAdd(leaf, append, consumer.Next(3)); +- EXPECT_THAT(result, Conditional(shared(), Ne(leaf), Eq(leaf))); + EXPECT_THAT(CordToString(result), Eq(consumer.Consumed())); + leaf = result; + } +@@ -905,9 +896,6 @@ + CordRepBtree* leaf0 = tree->Edges()[0]->btree(); + CordRepBtree* leaf1 = tree->Edges()[1]->btree(); + CordRepBtree* result = CordRepBtree::Append(tree, "123456789"); +- EXPECT_THAT(result, Conditional(shared(), Ne(tree), Eq(tree))); +- EXPECT_THAT(result->Edges(), +- ElementsAre(leaf0, Conditional(shared(), Ne(leaf1), Eq(leaf1)))); + EXPECT_THAT(CordToString(result), Eq(data + "123456789")); + CordRep::Unref(result); + } +@@ -920,9 +908,6 @@ + CordRepBtree* leaf0 = tree->Edges()[0]->btree(); + CordRepBtree* leaf1 = tree->Edges()[1]->btree(); + CordRepBtree* result = CordRepBtree::Prepend(tree, "123456789"); +- EXPECT_THAT(result, Conditional(shared(), Ne(tree), Eq(tree))); +- EXPECT_THAT(result->Edges(), +- ElementsAre(Conditional(shared(), Ne(leaf0), Eq(leaf0)), leaf1)); + EXPECT_THAT(CordToString(result), Eq("123456789" + data)); + CordRep::Unref(result); + } +@@ -954,7 +939,6 @@ + for (size_t i = max_cap + 1; i < max_cap * max_cap; ++i) { + refs.RefIf(shared(), tree); + result = BtreeAdd(tree, append, consumer.Next(3)); +- ASSERT_THAT(result, Conditional(shared(), Ne(tree), Eq(tree))); + ASSERT_THAT(CordToString(result), Eq(consumer.Consumed())); + tree = result; + } +@@ -970,7 +954,6 @@ + ++i) { + refs.RefIf(shared(), tree); + result = BtreeAdd(tree, append, consumer.Next(3)); +- ASSERT_THAT(result, Conditional(shared(), Ne(tree), Eq(tree))); + ASSERT_THAT(CordToString(result), Eq(consumer.Consumed())); + tree = result; + } diff --git a/abseil-cpp-20211102.0.tar.gz b/abseil-cpp-20211102.0.tar.gz new file mode 100644 index 0000000..250d69e Binary files /dev/null and b/abseil-cpp-20211102.0.tar.gz differ diff --git a/abseil-cpp.spec b/abseil-cpp.spec new file mode 100644 index 0000000..fadc022 --- /dev/null +++ b/abseil-cpp.spec @@ -0,0 +1,165 @@ +# Installed library version +%global lib_version 2111.0.0 + +Name: abseil-cpp +Version: 20211102.0 +Release: 2%{?dist} +Summary: C++ Common Libraries + +License: ASL 2.0 +URL: https://abseil.io +Source0: https://github.com/abseil/abseil-cpp/archive/%{version}/%{name}-%{version}.tar.gz + +# Remove test assertions that use ::testing::Conditional, which is not in a +# released version of GTest. Not submitted upstream, as this is a workaround +# rather than a fix. https://github.com/abseil/abseil-cpp/issues/1063 +Patch0: abseil-cpp-20211102.0-gtest-unreleased-features.patch +# SysinfoTest.NominalCPUFrequency in absl_sysinfo_test fails occasionally +# on aarch64, but see: +# +# NominalCPUFrequency Test from SysInfoTest Suite Fails on M1 Mac +# https://github.com/abseil/abseil-cpp/issues/1053#issuecomment-961432444 +# +# in which an upstream author opines: +# +# If the only problem you are trying to solve is a failing test, this is safe +# to ignore since this code is never called. I should consider stripping this +# test out of the open source release. NominalCPUFrequency is only called in +# code private to Google and we do have tests on the platforms we use it on. +# +# We therefore disable it on all architectures, since any future failures +# will also not be meaningful. +# +# Note also that this test is removed upstream in commit +# 732b5580f089101ce4b8cdff55bb6461c59a6720 (internal commit +# 7e8da4f14afd25d11713eee6b743ba31605332bf). +Patch1: abseil-cpp-20211102.0-disable-nominalcpufrequency.patch + +BuildRequires: cmake +# The default make backend would work just as well; ninja is observably faster +BuildRequires: ninja-build +BuildRequires: gcc-c++ + +BuildRequires: gmock-devel +BuildRequires: gtest-devel + +%ifarch s390x +# Symbolize.SymbolizeWithMultipleMaps fails in absl_symbolize_test on s390x +# with LTO +# https://github.com/abseil/abseil-cpp/issues/1133 +%global _lto_cflags %{nil} +%endif + +%description +Abseil is an open-source collection of C++ library code designed to augment +the C++ standard library. The Abseil library code is collected from +Google's own C++ code base, has been extensively tested and used in +production, and is the same code we depend on in our daily coding lives. + +In some cases, Abseil provides pieces missing from the C++ standard; in +others, Abseil provides alternatives to the standard for special needs we've +found through usage in the Google code base. We denote those cases clearly +within the library code we provide you. + +Abseil is not meant to be a competitor to the standard library; we've just +found that many of these utilities serve a purpose within our code base, +and we now want to provide those resources to the C++ community as a whole. + +%package devel +Summary: Development files for %{name} +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description devel +Development headers for %{name} + +%prep +%autosetup -p1 -S gendiff + +# Replace GTEST_FLAG_GET, which is not in a released version of GTest, with an +# appropriate default value. Not submitted upstream, as this is a workaround +# rather than a fix. https://github.com/abseil/abseil-cpp/issues/1063 +# +# The find-then-sed pattern means we only discard mtimes on files that actually +# needed to be modified. +find . -type f -name '*.cc' \ + -exec gawk '/GTEST_FLAG_GET/ { print FILENAME ; nextfile }' '{}' '+' | + xargs -r -t sed -r -i 's/GTEST_FLAG_GET/::testing::GTEST_FLAG/g' + + +%build +%cmake \ + -GNinja \ + -DABSL_USE_EXTERNAL_GOOGLETEST:BOOL=ON \ + -DABSL_FIND_GOOGLETEST:BOOL=ON \ + -DABSL_ENABLE_INSTALL:BOOL=ON \ + -DBUILD_TESTING:BOOL=ON \ + -DCMAKE_BUILD_TYPE:STRING=None \ + -DCMAKE_CXX_STANDARD:STRING=17 +%cmake_build + + +%install +%cmake_install + +%check +%ctest + +%files +%license LICENSE +%doc FAQ.md README.md UPGRADES.md +%{_libdir}/libabsl_*.so.%{lib_version} + +%files devel +%{_includedir}/absl +%{_libdir}/libabsl_*.so +%{_libdir}/cmake/absl +%{_libdir}/pkgconfig/*.pc + +%changelog +* Tue Mar 15 2022 Benjamin A. Beasley - 20211102.0-2 +- Disable LTO on s390x to work around test failure +- Skip SysinfoTest.NominalCPUFrequency on all architectures; it fails + occasionally on aarch64, and upstream says we should not care + +* Fri Feb 18 2022 Benjamin A. Beasley - 20211102.0-1 +- Update to 20211102.0 (close RHBZ#2019691) +- Drop --output-on-failure, already in %%ctest expansion +- On s390x, instead of ignoring all tests, skip only the single failing test +- Use ninja backend for CMake: speeds up build with no downsides +- Drop patch for armv7hl + +* Mon Jan 31 2022 Benjamin A. Beasley - 20210324.2-4 +- Fix test failure (fix RHBZ#2045186) + +* Wed Jan 19 2022 Fedora Release Engineering - 20210324.2-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + +* Wed Jul 21 2021 Fedora Release Engineering - 20210324.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + +* Fri May 21 2021 Rich Mattes - 20210324.1-2 +- Update to release 20210324.2 +- Enable and run test suite + +* Mon Mar 08 2021 Rich Mattes - 20200923.3-1 +- Update to release 20200923.3 + +* Mon Jan 25 2021 Fedora Release Engineering - 20200923.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Sat Dec 19 2020 Rich Mattes - 20200923.2-1 +- Update to release 20200923.2 +- Rebuild to fix tagging in koji (rhbz#1885561) + +* Fri Jul 31 2020 Fedora Release Engineering - 20200225.2-4 +- Second attempt - Rebuilt for + https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Mon Jul 27 2020 Fedora Release Engineering - 20200225.2-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Wed May 27 2020 Rich Mattes - 20200225.2-2 +- Don't remove buildroot in install + +* Sun May 24 2020 Rich Mattes - 20200225.2-1 +- Initial package. diff --git a/sources b/sources new file mode 100644 index 0000000..35a1237 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (abseil-cpp-20211102.0.tar.gz) = fed68aa434c02ec6faa9d1c81f1ad35b60ec024b44957e2e0ac31e6075e385c06a3e1b616afeb4bb7c2413191fd7827d82e1f9f0796b52ed21fb2c41dd9031cf