diff options
| -rw-r--r-- | meta-networking/recipes-connectivity/ufw/ufw/fix-dynamic-update-of-python-shebang.patch | 57 | ||||
| -rw-r--r-- | meta-networking/recipes-connectivity/ufw/ufw_0.33.bb | 1 |
2 files changed, 58 insertions, 0 deletions
diff --git a/meta-networking/recipes-connectivity/ufw/ufw/fix-dynamic-update-of-python-shebang.patch b/meta-networking/recipes-connectivity/ufw/ufw/fix-dynamic-update-of-python-shebang.patch new file mode 100644 index 0000000000..0bb0315ccd --- /dev/null +++ b/meta-networking/recipes-connectivity/ufw/ufw/fix-dynamic-update-of-python-shebang.patch | |||
| @@ -0,0 +1,57 @@ | |||
| 1 | From b961a7fceb5654c283c3f987bee593d52abaf1f5 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Silcet <camorga1@gmail.com> | ||
| 3 | Date: Mon, 26 Apr 2021 07:47:02 +0000 | ||
| 4 | Subject: [PATCH] ufw: Fix dynamic update of python shebang | ||
| 5 | |||
| 6 | [meta-openembedded ticket #327] -- https://github.com/openembedded/meta-openembedded/issues/327 | ||
| 7 | |||
| 8 | The python version in the shebang at the begining of the ufw script | ||
| 9 | should be the same one as the version the setup.py script was called | ||
| 10 | with. | ||
| 11 | |||
| 12 | The fix in patch "setup-only-make-one-reference-to-env.patch" | ||
| 13 | depends on sys.executable returning "/usr/bin/env pythonX". However, | ||
| 14 | it returns "/usr/bin/pythonX". Using sys.version_info we can get the | ||
| 15 | major version of the python used to called the script and append | ||
| 16 | that to the shebang line so it works as intended. | ||
| 17 | |||
| 18 | Upstream-status: Pending | ||
| 19 | |||
| 20 | Signed-off-by: Silcet <camorga1@gmail.com> | ||
| 21 | --- | ||
| 22 | setup.py | 21 ++++++--------------- | ||
| 23 | 1 file changed, 6 insertions(+), 15 deletions(-) | ||
| 24 | |||
| 25 | diff --git a/setup.py b/setup.py | ||
| 26 | index ca730b7..941bbf6 100644 | ||
| 27 | --- a/setup.py | ||
| 28 | +++ b/setup.py | ||
| 29 | @@ -112,22 +112,13 @@ class Install(_install, object): | ||
| 30 | for f in [ script, manpage, manpage_f ]: | ||
| 31 | self.mkpath(os.path.dirname(f)) | ||
| 32 | |||
| 33 | - # if sys.executable == /usr/bin/env python* the result will be the top | ||
| 34 | - # of ufw getting: | ||
| 35 | - # | ||
| 36 | - # #! /usr/bin/env /usr/bin/env python | ||
| 37 | - # | ||
| 38 | - # which is not ideal | ||
| 39 | - # | ||
| 40 | # update the interpreter to that of the one the user specified for setup | ||
| 41 | - print("Updating staging/ufw to use (%s)" % (sys.executable)) | ||
| 42 | - | ||
| 43 | - if re.search("(/usr/bin/env)", sys.executable): | ||
| 44 | - print("found 'env' in sys.executable (%s)" % (sys.executable)) | ||
| 45 | - subprocess.call(["sed", | ||
| 46 | - "-i.jjm", | ||
| 47 | - "1s%^#.*python.*%#! " + sys.executable + "%g", | ||
| 48 | - 'staging/ufw']) | ||
| 49 | + python_major = sys.version_info.major | ||
| 50 | + print("Updating staging/ufw to use (python%s)" % (python_major)) | ||
| 51 | + subprocess.call(["sed", | ||
| 52 | + "-i.jjm", | ||
| 53 | + "1s%^#.*python.*%#! " + sys.executable + "%g", | ||
| 54 | + 'staging/ufw']) | ||
| 55 | |||
| 56 | self.copy_file('staging/ufw', script) | ||
| 57 | self.copy_file('doc/ufw.8', manpage) | ||
diff --git a/meta-networking/recipes-connectivity/ufw/ufw_0.33.bb b/meta-networking/recipes-connectivity/ufw/ufw_0.33.bb index 42fc262589..ee366aa665 100644 --- a/meta-networking/recipes-connectivity/ufw/ufw_0.33.bb +++ b/meta-networking/recipes-connectivity/ufw/ufw_0.33.bb | |||
| @@ -16,6 +16,7 @@ SRC_URI = " \ | |||
| 16 | file://0003-fix-typeerror-on-error.patch \ | 16 | file://0003-fix-typeerror-on-error.patch \ |
| 17 | file://0004-lp1039729.patch \ | 17 | file://0004-lp1039729.patch \ |
| 18 | file://0005-lp1191197.patch \ | 18 | file://0005-lp1191197.patch \ |
| 19 | file://fix-dynamic-update-of-python-shebang.patch \ | ||
| 19 | " | 20 | " |
| 20 | 21 | ||
| 21 | UPSTREAM_CHECK_URI = "https://launchpad.net/ufw" | 22 | UPSTREAM_CHECK_URI = "https://launchpad.net/ufw" |
