summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorAnton Luka Šijanec <anton@sijanec.eu>2023-01-23 19:37:53 +0100
committerAnton Luka Šijanec <anton@sijanec.eu>2023-01-23 19:37:53 +0100
commit5515b3b488c1dc9b53752419f895ccc85f70788a (patch)
tree22bea78d1ff97143c368f6a9d3ba9caaa30d6a26 /etc
parentportage very idle (diff)
downloadn-5515b3b488c1dc9b53752419f895ccc85f70788a.tar
n-5515b3b488c1dc9b53752419f895ccc85f70788a.tar.gz
n-5515b3b488c1dc9b53752419f895ccc85f70788a.tar.bz2
n-5515b3b488c1dc9b53752419f895ccc85f70788a.tar.lz
n-5515b3b488c1dc9b53752419f895ccc85f70788a.tar.xz
n-5515b3b488c1dc9b53752419f895ccc85f70788a.tar.zst
n-5515b3b488c1dc9b53752419f895ccc85f70788a.zip
Diffstat (limited to 'etc')
-rw-r--r--etc/portage/patches/sys-apps/portage/command-substitution.patch25
1 files changed, 25 insertions, 0 deletions
diff --git a/etc/portage/patches/sys-apps/portage/command-substitution.patch b/etc/portage/patches/sys-apps/portage/command-substitution.patch
new file mode 100644
index 0000000..30edeae
--- /dev/null
+++ b/etc/portage/patches/sys-apps/portage/command-substitution.patch
@@ -0,0 +1,25 @@
+diff --git a/lib/portage/util/__init__.py b/lib/portage/util/__init__.py
+index 285bf66..74e3232 100644
+--- a/lib/portage/util/__init__.py
++++ b/lib/portage/util/__init__.py
+@@ -992,6 +992,20 @@ def varexpand(mystring, mydict=None, error_leader=None):
+ newstring.append(current)
+ continue
+
++ if mystring[pos] == "(":
++ # print(f"[šijanec.eu] debug0 {mystring}");
++ end = mystring[pos:].find(")")
++ if end == -1:
++ msg = error_leader() + "[šijanec.eu] missing closing ) in shell command substitution variable"
++ writemsg(msg + "\n", noiselevel=-1)
++ return ""
++ cmd = mystring[pos+1:pos+end]
++ out = subprocess.run(["sh", "-c", cmd], stdout=subprocess.PIPE).stdout.decode("utf-8")
++ newstring.append(out.strip())
++ pos += end+1
++ # print(f"[šijanec.eu] debug {cmd} {newstring}")
++ continue
++
+ if mystring[pos] == "{":
+ pos += 1
+ if pos == length: