Skip to contentSkip to conversation

Allow builds and script usage on current systems

PATCH In review Nicolas Schier 2 participants 4 messages May 26, 2021 – May 27, 2021 Stable branch

lore
Share & tools
lore
#0 lore raw

cover Allow builds and script usage on current systems

Current distributions start removing support for Python 2 (and thus /usr/bin/python). To still be able to build v4.14.y and to run supplementary scripts fix shebang lines to use 'env' and switch diffconfig and bloat-o-meter to Python 3 explicitly.

Python 3 availability should be given on v4.14 based distributions (for comparison: Debian jessie 8 (est. 2013) shipped a 3.16 kernel and Python 3).

Both upstream commits are originally included in v5.11 and re-applied on v5.10, v5.4 and v4.19.

Andy Shevchenko (1):
scripts: switch explicitly to Python 3

Finn Behrens (1):
tweewide: Fix most Shebang lines

 Documentation/sphinx/parse-headers.pl                          | 2 +-
 Documentation/target/tcm_mod_builder.py                        | 2 +-
 Documentation/trace/postprocess/decode_msr.py                  | 2 +-
 Documentation/trace/postprocess/trace-pagealloc-postprocess.pl | 2 +-
 Documentation/trace/postprocess/trace-vmscan-postprocess.pl    | 2 +-
 arch/ia64/scripts/unwcheck.py                                  | 2 +-
 scripts/bloat-o-meter                                          | 2 +-
 scripts/config                                                 | 2 +-
 scripts/diffconfig                                             | 2 +-
 scripts/show_delta                                             | 2 +-
 scripts/sphinx-pre-install                                     | 2 +-
 scripts/tracing/draw_functrace.py                              | 2 +-
 tools/kvm/kvm_stat/kvm_stat                                    | 2 +-
 tools/perf/python/tracepoint.py                                | 2 +-
 tools/perf/python/twatch.py                                    | 2 +-
 tools/perf/scripts/python/call-graph-from-sql.py               | 2 +-
 tools/perf/scripts/python/sched-migration.py                   | 2 +-
 tools/perf/tests/attr.py                                       | 2 +-
 tools/perf/util/setup.py                                       | 2 +-
 tools/power/pm-graph/analyze_boot.py                           | 2 +-
 tools/power/pm-graph/analyze_suspend.py                        | 2 +-
 tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py     | 2 +-
 tools/testing/ktest/compare-ktest-sample.pl                    | 2 +-
 tools/testing/selftests/tc-testing/tdc_batch.py                | 2 +-
 24 files changed, 24 insertions(+), 24 deletions(-)
Signature · 1 line
2.30.2
#1 lore raw

PATCH 1/2 tweewide: Fix most Shebang lines

From: Finn Behrens <[email protected]>

commit c25ce589dca10d64dde139ae093abc258a32869c upstream.

Change every shebang which does not need an argument to use /usr/bin/env. This is needed as not every distro has everything under /usr/bin, sometimes not even bash.

[[email protected]: update contexts for v4.14, adapt for old scripts]
---
 Documentation/sphinx/parse-headers.pl                          | 2 +-
 Documentation/target/tcm_mod_builder.py                        | 2 +-
 Documentation/trace/postprocess/decode_msr.py                  | 2 +-
 Documentation/trace/postprocess/trace-pagealloc-postprocess.pl | 2 +-
 Documentation/trace/postprocess/trace-vmscan-postprocess.pl    | 2 +-
 arch/ia64/scripts/unwcheck.py                                  | 2 +-
 scripts/bloat-o-meter                                          | 2 +-
 scripts/config                                                 | 2 +-
 scripts/diffconfig                                             | 2 +-
 scripts/show_delta                                             | 2 +-
 scripts/sphinx-pre-install                                     | 2 +-
 scripts/tracing/draw_functrace.py                              | 2 +-
 tools/kvm/kvm_stat/kvm_stat                                    | 2 +-
 tools/perf/python/tracepoint.py                                | 2 +-
 tools/perf/python/twatch.py                                    | 2 +-
 tools/perf/scripts/python/call-graph-from-sql.py               | 2 +-
 tools/perf/scripts/python/sched-migration.py                   | 2 +-
 tools/perf/tests/attr.py                                       | 2 +-
 tools/perf/util/setup.py                                       | 2 +-
 tools/power/pm-graph/analyze_boot.py                           | 2 +-
 tools/power/pm-graph/analyze_suspend.py                        | 2 +-
 tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py     | 2 +-
 tools/testing/ktest/compare-ktest-sample.pl                    | 2 +-
 tools/testing/selftests/tc-testing/tdc_batch.py                | 2 +-
 24 files changed, 24 insertions(+), 24 deletions(-)
Documentation/sphinx/parse-headers.pl +1 -1
index a958d8b5e99d..35a2e5f2ef27 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 use strict;
 use Text::Tabs;
 use Getopt::Long;
Documentation/target/tcm_mod_builder.py +1 -1
index 94bf6944bb1e..7e79ff6b09e0 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 # The TCM v4 multi-protocol fabric module generation script for drivers/target/$NEW_MOD
 #
 # Copyright (c) 2010 Rising Tide Systems
Documentation/trace/postprocess/decode_msr.py +1 -1
index 0ab40e0db580..aa9cc7abd5c2 100644
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 # add symbolic names to read_msr / write_msr in trace
 # decode_msr msr-index.h < trace
 import sys
Documentation/trace/postprocess/trace-pagealloc-postprocess.pl +1 -1
index 0a120aae33ce..b9b7d80c2f9d 100644
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 # This is a POC (proof of concept or piece of crap, take your pick) for reading the
 # text representation of trace output related to page allocation. It makes an attempt
 # to extract some high-level information on what is going on. The accuracy of the parser
Documentation/trace/postprocess/trace-vmscan-postprocess.pl +1 -1
index ba976805853a..c9b8b35468c3 100644
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 # This is a POC for reading the text representation of trace output related to
 # page reclaim. It makes an attempt to extract some high-level information on
 # what is going on. The accuracy of the parser may vary
arch/ia64/scripts/unwcheck.py +1 -1
index 89f3a1480a63..cfc02cb3931d 100644
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 # SPDX-License-Identifier: GPL-2.0
 #
 # Usage: unwcheck.py FILE
scripts/bloat-o-meter +1 -1
index a27677146410..654cce5614d8 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 #
 # Copyright 2004 Matt Mackall <[email protected]>
 #
scripts/config +1 -1
index eee5b7f3a092..8c8d7c3d7acc 100755
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 # SPDX-License-Identifier: GPL-2.0
 # Manipulate options in a .config file from the command line
 
scripts/diffconfig +1 -1
index 89abf777f197..627eba5849b5 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 # SPDX-License-Identifier: GPL-2.0
 #
 # diffconfig - a tool to compare .config files.
scripts/show_delta +1 -1
index 5b365009e6a3..55c66dce6fc1 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 #
 # show_deltas: Read list of printk messages instrumented with
 # time data, and format with time deltas.
scripts/sphinx-pre-install +1 -1
index 3524dbc31316..acc185047805 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 use strict;
 
 # Copyright (c) 2017 Mauro Carvalho Chehab <[email protected]>
scripts/tracing/draw_functrace.py +1 -1
index db40fa04cd51..30f117dfab43 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 
 """
 Copyright 2008 (c) Frederic Weisbecker <[email protected]>
tools/kvm/kvm_stat/kvm_stat +1 -1
index fb02aa4591eb..5a1c92afdb01 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 #
 # top-like utility for displaying kvm statistics
 #
tools/perf/python/tracepoint.py +1 -1
index eb76f6516247..461848c7f57d 100755
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#! /usr/bin/env python
 # SPDX-License-Identifier: GPL-2.0
 # -*- python -*-
 # -*- coding: utf-8 -*-
tools/perf/python/twatch.py +1 -1
index c235c22b107a..5a55b25f0b8c 100755
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#! /usr/bin/env python
 # -*- python -*-
 # -*- coding: utf-8 -*-
 #   twatch - Experimental use of the perf python interface
tools/perf/scripts/python/call-graph-from-sql.py +1 -1
index b494a67a1c67..40eb659023f6 100644
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/env python2
 # call-graph-from-sql.py: create call-graph from sql database
 # Copyright (c) 2014-2017, Intel Corporation.
 #
tools/perf/scripts/python/sched-migration.py +1 -1
index de66cb3b72c9..dd3e7ae2a1af 100644
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 #
 # Cpu task migration overview toy
 #
tools/perf/tests/attr.py +1 -1
index 44090a9a19f3..6c68435585c7 100644
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#! /usr/bin/env python
 # SPDX-License-Identifier: GPL-2.0
 
 import os
tools/perf/util/setup.py +1 -1
index 23f1bf175179..393e7a1451f6 100644
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/env python2
 
 from os import getenv
 
tools/power/pm-graph/analyze_boot.py +1 -1
index e83df141a597..4cb5d5aab911 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 #
 # Tool for analyzing boot timing
 # Copyright (c) 2013, Intel Corporation.
tools/power/pm-graph/analyze_suspend.py +1 -1
index 1b60fe203741..d9c467bf8588 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 #
 # Tool for analyzing suspend/resume timing
 # Copyright (c) 2013, Intel Corporation.
tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py +1 -1
index 98c9f2df8aa7..84862a1842d6 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 # -*- coding: utf-8 -*-
 #
 """ This utility can be used to debug and tune the performance of the
tools/testing/ktest/compare-ktest-sample.pl +1 -1
index 4118eb4a842d..ebea21d0a1be 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 # SPDX-License-Identifier: GPL-2.0
 
 open (IN,"ktest.pl");
tools/testing/selftests/tc-testing/tdc_batch.py +1 -1
index 707c6bfef689..174646b14117 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/python3
+#!/usr/bin/env python3
 
 """
 tdc_batch.py - a script to generate TC batch file
Signature · 1 line
2.30.2
#2 lore raw

PATCH 2/2 scripts: switch explicitly to Python 3

In reply to Nicolas Schier

From: Andy Shevchenko <[email protected]>

commit 51839e29cb5954470ea4db7236ef8c3d77a6e0bb upstream.

Some distributions are about to switch to Python 3 support only. This means that /usr/bin/python, which is Python 2, is not available anymore. Hence, switch scripts to use Python 3 explicitly.

---
 scripts/bloat-o-meter | 2 +-
 scripts/diffconfig    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
scripts/bloat-o-meter +1 -1
index 654cce5614d8..0c9a3a715f2c 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 #
 # Copyright 2004 Matt Mackall <[email protected]>
 #
scripts/diffconfig +1 -1
index 627eba5849b5..d5da5fa05d1d 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 # SPDX-License-Identifier: GPL-2.0
 #
 # diffconfig - a tool to compare .config files.
Signature · 1 line
2.30.2
#3 lore raw
In reply to Nicolas Schier
Quoted 11 lines · Nicolas Schier

Current distributions start removing support for Python 2 (and thus /usr/bin/python). To still be able to build v4.14.y and to run supplementary scripts fix shebang lines to use 'env' and switch diffconfig and bloat-o-meter to Python 3 explicitly.

Python 3 availability should be given on v4.14 based distributions (for comparison: Debian jessie 8 (est. 2013) shipped a 3.16 kernel and Python 3).

Both upstream commits are originally included in v5.11 and re-applied on v5.10, v5.4 and v4.19.

All now queued up, thanks.

greg k-h