]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/prometheus: use vendored "packaging" instead 49698/head
authorMatan Breizman <mbreizma@redhat.com>
Thu, 12 Jan 2023 09:16:00 +0000 (09:16 +0000)
committerMatan Breizman <mbreizma@redhat.com>
Sun, 29 Jan 2023 12:06:57 +0000 (12:06 +0000)
* Note: The cherry-pick is altered, the original commit couldn't be cherry-picked
as is since we introduced some changes in the organization of the debian dir
(ceph-mgr-modules-core.requires doesn't exist yet).
All the packages listed in main's ceph-mgr-modules-core.requires are marked
as pkg.ceph.check in P/Q debian/control.
Therefore, python3-pkg-resources is listed as <pkg.ceph.check> in debian/control.

instead of using the top-level "packaging" module, use the one
vendored by setuptools.

packaging python module provides versioning defined by PEP-440.
but python3-packaging is provided by CentOS8 powertools repo,
which is not enabled by default. and in CentOS9, this package
is provided by AppStream instead of BaseOS.

as prometheus mgr module is included by ceph-mgr-module-core,
it would be desirable if our user can install ceph-mgr-module-core
without enabling powertools or AppStream repo on a CentOS or
its derivative distros.

fortunately, setuptools vendors packaging module. and both
CentOS8 and CentOS9 provide python3-setuptools in their BaseOS
repos.

in this change, instead of using "packging" module, we use the
venderored one, which is in turn embedded in pkg_resources.
this python module is provided by python3-setuptools on CentOS
distros, and python3-pkg-resources on Debian and its derivatives

the packaging recipes are updated accordingly to reflect the
new runtime dependency.

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
(cherry picked from commit cf6089200d96fc56b08ee17a4e31f19823370dc8)

Signed-off-by: Matan Breizman <mbreizma@redhat.com>
ceph.spec.in
debian/control
src/pybind/mgr/prometheus/module.py
src/pybind/mgr/requirements-required.txt

index 0a0f4ca1198bccb5ba6eb672fa619c6b0f647df2..2b5a4f36151aa255a4bb52ded5ab78637a17fb3f 100644 (file)
@@ -651,6 +651,7 @@ Requires:       python%{python3_pkgversion}-pecan
 Requires:       python%{python3_pkgversion}-pyOpenSSL
 Requires:       python%{python3_pkgversion}-requests
 Requires:       python%{python3_pkgversion}-dateutil
+Requires:       python%{python3_pkgversion}-setuptools
 %if 0%{?fedora} || 0%{?rhel} >= 8
 Requires:       python%{python3_pkgversion}-cherrypy
 Requires:       python%{python3_pkgversion}-pyyaml
index cbb5ccaa4d850219bc7747e07e3385b38d9cdfd4..bc5ac8dd014aeed75190cc21717ce63bab313e93 100644 (file)
@@ -93,6 +93,7 @@ Build-Depends: automake,
                tox <pkg.ceph.check>,
                python3-coverage <pkg.ceph.check>,
                python3-dateutil <pkg.ceph.check>,
+               python3-pkg-resources <pkg.ceph.check>,
                python3-openssl <pkg.ceph.check>,
                python3-prettytable <pkg.ceph.check>,
                python3-requests <pkg.ceph.check>,
index 9074944f0034af8b9ce5d55b9a5d435b84ed7667..e127a83568a7d509f53c91e73c53d11050c69f82 100644 (file)
@@ -1,6 +1,6 @@
 import cherrypy
 from collections import defaultdict
-from packaging.version import Version
+from pkg_resources import packaging  # type: ignore
 import json
 import math
 import os
@@ -32,6 +32,7 @@ DEFAULT_PORT = 9283
 # ipv6 isn't yet configured / supported and CherryPy throws an uncaught
 # exception.
 if cherrypy is not None:
+    Version = packaging.version.Version
     v = Version(cherrypy.__version__)
     # the issue was fixed in 3.2.3. it's present in 3.2.2 (current version on
     # centos:7) and back to at least 3.0.0.
index 1c4bbf4710b969e1b6261a1811e289e32db4657d..1fad65c626f8661d04e5238d9f06714a6bd27922 100644 (file)
@@ -12,5 +12,6 @@ pytest-cov==2.7.1
 pyyaml
 requests-mock
 scipy
+setuptools
 werkzeug
 natsort