aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSören Tempel <soeren+git@soeren-tempel.net>2021-09-18 05:18:05 +0200
committerSören Tempel <soeren+git@soeren-tempel.net>2021-09-18 05:18:05 +0200
commit0a1c17f4537959435c32e3d6b4ef6505f377a005 (patch)
tree912d95ef5a5a5435bdd5eaab51db80e0fd09957d
parent9289e9034a9c4d8fabf720d870e8e294c17b9d61 (diff)
main/clang: improve code to replace python shebangs
This fixes the shebang of git-clang-format and other tools which do not have a *.py file extension. Fixes #12975
-rw-r--r--main/clang/APKBUILD10
1 files changed, 6 insertions, 4 deletions
diff --git a/main/clang/APKBUILD b/main/clang/APKBUILD
index 6a0dbe76e97..e4324f86027 100644
--- a/main/clang/APKBUILD
+++ b/main/clang/APKBUILD
@@ -6,7 +6,7 @@
pkgname=clang
# Note: Update together with llvm.
pkgver=11.1.0
-pkgrel=1
+pkgrel=2
_llvmver=${pkgver%%.*}
pkgdesc="A C language family front-end for LLVM"
arch="all"
@@ -44,9 +44,11 @@ builddir="$srcdir/clang-$pkgver.src"
prepare() {
mv "$srcdir/clang-tools-extra-$pkgver.src" "$builddir/tools/extra"
- # Substitute python hashbangs with python3
- find . -name '*.py' -type f -exec \
- sed -i 's,^#!/usr/bin/env python$,#!/usr/bin/env python3,' {} +
+ # Substitute python hashbangs with python3.
+ # Some scripts do not have a *.py postfix, thus iterate over all files.
+ grep -l -R "^#!/usr/bin/env python$" . | while read f; do
+ sed -i "$f" -e 's|^#!/usr/bin/env python$|&3|'
+ done
default_prepare
}