Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove dependency on /usr/bin/python3 #93

Open
wants to merge 1 commit into
base: release/3006.0
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion salt/salt.spec
Original file line number Diff line number Diff line change
Expand Up @@ -996,7 +996,6 @@ cp -a conf %{buildroot}%{python3_sitelib}/salt-testsuite/
%if 0%{?suse_version}
install -Dd -m 0750 %{buildroot}%{_prefix}/lib/zypp/plugins/commit
%{__install} scripts/suse/zypper/plugins/commit/zyppnotify %{buildroot}%{_prefix}/lib/zypp/plugins/commit/zyppnotify
sed -i '1s=^#!/usr/bin/\(python\|env python\)[0-9.]*=#!/usr/bin/python3=' %{buildroot}%{_prefix}/lib/zypp/plugins/commit/zyppnotify
%endif

# Install Yum plugins only on RH machines
Expand Down Expand Up @@ -1101,6 +1100,18 @@ install -Dpm 0640 conf/suse/standalone-formulas-configuration.conf %{buildroot}%
%fdupes %{buildroot}%{python3_sitelib}
%endif

%python3_fix_shebang
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use this exact spec file for building different the "salt" package for different OSes, including old SLE15 versions and CentOS8/RES8, as you can see here:

https://build.opensuse.org/package/show/systemsmanagement:saltstack:products:testing/salt

This makes changes on this spec file a little bit tricky, as i.a. %python3_fix_shebang and some other macros are not available for all those OSes.

I would recommend to isolate your changes under the scope of %if %{suse_version} >= 1600, to prevent affecting the other OSes.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would much prefer some kind of shim, that would be more robust:

# Compat stub for python3_fix_shebang_path
%{?!python3_fix_shebang_path:%define python3_fix_shebang_path(+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-=) \\\
    myargs="%{**}" \
    for f in ${myargs}; do \
        [ -f "$f" ] && sed -i -e "1s@#\\!.*python.*@#\\!$(realpath %__python3)@" $f \
    done
    }

%if %{suse_version} >= 1600
%python3_fix_shebang_path salt/ext/tornado/*
%python3_fix_shebang_path salt/ext/tornado/platform/*
%python3_fix_shebang_path salt/ext/tornado/test/*
%python3_fix_shebang_path salt/ext/vsan/*
%python3_fix_shebang_path salt/ext/modules/*
%python3_fix_shebang_path salt/netapi/rest_cherrypy/*
%python3_fix_shebang_path salt/pillar/*
%python3_fix_shebang_path %{buildroot}%{_prefix}/lib/zypp/plugins/commit/zyppnotify
%endif
%python3_compile
%endif

%if "%{flavor}" != "testsuite"
Expand Down
Loading