Skip to contentSkip to conversation

Allow builds and script usage on current systems

PATCH New Nicolas Schier 1 participant 3 messages May 26, 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.9.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.9 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/analyze_suspend.py                                     | 2 +-
 scripts/bloat-o-meter                                          | 2 +-
 scripts/bootgraph.pl                                           | 2 +-
 scripts/checkincludes.pl                                       | 2 +-
 scripts/checkstack.pl                                          | 2 +-
 scripts/config                                                 | 2 +-
 scripts/diffconfig                                             | 2 +-
 scripts/dtc/dt_to_config                                       | 2 +-
 scripts/extract_xc3028.pl                                      | 2 +-
 scripts/get_dvb_firmware                                       | 2 +-
 scripts/markup_oops.pl                                         | 2 +-
 scripts/profile2linkerlist.pl                                  | 2 +-
 scripts/show_delta                                             | 2 +-
 scripts/stackdelta                                             | 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/sched-migration.py                   | 2 +-
 tools/perf/util/setup.py                                       | 2 +-
 tools/testing/ktest/compare-ktest-sample.pl                    | 2 +-
 27 files changed, 27 insertions(+), 27 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.9, 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/analyze_suspend.py                                     | 2 +-
 scripts/bloat-o-meter                                          | 2 +-
 scripts/bootgraph.pl                                           | 2 +-
 scripts/checkincludes.pl                                       | 2 +-
 scripts/checkstack.pl                                          | 2 +-
 scripts/config                                                 | 2 +-
 scripts/diffconfig                                             | 2 +-
 scripts/dtc/dt_to_config                                       | 2 +-
 scripts/extract_xc3028.pl                                      | 2 +-
 scripts/get_dvb_firmware                                       | 2 +-
 scripts/markup_oops.pl                                         | 2 +-
 scripts/profile2linkerlist.pl                                  | 2 +-
 scripts/show_delta                                             | 2 +-
 scripts/stackdelta                                             | 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/sched-migration.py                   | 2 +-
 tools/perf/util/setup.py                                       | 2 +-
 tools/testing/ktest/compare-ktest-sample.pl                    | 2 +-
 27 files changed, 27 insertions(+), 27 deletions(-)
Documentation/sphinx/parse-headers.pl +1 -1
index db0186a7618f..299b0f82af27 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 use strict;
 use Text::Tabs;
 
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 8f961ef2b457..7749cdf372f7 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 2bfd941ff7c7..c27849889e19 100644
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 #
 # Usage: unwcheck.py FILE
 #
scripts/analyze_suspend.py +1 -1
index a0ba48fa2c5e..edc4f1255f9b 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 #
 # Tool for analyzing suspend/resume timing
 # Copyright (c) 2013, Intel Corporation.
scripts/bloat-o-meter +1 -1
index d9ff038c1b28..08e607e829c0 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 #
 # Copyright 2004 Matt Mackall <[email protected]>
 #
scripts/bootgraph.pl +1 -1
index 9ca667bcaee9..594c55541b16 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 
 # Copyright 2008, Intel Corporation
 #
scripts/checkincludes.pl +1 -1
index 97b2c6143fe4..cfdfa02d4d92 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 #
 # checkincludes: find/remove files included more than once
 #
scripts/checkstack.pl +1 -1
index b8f616545277..32828fafcf5b 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 
 #	Check the stack usage of functions
 #
scripts/config +1 -1
index 73de17d39698..06ac9882e1de 100755
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 # Manipulate options in a .config file from the command line
 
 myname=${0##*/}
scripts/diffconfig +1 -1
index 0db267d0adc9..ad1b16ec0f5b 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 #
 # diffconfig - a tool to compare .config files.
 #
scripts/dtc/dt_to_config +1 -1
index 9a248b505c58..5dfd1bff351f 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 
 # Copyright 2016 by Frank Rowand
 # Copyright 2016 by Gaurav Minocha
scripts/extract_xc3028.pl +1 -1
index 47877deae6d7..61d9b256c658 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 
 # Copyright (c) Mauro Carvalho Chehab <[email protected]>
 # Released under GPLv2
scripts/get_dvb_firmware +1 -1
index 1a0a04125f71..f3f230225aba 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 #     DVB firmware extractor
 #
 #     (c) 2004 Andrew de Quincey
scripts/markup_oops.pl +1 -1
index c21d16328d3f..70dcfb6b3de1 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 
 use File::Basename;
 use Math::BigInt;
scripts/profile2linkerlist.pl +1 -1
index 6943fa7cc95b..f23d7be94394 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 
 #
 # Takes a (sorted) output of readprofile and turns it into a list suitable for
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/stackdelta +1 -1
index 48eabf2f48f8..20a79f19a111 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 
 # Read two files produced by the stackusage script, and show the
 # delta between them.
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 581278c58488..5e5797cc3757 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 eb4dbed57de7..ce273c8b512b 100755
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#! /usr/bin/env python
 # -*- 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/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/util/setup.py +1 -1
index c8680984d2d6..163f38fbd79c 100644
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/env python2
 
 from distutils.core import setup, Extension
 from os import getenv
tools/testing/ktest/compare-ktest-sample.pl +1 -1
index a373a5bfff68..c488e863d83f 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 
 open (IN,"ktest.pl");
 while (<IN>) {
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 08e607e829c0..a650bea5ccdd 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 #
 # Copyright 2004 Matt Mackall <[email protected]>
 #
scripts/diffconfig +1 -1
index ad1b16ec0f5b..19189f3c4a03 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 #
 # diffconfig - a tool to compare .config files.
 #
Signature · 1 line
2.30.2