From 0add7564ed138b1de4848f926f16e67bfec00a52 Mon Sep 17 00:00:00 2001 From: "francisco.garcia" Date: Fri, 14 Jul 2023 09:23:48 +0200 Subject: [PATCH] k8s: Fix build compatibility with old versions and RHEL. 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 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bacula/src/plugins/fd/kubernetes-backend/Makefile b/bacula/src/plugins/fd/kubernetes-backend/Makefile index 05f80ed5d..e9aa621d9 100644 --- a/bacula/src/plugins/fd/kubernetes-backend/Makefile +++ b/bacula/src/plugins/fd/kubernetes-backend/Makefile @@ -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 -- 2.47.3