From: Alyssa Ross <hi@alyssa.is>
To: devel@spectrum-os.org
Subject: [PATCH nixpkgs] spectrumPackages: update execline backtick uses
Date: Sun, 8 Aug 2021 17:04:39 +0000 [thread overview]
Message-ID: <20210808170439.1372425-1-hi@alyssa.is> (raw)
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
next reply other threads:[~2021-08-08 17:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-08 17:04 Alyssa Ross [this message]
2021-08-08 17:49 ` [PATCH nixpkgs] spectrumPackages: update execline backtick uses sternenseemann
2021-08-12 9:23 ` Alyssa Ross
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=20210808170439.1372425-1-hi@alyssa.is \
--to=hi@alyssa.is \
--cc=devel@spectrum-os.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.
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).