diff --git a/.gitignore b/.gitignore index c00c28e..771542b 100644 --- a/.gitignore +++ b/.gitignore @@ -29,3 +29,4 @@ /opentelemetry-python-1.21.0.tar.gz /opentelemetry-python-1.22.0.tar.gz /opentelemetry-python-1.23.0.tar.gz +/opentelemetry-python-1.24.0.tar.gz diff --git a/python-opentelemetry.spec b/python-opentelemetry.spec index dd36612..d6730ab 100644 --- a/python-opentelemetry.spec +++ b/python-opentelemetry.spec @@ -1,6 +1,6 @@ # See eachdist.ini: -%global stable_version 1.23.0 -%global prerel_version 0.44~b0 +%global stable_version 1.24.0 +%global prerel_version 0.45~b0 # WARNING: Because python-opentelemetry-contrib has some exact-version # dependencies on subpackages of this package, it must be updated # simultaneously with this package, preferably using a side tag, such that its @@ -50,27 +50,7 @@ Source1: %{proto_url}/archive/v%{proto_version}/opentelemetry-proto-%{pro BuildArch: noarch BuildRequires: python3-devel - -# The requirements files pin exact dependency versions and contain many -# unwanted dependencies (linters, coverage analysis tools, etc.), which makes -# them not very useful. Rather than massively patching or filtering these files -# to generate BuildRequires, it’s easier to maintain a manual list. Besides, -# almost everything that *is* wanted from dev-requirements.txt is brought in by -# the test extras of the subpackages that require it. -# -# See also: -# https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_linters - -# dev-requirements.txt -# Also required via tox.ini -BuildRequires: %{py3_dist pytest} -# Also required via tox.ini; easier to BR than to patch it out -BuildRequires: %{py3_dist pytest-benchmark} -# Enables additional tests for opentelemetry-sdk, but is not one of its -# test-extra dependencies: -BuildRequires: %{py3_dist psutil} -# Test dependency for opentelemetry-sdk; also required via tox.ini -BuildRequires: %{py3_dist flaky} +BuildRequires: tomcli %if %{with doc_pdf} BuildRequires: make @@ -475,29 +455,84 @@ sed -r -i 's|shutil\.which\("python"\)|"%{python3}"|' \ # documentation packages. echo 'intersphinx_mapping.clear()' >> docs/conf.py -# Upstream wanted to upper-bound the responses test dependency for -# opentelemetry-exporter-otlp-proto-http: -# -# https://github.com/open-telemetry/opentelemetry-python/pull/3642#issuecomment-1904888401 +# See tox.ini. We can’t generate BuildRequires directly from tox environments +# because the top-level tox.ini is not associated with a particalar Python +# package. Upstream uses different test-requirements-#.txt files to support +# multiple tox environments for some packages, primarily to support different +# test dependencies on different Python interpreter versions or to test with +# several supported major versions of a dependency. For each package with +# multiple test-requirements-#.txt files, we select the one corresponding to +# the dependency and/or Python interpreter version we have packaged and create +# a test-requirements.txt symbolic link, which we will use for generating +# BuildRequires. +while read -r n pkg +do + ln -s "test-requirements-${n}.txt" "${pkg}/test-requirements.txt" +done < <(sed -r '/^(#|$)/d' <<'EOF' +# 0: proto3, 1: proto4 +%{with protobuf4} exporter/opentelemetry-exporter-otlp-proto-http +EOF +) + +# Only opentelemetry-exporter-otlp-proto-grpc still has a [test] extra and +# hasn’t been adjusted to use a test-requirements.txt file instead. Work around +# that by writing the contents of the test extra into test-requirements.txt so +# we don’t have to generate BuildRequires from the extra. # -# Since we must use the system-wide responses package, we remove the -# upper-bound on the responses version. -sed -r -i "s/(responses.*)(, <[^\"']+)/\1/" \ - exporter/opentelemetry-exporter-otlp-proto-http/pyproject.toml +# Remove [test] package from opentelemetry-exporter-otlp-proto-grpc +# https://github.com/open-telemetry/opentelemetry-python/issues/3724 +tomcli get exporter/opentelemetry-exporter-otlp-proto-grpc/pyproject.toml \ + project.optional-dependencies.test -F newline-list | + tee exporter/opentelemetry-exporter-otlp-proto-grpc/test-requirements.txt + +for pkgdir in %{?with_prerelease:%{prerel_pkgdirs}} %{stable_pkgdirs} +do + # Filter test requirements files so we can use them to generate + # BuildRequires. + # - Convert exact-version dependencies to lower-bounds + # - Drop "-e" directives (unsupported, and we will generate them one way or + # another since we are generating BuildRequires from all packages) + sed -r \ + -e 's/==.*//' \ + -e '/^-e /d' \ + "${pkgdir}/test-requirements.txt" > \ + "${pkgdir}/test-requirements-filtered.txt" + + skiptests=0 + case "${pkgdir}" in + # This is currently just a placeholder in case we need it later. + esac + if [ "${skiptests}" != '0' ] + then + # Can’t run the tests (missing dependencies, everything requires network + # access, etc.); do an import-only “smoke test” instead, and filter out + # *all* test dependencies. + sed -r -i 's/^/# /' "${pkgdir}/test-requirements-filtered.txt" + fi + + # We generate BuildRequires from the per-package + # test-requirements-filtered.txt files. This amalgamated + # test-requirements-all.txt file is just to make debugging a little easier. + echo "### ${pkgdir} ###" >> test-requirements-all.txt + tee -a test-requirements-all.txt < "${pkgdir}/test-requirements-filtered.txt" +done %generate_buildrequires -# We filter generated BR’s to avoid listing those that are provided by packages -# built in this spec file. For easier inspection, we also reorder and -# de-duplicate them. -( - for pkgdir in %{?with_prerelease:%{prerel_pkgdirs}} %{stable_pkgdirs} - do - pushd "${pkgdir}" >/dev/null - %pyproject_buildrequires -x test - popd >/dev/null - done -) | grep -vE '\bopentelemetry-' | sort -u +for pkgdir in %{?with_prerelease:%{prerel_pkgdirs}} %{stable_pkgdirs} +do + pushd "${pkgdir}" >/dev/null + ( + %pyproject_buildrequires test-requirements-filtered.txt + # Use grep to omit dependencies on packages that are part of + # python-opentelemetry-contrib to avoid generating circular dependencies on + # this package. We could filter these out of the + # test-requirements-filtered.txt files where they appear, but we would + # still have some (correct) runtime (inter)dependencies from the + # pyproject.toml files. + ) | grep -v -E '\bopentelemetry-' + popd >/dev/null +done %build @@ -525,6 +560,28 @@ for pkgdir in %{?with_prerelease:%{prerel_pkgdirs}} %{stable_pkgdirs} do unset k case "${pkgdir}" in + exporter/opentelemetry-exporter-otlp-proto-grpc) + # E AssertionError: != + # + # Could not reproduce in a virtualenv, and the root cause is not + # understood, so this was not reported upstream. + k="${k-}${k+ and }not (TestOTLPMetricExporter and test_shutdown)" + k="${k-}${k+ and }not (TestOTLPSpanExporter and test_shutdown)" + k="${k-}${k+ and }not (TestOTLPMetricExporter and test_success)" + k="${k-}${k+ and }not (TestOTLPSpanExporter and test_success)" + k="${k-}${k+ and }not (TestOTLPLogExporter and test_success)" + + # These are probably just brittle with respect to timing. + # E AssertionError: expected call not found. + # E Expected: sleep(4) + # E Actual: sleep(1) + k="${k-}${k+ and }not (TestOTLPMetricExporter and test_unavailable_delay)" + k="${k-}${k+ and }not (TestOTLPSpanExporter and test_unavailable_delay)" + k="${k-}${k+ and }not (TestOTLPLogExporter and test_unavailable_delay)" + # E AssertionError: Expected 'sleep' to not have been called. Called 1 times. + # E Calls: [call(1)]. + k="${k-}${k+ and }not (TestOTLPMetricExporter and test_unknown_logs)" + ;; esac %pytest "${pkgdir}" ${ignore-} -k "${k-}" diff --git a/sources b/sources index dbac156..1ff4ddf 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (opentelemetry-python-1.23.0.tar.gz) = 8a2cb94d774db15eb6bb7fd97d5b761d35066779072c0ce0cf51b6d1083d115120b932598c0da2efb20060e8a4c65415a74f508011ccca7242e2d79705f0c246 +SHA512 (opentelemetry-python-1.24.0.tar.gz) = dbae1db127e2aed0a90bb01db6e2865162f945a9e6713f5048c7f56660231a14c3707474f9f65db8759f2f03334c3126d0542c3c8c2e0998d0f7f98ae6e84ef8 SHA512 (opentelemetry-proto-0.20.0.tar.gz) = 5fcc12000ad95a935d749cbcc7b6b9c70f6469d035788318b1c4c1e3b6d8f9804a44ffd1d17df250d85f4bf7f96972a02e5c04a40a4aeece835dc8e9d7ee6ff0