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

Canonicalize Python shebangs #9314

Merged
merged 1 commit into from
Sep 12, 2019
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion cmd/arc_summary/arc_summary2
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python2
#!/usr/bin/env python2
#
# $Id: arc_summary.pl,v 388:e27800740aa2 2011-07-08 02:53:29Z jhell $
#
Expand Down
2 changes: 1 addition & 1 deletion cmd/arc_summary/arc_summary3
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
#
# Copyright (c) 2008 Ben Rockwood <[email protected]>,
# Copyright (c) 2010 Martin Matuska <[email protected]>,
Expand Down
2 changes: 1 addition & 1 deletion cmd/arcstat/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ dist_bin_SCRIPTS = arcstat
#
if USING_PYTHON_2
install-exec-hook:
sed --in-place 's|^#!/usr/bin/python3|#!/usr/bin/python2|' \
sed --in-place 's|^#!/usr/bin/env python3|#!/usr/bin/env python2|' \
$(DESTDIR)$(bindir)/arcstat
endif
2 changes: 1 addition & 1 deletion cmd/arcstat/arcstat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
#
# Print out ZFS ARC Statistics exported via kstat(1)
# For a definition of fields, or usage, use arctstat.pl -v
Expand Down
2 changes: 1 addition & 1 deletion cmd/dbufstat/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ dist_bin_SCRIPTS = dbufstat
#
if USING_PYTHON_2
install-exec-hook:
sed --in-place 's|^#!/usr/bin/python3|#!/usr/bin/python2|' \
sed --in-place 's|^#!/usr/bin/env python3|#!/usr/bin/env python2|' \
$(DESTDIR)$(bindir)/dbufstat
endif
2 changes: 1 addition & 1 deletion cmd/dbufstat/dbufstat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
#
# Print out statistics for all cached dmu buffers. This information
# is available through the dbufs kstat and may be post-processed as
Expand Down
12 changes: 8 additions & 4 deletions rpm/generic/zfs.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@
%bcond_with asan
%bcond_with systemd

# Exclude test-runner.py from the rpmbuild shebang check to allow it to run
# under Python 2 and 3.
%global __brp_mangle_shebangs_exclude_from test-runner.py

# Generic enable switch for systemd
%if %{with systemd}
%define _systemd 1
Expand Down Expand Up @@ -354,6 +350,14 @@ make %{?_smp_mflags}
%{__rm} -rf $RPM_BUILD_ROOT
make install DESTDIR=%{?buildroot}
find %{?buildroot}%{_libdir} -name '*.la' -exec rm -f {} \;
%if 0%{!?__brp_mangle_shebangs:1}
find %{?buildroot}%{_bindir} \
\( -name arc_summary -or -name arcstat -or -name dbufstat \) \
-exec %{__sed} -i 's|^#!.*|#!%{__python}|' {} \;
find %{?buildroot}%{_datadir} \
\( -name test-runner.py -or -name zts-report.py \) \
-exec %{__sed} -i 's|^#!.*|#!%{__python}|' {} \;
%endif

%post
%if 0%{?_systemd}
Expand Down
2 changes: 1 addition & 1 deletion tests/test-runner/bin/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dist_pkgdata_SCRIPTS = \
#
if USING_PYTHON_2
install-data-hook:
sed --in-place 's|^#!/usr/bin/python3|#!/usr/bin/python2|' \
sed --in-place 's|^#!/usr/bin/env python3|#!/usr/bin/env python2|' \
$(DESTDIR)$(pkgdatadir)/test-runner.py \
$(DESTDIR)$(pkgdatadir)/zts-report.py
endif
2 changes: 1 addition & 1 deletion tests/test-runner/bin/test-runner.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3

#
# This file and its contents are supplied under the terms of the
Expand Down
2 changes: 1 addition & 1 deletion tests/test-runner/bin/zts-report.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3

#
# This file and its contents are supplied under the terms of the
Expand Down