]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
k8s: Fix build compatibility with old versions and RHEL.
authorfrancisco.garcia <francisco.garcia@baculasystems.com>
Fri, 14 Jul 2023 07:23:48 +0000 (09:23 +0200)
committerEric Bollengier <eric@baculasystems.com>
Thu, 14 Sep 2023 11:57:01 +0000 (13:57 +0200)
After pip version 23, it's mandatory use --break-system-packages when you don't use a virtual env.
So, in this change I did a change in Makefile to adapt this situation in older and newer versions of pip.

bacula/src/plugins/fd/kubernetes-backend/Makefile

index 05f80ed5d001085eb1dfd355bf8e1d3ea86f1258..e9aa621d952a67010f85eb0aa77f1efcfd708cb5 100644 (file)
@@ -13,6 +13,13 @@ PYTHON_PROG=$(shell ./get_python PYTHON)
 PYTHONPATH=$(shell ./get_python PYTHONPATH)
 PYTHON_PREFIX=$(shell ./get_python PYTHON_PREFIX)
 
+PIP_MAJOR_VERSION=$(shell pip --version | awk '{print $$2}' | awk -v FS=\. '{print $$1}')
+PIP_OPTIONS = --user
+# Implemented PEP 668: https://pip.pypa.io/en/stable/news/#v23-0-1 we need --break-system-packages option.
+ifeq ($(shell test $(PIP_MAJOR_VERSION) -ge 23; echo $$?),0)
+       PIP_OPTIONS := ${PIP_OPTIONS} --break-system-packages
+endif
+
 all: pbuild
 
 clean:
@@ -32,7 +39,7 @@ install: build
        @$(PYTHON_PROG) setup.py install
 
 install-deps: requirements.txt
-       PYTHONPATH=$(PYTHONPATH) $(PIP_PROG) install --break-system-packages -r requirements.txt
+       PYTHONPATH=$(PYTHONPATH) $(PIP_PROG) install $(PIP_OPTIONS) -r requirements.txt
        touch install-deps
 
 binary: install-deps