From: classabbyamp <classabbyamp@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: [PR PATCH] common: support disabling python shebang rewriting
Date: Thu, 18 Apr 2024 03:58:27 +0200 [thread overview]
Message-ID: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-49886@inbox.vuxu.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 805 bytes --]
There is a new pull request by classabbyamp against master on the void-packages repository
https://github.com/classabbyamp/void-packages py-ver-ignore
https://github.com/void-linux/void-packages/pull/49886
common: support disabling python shebang rewriting
Ghidra's embedded jython contains scripts with shebangs like `#!/usr/bin/env python`. These seem to be designed to be run by jython, *not* the system python, and as such, they should not have their shebangs changed to `#!/usr/bin/python2`. This adds support for disabling that hook in cases like this.
<!-- Uncomment relevant sections and delete options which are not applicable -->
#### Testing the changes
- I tested the changes in this PR: **YES**
A patch file from https://github.com/void-linux/void-packages/pull/49886.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-py-ver-ignore-49886.patch --]
[-- Type: text/x-diff, Size: 3737 bytes --]
From 8588355945b57d708006ba0ca25ae3b6a832d46f Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Wed, 17 Apr 2024 21:51:01 -0400
Subject: [PATCH 1/2] common: support disabling python shebang rewriting
useful if there are special python-containing shebangs that should not
be rewritten, for example with Ghidra's embedded jython.
---
Manual.md | 4 +++-
common/hooks/post-install/04-create-xbps-metadata-scripts.sh | 2 +-
common/hooks/pre-pkg/03-rewrite-python-shebang.sh | 4 ++++
3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/Manual.md b/Manual.md
index 34c737e6df427d..53a2cc8a1510fc 100644
--- a/Manual.md
+++ b/Manual.md
@@ -1250,7 +1250,7 @@ package accordingly. Additionally, the following functions are available:
- *vopt_feature()* `vopt_feature <option> <property>`
Same as `vopt_bool`, but uses `-D<property=enabled` and
- `-D<property>=disabled` respectively.
+ `-D<property>=disabled` respectively.
The following example shows how to change a source package that uses GNU
configure to enable a new build option to support PNG images:
@@ -1630,6 +1630,8 @@ In most cases version is inferred from shebang, install path or build style.
Only required for some multi-language
applications (e.g., the application is written in C while the command is
written in Python) or just single Python file ones that live in `/usr/bin`.
+If `python_version` is set to `ignore`, python-containing shebangs will not be rewritten.
+Use this only if a package should not be using a system version of python.
Also, a set of useful variables are defined to use in the templates:
diff --git a/common/hooks/post-install/04-create-xbps-metadata-scripts.sh b/common/hooks/post-install/04-create-xbps-metadata-scripts.sh
index 69e318a560819e..f21017f8361e6d 100644
--- a/common/hooks/post-install/04-create-xbps-metadata-scripts.sh
+++ b/common/hooks/post-install/04-create-xbps-metadata-scripts.sh
@@ -272,7 +272,7 @@ _EOF
fi
fi
- if [ -n "$python_version" ]; then
+ if [ -n "$python_version" ] && [ "$python_version" != ignore ]; then
pycompile_version=${python_version}
fi
diff --git a/common/hooks/pre-pkg/03-rewrite-python-shebang.sh b/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
index 07162ad2c69bea..47c7a996a501be 100644
--- a/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
+++ b/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
@@ -12,6 +12,10 @@ hook() {
pyver="$python_version"
fi
+ if [ "$python_version" = ignore ]; then
+ return
+ fi
+
if [ -n "$pyver" ]; then
default_shebang="#!/usr/bin/python${pyver%.*}"
fi
From 94f4aa586f74a4d8248fe77382af2704ddd2fd6c Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Wed, 17 Apr 2024 21:52:59 -0400
Subject: [PATCH 2/2] ghidra: don't rewrite python shebangs
---
srcpkgs/ghidra/template | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/srcpkgs/ghidra/template b/srcpkgs/ghidra/template
index f6544fc69f8776..a0b7cc8e565f1a 100644
--- a/srcpkgs/ghidra/template
+++ b/srcpkgs/ghidra/template
@@ -1,7 +1,7 @@
# Template file for 'ghidra'
pkgname=ghidra
version=11.0.3
-revision=1
+revision=2
_dex_ver=2.1
_yajsw_ver=13.09
archs="x86_64* aarch64*"
@@ -69,7 +69,7 @@ skiprdeps="/usr/libexec/ghidra/docs/GhidraClass/ExerciseFiles/Advanced/animals
/usr/libexec/ghidra/docs/GhidraClass/ExerciseFiles/Advanced/sharedReturn
/usr/libexec/ghidra/docs/GhidraClass/ExerciseFiles/Advanced/switch
/usr/libexec/ghidra/docs/GhidraClass/ExerciseFiles/Advanced/write"
-python_version=2 # Jython 2.7.2 stuff
+python_version=ignore # jython, not system python 2
nocross=yes
post_extract() {
next reply other threads:[~2024-04-18 1:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-18 1:58 classabbyamp [this message]
2024-04-18 2:35 ` classabbyamp
2024-04-18 4:38 ` classabbyamp
2024-04-18 11:38 ` fanyx
2024-04-18 16:26 ` classabbyamp
2024-04-24 3:51 ` [PR PATCH] [Merged]: " classabbyamp
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-49886@inbox.vuxu.org \
--to=classabbyamp@users.noreply.github.com \
--cc=ml@inbox.vuxu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).