URL: https://github.com/freeipa/freeipa/pull/1357 Author: frasertweedale Title: #1357: Use correct version of Python in RPM scripts Action: opened
PR body: """ Fixes: https://pagure.io/freeipa/issue/7299 """ To pull the PR as Git branch: git remote add ghfreeipa https://github.com/freeipa/freeipa git fetch ghfreeipa pull/1357/head:pr1357 git checkout pr1357
From e81323c574a898cbd58e960ea73aee9f78050022 Mon Sep 17 00:00:00 2001 From: Fraser Tweedale <ftwee...@redhat.com> Date: Wed, 6 Dec 2017 00:53:29 +1100 Subject: [PATCH] Use correct version of Python in RPM scripts Fixes: https://pagure.io/freeipa/issue/7299 --- freeipa.spec.in | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/freeipa.spec.in b/freeipa.spec.in index 48fdb93f59..bd7c0892b7 100644 --- a/freeipa.spec.in +++ b/freeipa.spec.in @@ -25,6 +25,12 @@ %endif %endif +%if 0%{?with_python3} +%global python %{__python3} +%else +%global python %{__python2} +%endif + # lint is not executed during rpmbuild # %%global with_lint 1 %if 0%{?with_lint} @@ -1132,7 +1138,7 @@ fi %posttrans server # don't execute upgrade and restart of IPA when server is not installed -python2 -c "import sys; from ipaserver.install import installutils; sys.exit(0 if installutils.is_ipa_configured() else 1);" > /dev/null 2>&1 +%{python} -c "import sys; from ipaserver.install import installutils; sys.exit(0 if installutils.is_ipa_configured() else 1);" > /dev/null 2>&1 if [ $? -eq 0 ]; then # This is necessary for Fedora system upgrades which by default @@ -1201,7 +1207,7 @@ fi %posttrans server-trust-ad -python2 -c "import sys; from ipaserver.install import installutils; sys.exit(0 if installutils.is_ipa_configured() else 1);" > /dev/null 2>&1 +%{python} -c "import sys; from ipaserver.install import installutils; sys.exit(0 if installutils.is_ipa_configured() else 1);" > /dev/null 2>&1 if [ $? -eq 0 ]; then # NOTE: systemd specific section /bin/systemctl try-restart httpd.service >/dev/null 2>&1 || : @@ -1252,7 +1258,7 @@ if [ $1 -gt 1 ] ; then fi if [ $restore -ge 2 ]; then - python2 -c 'from ipaclient.install.client import update_ipa_nssdb; update_ipa_nssdb()' >/var/log/ipaupgrade.log 2>&1 + %{python} -c 'from ipaclient.install.client import update_ipa_nssdb; update_ipa_nssdb()' >/var/log/ipaupgrade.log 2>&1 fi fi
_______________________________________________ FreeIPA-devel mailing list -- freeipa-devel@lists.fedorahosted.org To unsubscribe send an email to freeipa-devel-le...@lists.fedorahosted.org