* [PATCH nixpkgs] spectrumPackages: update execline backtick uses
@ 2021-08-08 17:04 Alyssa Ross
2021-08-08 17:49 ` sternenseemann
0 siblings, 1 reply; 3+ messages in thread
From: Alyssa Ross @ 2021-08-08 17:04 UTC (permalink / raw)
To: devel
execline 2.8.0.0 changed how backtick's options work:
* -i (exit with the program's error code on failure) and -n (chomp off
a trailing newline from the captured output) are now the defaults.
* -E has been introduced, which does importas automatically.
-E is fantastic, because we followed every single use of backtick with
importas.
Even we didn't have -n before, it's okay that chomping will now be
enabled from the default, because in all those cases, there won't be a
trailing newline anyway.
---
.../linux/spectrum/testhost/default.nix | 14 ++++----------
pkgs/os-specific/linux/spectrum/vm/app/default.nix | 3 +--
pkgs/os-specific/linux/spectrum/vm/net/default.nix | 6 ++----
3 files changed, 7 insertions(+), 16 deletions(-)
diff --git a/pkgs/os-specific/linux/spectrum/testhost/default.nix b/pkgs/os-specific/linux/spectrum/testhost/default.nix
index de62f0add67..d81ff8b826e 100644
--- a/pkgs/os-specific/linux/spectrum/testhost/default.nix
+++ b/pkgs/os-specific/linux/spectrum/testhost/default.nix
@@ -52,18 +52,14 @@ let
# routers from clients. Other bits are reserved.
# 5-6 Last two octets of client's IP (in 100.64.0.0/16).
#
- backtick -i router_mac {
+ backtick -E router_mac {
pipeline { printf %.4x ${toString sys-vms.app.vmID} }
sed s/^\\(..\\)\\(..\\)$/0A:B3:EC:80:\\1:\\2/
}
- backtick -i client_mac {
+ backtick -E client_mac {
pipeline { printf %.4x ${toString sys-vms.app.vmID} }
sed s/^\\(..\\)\\(..\\)$/0A:B3:EC:00:\\1:\\2/
}
- multisubstitute {
- importas -iu router_mac router_mac
- importas -iu client_mac client_mac
- }
# Create the net VM end, and attach it to the net VM.
#
@@ -143,12 +139,11 @@ let
# is allowed to fail because it might already know that, in
# which case it'll return EEXIST.
if { modprobe vfio-pci }
- backtick -in device_id {
+ backtick -E device_id {
if { dd bs=2 skip=1 count=2 status=none if=''${PCI_PATH}/vendor }
if { printf " " }
dd bs=2 skip=1 count=2 status=none if=''${PCI_PATH}/device
}
- importas -iu device_id device_id
foreground {
redirfd -w 1 /sys/bus/pci/drivers/vfio-pci/new_id
printf "%s" $device_id
@@ -205,8 +200,7 @@ writeScriptBin "spectrum-testhost" ''
if { redirfd -w 1 /proc/sys/net/ipv4/ip_forward echo 1 }
importas -iu runtime_dir XDG_RUNTIME_DIR
- backtick -in TOP { mktemp -dp $runtime_dir spectrum.XXXXXXXXXX }
- importas -iu top TOP
+ backtick -E top { mktemp -dp $runtime_dir spectrum.XXXXXXXXXX }
if { echo $top }
if { rsync -r --chmod=Du+w ${servicesDir}/ ''${top}/service }
background {
diff --git a/pkgs/os-specific/linux/spectrum/vm/app/default.nix b/pkgs/os-specific/linux/spectrum/vm/app/default.nix
index f8ff480932c..9ffed7e5b13 100644
--- a/pkgs/os-specific/linux/spectrum/vm/app/default.nix
+++ b/pkgs/os-specific/linux/spectrum/vm/app/default.nix
@@ -26,12 +26,11 @@ runCommand "vm-app" rec {
oneshot
'';
up = writeText "net-up" ''
- backtick -i LOCAL_IP {
+ backtick -E LOCAL_IP {
pipeline { ip -j link show eth0 }
pipeline { jq -r ".[0].address | split(\":\") | .[4:6] | \"0x\" + .[]" }
xargs printf "100.64.%d.%d"
}
- importas -iu LOCAL_IP LOCAL_IP
if { ip address add ''${LOCAL_IP}/32 dev eth0 }
if { ip link set eth0 up }
diff --git a/pkgs/os-specific/linux/spectrum/vm/net/default.nix b/pkgs/os-specific/linux/spectrum/vm/net/default.nix
index 5921b62fcf7..75c86b8f92c 100644
--- a/pkgs/os-specific/linux/spectrum/vm/net/default.nix
+++ b/pkgs/os-specific/linux/spectrum/vm/net/default.nix
@@ -54,12 +54,11 @@ runCommand "vm-net" rec {
# Our IP is encoded in the NIC-specific portion of the
# interface's MAC address.
- backtick -i CLIENT_IP {
+ backtick -E CLIENT_IP {
pipeline { ip -j link show $INTERFACE }
pipeline { jq -r ".[0].address | split(\":\") | .[4:6] | \"0x\" + .[]" }
xargs printf "100.64.%d.%d"
}
- importas -iu CLIENT_IP CLIENT_IP
if { ip address add 169.254.0.1/32 dev $INTERFACE }
if { ip link set $INTERFACE up }
@@ -121,7 +120,7 @@ runCommand "vm-net" rec {
'';
run = writeScript "connman-run" ''
#! ${execline}/bin/execlineb -S0
- backtick -in HARDWARE_INTERFACES {
+ backtick -E HARDWARE_INTERFACES {
pipeline {
find -L /sys/class/net -mindepth 2 -maxdepth 2 -name address -print0
}
@@ -132,7 +131,6 @@ runCommand "vm-net" rec {
# Extract the interface names from the address file paths.
awk -F/ "{if (NR > 1) printf \",\"; printf \"%s\", $5}"
}
- importas -iu HARDWARE_INTERFACES HARDWARE_INTERFACES
${connman}/bin/connmand -ni $HARDWARE_INTERFACES
'';
base-commit: d2e147bedf251976ed99b94b6c905d6761f7a892
--
2.32.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH nixpkgs] spectrumPackages: update execline backtick uses
2021-08-08 17:04 [PATCH nixpkgs] spectrumPackages: update execline backtick uses Alyssa Ross
@ 2021-08-08 17:49 ` sternenseemann
2021-08-12 9:23 ` Alyssa Ross
0 siblings, 1 reply; 3+ messages in thread
From: sternenseemann @ 2021-08-08 17:49 UTC (permalink / raw)
To: devel
On 8/8/21 7:04 PM, Alyssa Ross wrote:
> execline 2.8.0.0 changed how backtick's options work:
>
> * -i (exit with the program's error code on failure) and -n (chomp off
> a trailing newline from the captured output) are now the defaults.
> * -E has been introduced, which does importas automatically.
>
> -E is fantastic, because we followed every single use of backtick with
> importas.
>
> Even we didn't have -n before, it's okay that chomping will now be
> enabled from the default, because in all those cases, there won't be a
> trailing newline anyway.
> ---
> .../linux/spectrum/testhost/default.nix | 14 ++++----------
> pkgs/os-specific/linux/spectrum/vm/app/default.nix | 3 +--
> pkgs/os-specific/linux/spectrum/vm/net/default.nix | 6 ++----
> 3 files changed, 7 insertions(+), 16 deletions(-)
>
> base-commit: d2e147bedf251976ed99b94b6c905d6761f7a892
> --
> 2.32.0
Looks good and quite straightforward. All substitutions seem correct.
Reviewed-by: sterni <sternenseemann@systemli.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH nixpkgs] spectrumPackages: update execline backtick uses
2021-08-08 17:49 ` sternenseemann
@ 2021-08-12 9:23 ` Alyssa Ross
0 siblings, 0 replies; 3+ messages in thread
From: Alyssa Ross @ 2021-08-12 9:23 UTC (permalink / raw)
To: sternenseemann; +Cc: devel
[-- Attachment #1: Type: text/plain, Size: 1229 bytes --]
sternenseemann <sternenseemann@systemli.org> writes:
> On 8/8/21 7:04 PM, Alyssa Ross wrote:
>> execline 2.8.0.0 changed how backtick's options work:
>>
>> * -i (exit with the program's error code on failure) and -n (chomp off
>> a trailing newline from the captured output) are now the defaults.
>> * -E has been introduced, which does importas automatically.
>>
>> -E is fantastic, because we followed every single use of backtick with
>> importas.
>>
>> Even we didn't have -n before, it's okay that chomping will now be
>> enabled from the default, because in all those cases, there won't be a
>> trailing newline anyway.
>> ---
>> .../linux/spectrum/testhost/default.nix | 14 ++++----------
>> pkgs/os-specific/linux/spectrum/vm/app/default.nix | 3 +--
>> pkgs/os-specific/linux/spectrum/vm/net/default.nix | 6 ++----
>> 3 files changed, 7 insertions(+), 16 deletions(-)
>>
>> base-commit: d2e147bedf251976ed99b94b6c905d6761f7a892
>> --
>> 2.32.0
>
> Looks good and quite straightforward. All substitutions seem correct.
>
> Reviewed-by: sterni <sternenseemann@systemli.org>
Thanks so much for the review! Committed as
769e648d243223613d008276bcac18a164302ba8. :)
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-08-12 9:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-08 17:04 [PATCH nixpkgs] spectrumPackages: update execline backtick uses Alyssa Ross
2021-08-08 17:49 ` sternenseemann
2021-08-12 9:23 ` Alyssa Ross
Code repositories for project(s) associated with this public inbox
https://spectrum-os.org/git/crosvm
https://spectrum-os.org/git/doc
https://spectrum-os.org/git/mktuntap
https://spectrum-os.org/git/nixpkgs
https://spectrum-os.org/git/spectrum
https://spectrum-os.org/git/ucspi-vsock
https://spectrum-os.org/git/www
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).