From 79fffaffd8cd4f6f8b1c4514c6f00d8dd581f764 Mon Sep 17 00:00:00 2001 From: Kevin Mihelich Date: Tue, 8 Jun 2021 13:52:58 +0000 Subject: [PATCH] extra/boost to 1.75.0-5 --- extra/boost/5bd5bfb9.patch | 216 +++++++++++++++++++++++++++++++++++++ extra/boost/PKGBUILD | 30 ++++-- extra/boost/b29603fa.patch | 17 +++ 3 files changed, 254 insertions(+), 9 deletions(-) create mode 100644 extra/boost/5bd5bfb9.patch create mode 100644 extra/boost/b29603fa.patch diff --git a/extra/boost/5bd5bfb9.patch b/extra/boost/5bd5bfb9.patch new file mode 100644 index 000000000..e2bf5c2a3 --- /dev/null +++ b/extra/boost/5bd5bfb9.patch @@ -0,0 +1,216 @@ +From 5bd5bfb978df5f345518d2444d8f2ddba849d8d6 Mon Sep 17 00:00:00 2001 +From: Hans Dembinski +Date: Mon, 7 Dec 2020 15:12:20 +0100 +Subject: [PATCH] Bug-fix for one-sided cropping and clarify how cropping works + (#302) + +--- + boost/histogram/algorithm/reduce.hpp | 28 +++++++-- + libs/histogram/test/algorithm_reduce_test.cpp | 63 ++++++++++++++++---- + 2 files changed, 77 insertions(+), 14 deletions(-) + +diff --git a/include/boost/histogram/algorithm/reduce.hpp b/include/boost/histogram/algorithm/reduce.hpp +index a5d2fffa6..0646db34e 100644 +--- a/boost/histogram/algorithm/reduce.hpp ++++ b/boost/histogram/algorithm/reduce.hpp +@@ -111,7 +111,14 @@ inline reduce_command crop(unsigned iaxis, double lower, double upper) { + Command is applied to corresponding axis in order of reduce arguments. + + Works like `shrink` (see shrink documentation for details), but counts in removed bins +- are discarded, whether underflow and overflow bins are present or not. ++ are discarded, whether underflow and overflow bins are present or not. If the cropped ++ range goes beyond the axis range, then the content of the underflow ++ or overflow bin which overlaps with the range is kept. ++ ++ If the counts in an existing underflow or overflow bin are discared by the crop, the ++ corresponding memory cells are not physically removed. Only their contents are set to ++ zero. This technical limitation may be lifted in the future, then crop may completely ++ remove the cropped memory cells. + + @param lower bin which contains lower is first to be kept. + @param upper bin which contains upper is last to be kept, except if upper is equal to +@@ -323,6 +330,8 @@ inline reduce_command slice_and_rebin(axis::index_type begin, axis::index_type e + exception. Histograms with non-reducible axes can still be reduced along the + other axes that are reducible. + ++ An overload allows one to pass reduce_command as positional arguments. ++ + @param hist original histogram. + @param options iterable sequence of reduce commands: `shrink`, `slice`, `rebin`, + `shrink_and_rebin`, or `slice_and_rebin`. The element type of the iterable should be +@@ -343,14 +352,16 @@ Histogram reduce(const Histogram& hist, const Iterable& options) { + auto& o = opts[iaxis]; + o.is_ordered = axis::traits::ordered(a_in); + if (o.merge > 0) { // option is set? +- o.use_underflow_bin = !o.crop && AO::test(axis::option::underflow); +- o.use_overflow_bin = !o.crop && AO::test(axis::option::overflow); ++ o.use_underflow_bin = AO::test(axis::option::underflow); ++ o.use_overflow_bin = AO::test(axis::option::overflow); + return detail::static_if_c::value>( + [&o](const auto& a_in) { + if (o.range == reduce_command::range_t::none) { ++ // no range restriction, pure rebin + o.begin.index = 0; + o.end.index = a_in.size(); + } else { ++ // range striction, convert values to indices as needed + if (o.range == reduce_command::range_t::values) { + const auto end_value = o.end.value; + o.begin.index = axis::traits::index(a_in, o.begin.value); +@@ -359,7 +370,14 @@ Histogram reduce(const Histogram& hist, const Iterable& options) { + if (axis::traits::value_as(a_in, o.end.index) != end_value) + ++o.end.index; + } +- // limit [begin, end] to [0, size()] ++ ++ // crop flow bins if index range does not include them ++ if (o.crop) { ++ o.use_underflow_bin &= o.begin.index < 0; ++ o.use_overflow_bin &= o.end.index > a_in.size(); ++ } ++ ++ // now limit [begin, end] to [0, size()] + if (o.begin.index < 0) o.begin.index = 0; + if (o.end.index > a_in.size()) o.end.index = a_in.size(); + } +@@ -435,6 +453,8 @@ Histogram reduce(const Histogram& hist, const Iterable& options) { + the other axes. Trying to reducing a non-reducible axis triggers an invalid_argument + exception. + ++ An overload allows one to pass an iterable of reduce_command. ++ + @param hist original histogram. + @param opt first reduce command; one of `shrink`, `slice`, `rebin`, + `shrink_and_rebin`, or `slice_or_rebin`. +diff --git a/test/algorithm_reduce_test.cpp b/test/algorithm_reduce_test.cpp +index 6ea42fadf..c6b4df4a4 100644 +--- a/libs/histogram/test/algorithm_reduce_test.cpp ++++ b/libs/histogram/test/algorithm_reduce_test.cpp +@@ -105,15 +105,16 @@ void run_tests() { + BOOST_TEST_EQ(reduce(h, crop(0, 1.999)).axis(), ID(0, 2)); + } + ++ // shrink and rebin + { + auto h = make_s(Tag(), std::vector(), R(4, 1, 5, "1"), R(3, -1, 2, "2")); + + /* + matrix layout: +- x ++ x -> + y 1 0 1 0 +- 1 1 0 0 +- 0 2 1 3 ++ | 1 1 0 0 ++ v 0 2 1 3 + */ + h.at(0, 0) = 1; + h.at(0, 1) = 1; +@@ -122,11 +123,13 @@ void run_tests() { + h.at(2, 0) = 1; + h.at(2, 2) = 1; + h.at(3, 2) = 3; ++ h.at(-1, -1) = 1; // underflow ++ h.at(4, 3) = 1; // overflow + + // should do nothing, index order does not matter + auto hr = reduce(h, shrink(1, -1, 2), rebin(0, 1)); + BOOST_TEST_EQ(hr.rank(), 2); +- BOOST_TEST_EQ(sum(hr), 10); ++ BOOST_TEST_EQ(sum(hr), 12); + BOOST_TEST_EQ(hr.axis(0), R(4, 1, 5, "1")); + BOOST_TEST_EQ(hr.axis(1), R(3, -1, 2, "2")); + BOOST_TEST_EQ(hr, h); +@@ -138,7 +141,7 @@ void run_tests() { + // shrinking along first axis + hr = reduce(h, shrink(0, 2, 4)); + BOOST_TEST_EQ(hr.rank(), 2); +- BOOST_TEST_EQ(sum(hr), 10); ++ BOOST_TEST_EQ(sum(hr), 12); + BOOST_TEST_EQ(hr.axis(0), R(2, 2, 4, "1")); + BOOST_TEST_EQ(hr.axis(1), R(3, -1, 2, "2")); + BOOST_TEST_EQ(hr.at(-1, 0), 1); // underflow +@@ -164,7 +167,7 @@ void run_tests() { + + hr = reduce(h, shrink_and_rebin(0, 2, 5, 2), rebin(1, 3)); + BOOST_TEST_EQ(hr.rank(), 2); +- BOOST_TEST_EQ(sum(hr), 10); ++ BOOST_TEST_EQ(sum(hr), 12); + BOOST_TEST_EQ(hr.axis(0), R(1, 2, 4, "1")); + BOOST_TEST_EQ(hr.axis(1), R(1, -1, 2, "2")); + BOOST_TEST_EQ(hr.at(-1, 0), 2); // underflow +@@ -184,16 +187,16 @@ void run_tests() { + BOOST_TEST_EQ(hr4, hr); + } + +- // crop ++ // crop and rebin + { + auto h = make_s(Tag(), std::vector(), R(4, 1, 5), R(3, 1, 4)); + + /* + matrix layout: +- x ++ x -> + y 1 0 1 0 +- 1 1 0 0 +- 0 2 1 3 ++ | 1 1 0 0 ++ v 0 2 1 3 + */ + h.at(0, 0) = 1; + h.at(0, 1) = 1; +@@ -202,6 +205,9 @@ void run_tests() { + h.at(2, 0) = 1; + h.at(2, 2) = 1; + h.at(3, 2) = 3; ++ h.at(-1, -1) = 1; // underflow ++ h.at(4, 3) = 1; // overflow ++ + + /* + crop first and last column in x and y +@@ -231,6 +237,43 @@ void run_tests() { + BOOST_TEST_EQ(hr, hr4); + } + ++ // one-sided crop ++ { ++ auto h = make_s(Tag(), std::vector(), ID(1, 4)); ++ std::fill(h.begin(), h.end(), 1); ++ // underflow: 1 ++ // index 0, x 1: 1 ++ // index 1, x 2: 1 ++ // index 2, x 3: 1 ++ // overflow: 1 ++ BOOST_TEST_EQ(sum(h), 5); ++ BOOST_TEST_EQ(h.size(), 5); ++ ++ // keep underflow ++ auto hr1 = reduce(h, crop(0, 3)); ++ BOOST_TEST_EQ(hr1, reduce(h, slice(-1, 2, slice_mode::crop))); ++ BOOST_TEST_EQ(sum(hr1), 3); ++ BOOST_TEST_EQ(hr1.size(), 4); // flow bins are not physically removed, only zeroed ++ ++ // remove underflow ++ auto hr2 = reduce(h, crop(1, 3)); ++ BOOST_TEST_EQ(hr2, reduce(h, slice(0, 2, slice_mode::crop))); ++ BOOST_TEST_EQ(sum(hr2), 2); ++ BOOST_TEST_EQ(hr2.size(), 4); // flow bins are not physically removed, only zeroed ++ ++ // keep overflow ++ auto hr3 = reduce(h, crop(2, 5)); ++ BOOST_TEST_EQ(hr3, reduce(h, slice(1, 4, slice_mode::crop))); ++ BOOST_TEST_EQ(sum(hr3), 3); ++ BOOST_TEST_EQ(hr3.size(), 4); // flow bins are not physically removed, only zeroed ++ ++ // remove overflow ++ auto hr4 = reduce(h, crop(2, 4)); ++ BOOST_TEST_EQ(hr4, reduce(h, slice(1, 3, slice_mode::crop))); ++ BOOST_TEST_EQ(sum(hr4), 2); ++ BOOST_TEST_EQ(hr4.size(), 4); // flow bins are not physically removed, only zeroed ++ } ++ + // mixed axis types + { + R r(5, 0.0, 5.0); diff --git a/extra/boost/PKGBUILD b/extra/boost/PKGBUILD index 1bd916a3d..a0071ed26 100644 --- a/extra/boost/PKGBUILD +++ b/extra/boost/PKGBUILD @@ -16,24 +16,33 @@ pkgbase=boost pkgname=('boost-libs' 'boost') pkgver=1.75.0 _boostver=${pkgver//./_} -pkgrel=3 +pkgrel=5 pkgdesc='Free peer-reviewed portable C++ source libraries' url='https://www.boost.org/' arch=('x86_64') license=('custom') makedepends=('icu' 'python' 'python-numpy' 'bzip2' 'zlib' 'openmpi' 'zstd' 'findutils') -source=(https://dl.bintray.com/boostorg/release/${pkgver}/source/boost_${_boostver}.tar.bz2 - ${pkgbase}-ublas-c++20-iterator.patch::https://github.com/boostorg/ublas/commit/a31e5cffa85f.patch) -sha256sums=('953db31e016db7bb207f11432bef7df100516eeb746843fa0486a222e3fd49cb' - 'aa38addb40d5f44b4a8472029b475e7e6aef1c460509eb7d8edf03491dc1b5ee') -b2sums=('ce7ecd8bcee518ce54f7e5302f202acbea60cedd6ae9248708c0bb5bbc2713607b2e1967a9e6f77cc20a4c008c1ee4db651def55937efc80407487a7a44fa8d6' - 'e5f6d4884eaa557d5547e7e079c2edb4ed9f2f4cd8579aa32a2150f824a5d04413f2a91e79b3139d5b915da6a46f7835f1438ad53f33096973f1a99f378ec1d3') +source=(https://boostorg.jfrog.io/artifactory/main/release/$pkgver/source/boost_$_boostver.tar.gz + ${pkgbase}-ublas-c++20-iterator.patch::https://github.com/boostorg/ublas/commit/a31e5cffa85f.patch + 5bd5bfb9.patch + b29603fa.patch) +sha256sums=('aeb26f80e80945e82ee93e5939baebdca47b9dee80a07d3144be1e1a6a66dd6a' + 'aa38addb40d5f44b4a8472029b475e7e6aef1c460509eb7d8edf03491dc1b5ee' + 'fbb27a583a6c61c4fe50621d08a8b4fd5b4a0563a48f47185fc462cb29a38540' + '3e431e5f7f023feb8e7c4d64e8d9989315dfcd4e36cdb965043ac5221497746c') +b2sums=('98f8bb2d3198a74044e7db1549f6f2e68a9f381febac36aa976f7ed4d1cc7be47e79f86cde0b13e3b5d1109fc1792408c9dc78b01198b53690449d5842f1fe2d' + 'e5f6d4884eaa557d5547e7e079c2edb4ed9f2f4cd8579aa32a2150f824a5d04413f2a91e79b3139d5b915da6a46f7835f1438ad53f33096973f1a99f378ec1d3' + 'e54c2939c8f965294c4d3726c97965725890cabd09d25cfc177c316c8a072bbc1e272ce127f1352be83c668116d70992e52ab24b41d19aaccd89fb1701235c48' + '9b336d8726e2636112724f19510cf1fe02c8306854d386308b77dd2c318f78e0c6cb4412a916e2e69544b218e9e455d50550c086c88c49736c5f551bda777132') prepare() { cd ${pkgbase}_${_boostver} # https://github.com/boostorg/ublas/pull/97 patch -Np2 -i ../${pkgbase}-ublas-c++20-iterator.patch + + patch -p1 < ../5bd5bfb9.patch # https://github.com/boostorg/histogram/pull/302 + patch -d tools/build -p1 < ../b29603fa.patch # https://github.com/boostorg/build/issues/650 } build() { @@ -41,6 +50,11 @@ build() { export _stagedir="${srcdir}/stagedir" local JOBS="$(sed -e 's/.*\(-j *[0-9]\+\).*/\1/' <<< ${MAKEFLAGS})" + pushd ${pkgbase}_${_boostver}/tools/build + ./bootstrap.sh + ./b2 install --prefix="${_stagedir}" + popd + cd ${pkgbase}_${_boostver} ./bootstrap.sh \ @@ -48,8 +62,6 @@ build() { --with-icu \ --with-python=/usr/bin/python3 \ - install -Dm755 tools/build/src/engine/b2 "${_stagedir}"/bin/b2 - # Support for OpenMPI echo "using mpi ;" >> project-config.jam diff --git a/extra/boost/b29603fa.patch b/extra/boost/b29603fa.patch new file mode 100644 index 000000000..e2790b436 --- /dev/null +++ b/extra/boost/b29603fa.patch @@ -0,0 +1,17 @@ +From b29603fa88a614835359168e70b5a44eae8e642c Mon Sep 17 00:00:00 2001 +From: Rene Rivera +Date: Sat, 26 Sep 2020 18:02:59 -0500 +Subject: [PATCH] Fix path to bootstrap for back compat. + +fixes #650 +--- a/src/engine/startup.cpp ++++ b/src/engine/startup.cpp +@@ -195,7 +195,7 @@ bool b2::startup::bootstrap(FRAME *frame) + { + const std::string path{ + b2::paths::normalize( +- b2_exe_path + "/../../share/boost-build/" + boost_build_jam)}; ++ b2_exe_path + "/../../share/boost-build/src/kernel/" + boost_build_jam)}; + if (b2::filesys::is_file(path)) + b2_file_path = path; + }