From 80435b3f3e129b873dcaee303e02f16fcd9ce056 Mon Sep 17 00:00:00 2001 From: Kevin Daudt Date: Fri, 26 Jan 2024 18:57:35 +0000 Subject: [PATCH] testing/py3-litex-hub-modules: avoid global exec Shelling out in the global scope is expensive and in this case not necessary, change the `cut` invocation to parameter substitution. `${foo%:*}` cuts of the `:` and everything that comes after it, which is the same as `| cut -d : -f 1` does. `${foo#*:}` cuts of everything until and including the `:`, which is the same as `| cut -d : -f 2` does. --- testing/py3-litex-hub-modules/APKBUILD | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/testing/py3-litex-hub-modules/APKBUILD b/testing/py3-litex-hub-modules/APKBUILD index 3711cbb3b1d..d38eb9206a9 100644 --- a/testing/py3-litex-hub-modules/APKBUILD +++ b/testing/py3-litex-hub-modules/APKBUILD @@ -73,11 +73,12 @@ options="!check" options="$options !strip" _repo_name() { - echo $1 | cut -d : -f 1 + echo ${1%%:*} } _pkgver() { - echo $1 | cut -d : -f 2 + a=${1%:*} + echo ${a#*:} } _version_by_name() {