chore(3p/sources): Bump channels & overlays

* //3p/sources: temporarily switch to nixos-unstable-small, since it
  includes:

  - evans update we are interested in, allowing us to drop our evans
    patches.
  - awscli2 update that unbreaks //users/grfn

* //3p/overlays/tvl:

  - drop evans patches
  - update tdlib to 1.8.11 to make tazjin's emacs happy
  - drop obsolete mullvad workaround

* //users/grfn/keyboard: disable -Werror for array-bounds warnings.
  Seems like a non-trivial job to resolve the warning properly,
  hopefully GCC 12 still generates the same working code as GCC 11 used
  to.

* //users/grfn/system/home: remove yubikey-manager-qt.
  Yubico can't seem to keep that on pace with yubikey-manager. It
  requires a <5 version of the latter which is incompatible with the
  recently released cryptography >= 39.

* //3p/gerrit: update changed FOD hash for the fetch step

Change-Id: I590ab996247e69b0ab5059cd173840ef4ebfe939
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8133
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
Reviewed-by: tazjin <tazjin@tvl.su>
Autosubmit: sterni <sternenseemann@systemli.org>
Reviewed-by: grfn <grfn@gws.fyi>
This commit is contained in:
sterni 2023-02-18 21:04:06 +01:00
parent de3eedff9b
commit 0b64577702
7 changed files with 36 additions and 194 deletions

View file

@ -55,7 +55,7 @@ pkgs.lib.makeOverridable pkgs.buildBazelPackage {
fetchConfigured = true;
fetchAttrs = {
sha256 = "sha256:0vx936j75drpj45px9ixjspxrbbgh2k4xz0v2z1wh60mzm242a9c";
sha256 = "sha256:1z0j09mz7ycf0kmiinv4879jvx25rp6sn2da2hqw8a9rf5rf6ias";
preBuild = ''
rm .bazelversion
'';

View file

@ -1,153 +0,0 @@
From f3e26c276256cb053de94725c10fecf243f11a68 Mon Sep 17 00:00:00 2001
From: Florian Klink <flokli@flokli.de>
Date: Sat, 26 Nov 2022 12:16:53 +0000
Subject: [PATCH] Add support for --bytes-as-base64
This allows entering bytes as a base64-encoded string, using the standard
encoding.
---
README.md | 6 ++++++
.../fixtures/teste2e_repl-call_--help.golden | 3 ++-
fill/filler.go | 2 ++
fill/proto/interactive_filler.go | 8 +++++++-
repl/commands.go | 13 ++++++++++---
usecase/call_rpc.go | 7 ++++---
6 files changed, 31 insertions(+), 8 deletions(-)
diff --git a/README.md b/README.md
index 0f5932d..c02bf00 100644
--- a/README.md
+++ b/README.md
@@ -279,6 +279,12 @@ data (TYPE_BYTES) => \u65e5\u672c\u8a9e
}
```
+Or add the flag `--bytes-as-base64` to pass bytes as a base64-encoded string
+```
+> call UnaryBytes --bytes-as-base64
+data (TYPE_BYTES) => SGVsbG8gV29ybGQh
+```
+
Or add the flag `--bytes-from-file` to read bytes from the provided relative path
```
> call UnaryBytes --bytes-from-file
diff --git a/e2e/testdata/fixtures/teste2e_repl-call_--help.golden b/e2e/testdata/fixtures/teste2e_repl-call_--help.golden
index 3fb24b3..e9b83e1 100644
--- a/e2e/testdata/fixtures/teste2e_repl-call_--help.golden
+++ b/e2e/testdata/fixtures/teste2e_repl-call_--help.golden
@@ -2,7 +2,8 @@ usage: call <method name>
Options:
--add-repeated-manually prompt asks whether to add a value if it encountered to a repeated field
- --bytes-from-file interpret TYPE_BYTES input as a relative path to a file
+ --bytes-as-base64 interpret TYPE_BYTES input as base64-encoded string (mutually exclusive with --bytes-from-file)
+ --bytes-from-file interpret TYPE_BYTES input as a relative path to a file (mutually exclusive with --bytes-as-base64)
--dig-manually prompt asks whether to dig down if it encountered to a message field
--emit-defaults render fields with default values
--enrich enrich response output includes header, message, trailer and status
diff --git a/fill/filler.go b/fill/filler.go
index c53a62d..e0a96b9 100644
--- a/fill/filler.go
+++ b/fill/filler.go
@@ -22,6 +22,8 @@ type Filler interface {
type InteractiveFillerOpts struct {
// DigManually is true, Fill asks whether to dig down if it encountered to a message field.
DigManually,
+ // BytesAsBase64 is true, Fill will interpret input as base64-encoded string
+ BytesAsBase64,
// BytesFromFile is true, Fill will read the contents of the file from the provided relative path.
BytesFromFile,
// AddRepeatedManually is true, Fill asks whether to add a repeated field value
diff --git a/fill/proto/interactive_filler.go b/fill/proto/interactive_filler.go
index fda0f8d..9b0d18c 100644
--- a/fill/proto/interactive_filler.go
+++ b/fill/proto/interactive_filler.go
@@ -1,6 +1,7 @@
package proto
import (
+ "encoding/base64"
"fmt"
"io"
"io/ioutil"
@@ -201,7 +202,12 @@ func (r *resolver) resolveField(f *desc.FieldDescriptor) error {
// So, we need to call strconv.Unquote to interpret backslashes as an escape sequence.
case descriptorpb.FieldDescriptorProto_TYPE_BYTES:
converter = func(v string) (interface{}, error) {
- if r.opts.BytesFromFile {
+ if r.opts.BytesAsBase64 {
+ b, err := base64.StdEncoding.DecodeString(v)
+ if err == nil {
+ return b, nil
+ }
+ } else if r.opts.BytesFromFile {
b, err := ioutil.ReadFile(v)
if err == nil {
return b, nil
diff --git a/repl/commands.go b/repl/commands.go
index 6ba677e..a203ab9 100644
--- a/repl/commands.go
+++ b/repl/commands.go
@@ -155,7 +155,7 @@ func (c *showCommand) Run(w io.Writer, args []string) error {
}
type callCommand struct {
- enrich, digManually, bytesFromFile, emitDefaults, repeatCall, addRepeatedManually bool
+ enrich, digManually, bytesAsBase64, bytesFromFile, emitDefaults, repeatCall, addRepeatedManually bool
}
func (c *callCommand) FlagSet() (*pflag.FlagSet, bool) {
@@ -163,7 +163,8 @@ func (c *callCommand) FlagSet() (*pflag.FlagSet, bool) {
fs.Usage = func() {} // Disable help output when an error occurred.
fs.BoolVar(&c.enrich, "enrich", false, "enrich response output includes header, message, trailer and status")
fs.BoolVar(&c.digManually, "dig-manually", false, "prompt asks whether to dig down if it encountered to a message field")
- fs.BoolVar(&c.bytesFromFile, "bytes-from-file", false, "interpret TYPE_BYTES input as a relative path to a file")
+ fs.BoolVar(&c.bytesAsBase64, "bytes-as-base64", false, "interpret TYPE_BYTES input as base64-encoded string (mutually exclusive with --bytes-from-file)")
+ fs.BoolVar(&c.bytesFromFile, "bytes-from-file", false, "interpret TYPE_BYTES input as a relative path to a file (mutually exclusive with --bytes-as-base64)")
fs.BoolVar(&c.emitDefaults, "emit-defaults", false, "render fields with default values")
fs.BoolVarP(&c.repeatCall, "repeat", "r", false, "repeat previous unary or server streaming request (if exists)")
fs.BoolVar(&c.addRepeatedManually, "add-repeated-manually", false, "prompt asks whether to add a value if it encountered to a repeated field")
@@ -199,9 +200,15 @@ func (c *callCommand) Run(w io.Writer, args []string) error {
},
)
+ // Ensure bytesAsBase64 and bytesFromFile are not both set
+ // pflag doesn't suppport mutually exclusive flags (https://github.com/spf13/pflag/issues/270)
+ if c.bytesAsBase64 && c.bytesFromFile {
+ return errors.New("only one of --bytes-as-base64 or --bytes-from-file can be specified")
+ }
+
// here we create the request context
// we also add the call command flags here
- err := usecase.CallRPCInteractively(context.Background(), w, args[0], c.digManually, c.bytesFromFile, c.repeatCall, c.addRepeatedManually)
+ err := usecase.CallRPCInteractively(context.Background(), w, args[0], c.digManually, c.bytesAsBase64, c.bytesFromFile, c.repeatCall, c.addRepeatedManually)
if errors.Is(err, io.EOF) {
return errors.New("inputting canceled")
}
diff --git a/usecase/call_rpc.go b/usecase/call_rpc.go
index e5f9415..48e795e 100644
--- a/usecase/call_rpc.go
+++ b/usecase/call_rpc.go
@@ -478,15 +478,16 @@ func (f *interactiveFiller) Fill(v interface{}) error {
return f.fillFunc(v)
}
-func CallRPCInteractively(ctx context.Context, w io.Writer, rpcName string, digManually, bytesFromFile, rerunPrevious, addRepeatedManually bool) error {
- return dm.CallRPCInteractively(ctx, w, rpcName, digManually, bytesFromFile, rerunPrevious, addRepeatedManually)
+func CallRPCInteractively(ctx context.Context, w io.Writer, rpcName string, digManually, bytesAsBase64, bytesFromFile, rerunPrevious, addRepeatedManually bool) error {
+ return dm.CallRPCInteractively(ctx, w, rpcName, digManually, bytesAsBase64, bytesFromFile, rerunPrevious, addRepeatedManually)
}
-func (m *dependencyManager) CallRPCInteractively(ctx context.Context, w io.Writer, rpcName string, digManually, bytesFromFile, rerunPrevious, addRepeatedManually bool) error {
+func (m *dependencyManager) CallRPCInteractively(ctx context.Context, w io.Writer, rpcName string, digManually, bytesAsBase64, bytesFromFile, rerunPrevious, addRepeatedManually bool) error {
return m.CallRPC(ctx, w, rpcName, rerunPrevious, &interactiveFiller{
fillFunc: func(v interface{}) error {
return m.interactiveFiller.Fill(v, fill.InteractiveFillerOpts{
DigManually: digManually,
+ BytesAsBase64: bytesAsBase64,
BytesFromFile: bytesFromFile,
AddRepeatedManually: addRepeatedManually,
})
--
2.38.1

View file

@ -45,12 +45,15 @@ depot.nix.readTree.drvTargets {
];
});
# Apply workaround from https://github.com/NixOS/nixpkgs/pull/211469
# until it hits the nixos-unstable channel
mullvad = super.mullvad.overrideAttrs (old: {
nativeBuildInputs = old.nativeBuildInputs ++ [
self.buildPackages.git
];
# Too match telega in emacs-overlay or wherever
tdlib = super.tdlib.overrideAttrs (_: {
version = "1.8.11";
src = self.fetchFromGitHub {
owner = "tdlib";
repo = "td";
rev = "1543c41f3411bd6aa74713c8aba4e93fa8d952c7";
sha256 = "0qw3a2wh5hfad0m4ixywh5p2mvyprkw982jb7n4sqxdvwc0xfcgq";
};
});
home-manager = super.home-manager.overrideAttrs (_: {
@ -100,13 +103,6 @@ depot.nix.readTree.drvTargets {
};
});
# `Call $methodName --bytes-as-base64` support for evans
evans = super.evans.overrideAttrs (old: {
patches = old.patches or [ ] ++ [
./patches/evans-add-support-for-bytes-as-base64.patch
];
});
# nix-serve does not work with nix 2.4
# https://github.com/edolstra/nix-serve/issues/28
nix-serve = super.nix-serve.override { nix = super.nix_2_3; };

View file

@ -17,10 +17,10 @@
"homepage": "",
"owner": "nix-community",
"repo": "emacs-overlay",
"rev": "6020998bf96c71e24b628fa24721492266b66d5c",
"sha256": "05941qsk7138ylfpzqcqcgrpjw0jnyh2r1q6nhyh7n3d5q00hc8b",
"rev": "545383bd7de8e3f100356fea217698379d8f5c31",
"sha256": "0bkhjhh20wxq6qxvnfc7hfzin7j4waqm5wz346cmlzlfqy2rkd5i",
"type": "tarball",
"url": "https://github.com/nix-community/emacs-overlay/archive/6020998bf96c71e24b628fa24721492266b66d5c.tar.gz",
"url": "https://github.com/nix-community/emacs-overlay/archive/545383bd7de8e3f100356fea217698379d8f5c31.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"home-manager": {
@ -72,15 +72,15 @@
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"nixpkgs": {
"branch": "nixos-unstable",
"branch": "nixos-unstable-small",
"description": "Nix Packages collection",
"homepage": "",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "5a350a8f31bb7ef0c6e79aea3795a890cf7743d4",
"sha256": "0fjii4ay8lp1byq74vq6p5bv754ssbf0ij5xwr5zr27db23ws77j",
"rev": "de098f6584d4f7bb9965b5a7ab49647f57e736c1",
"sha256": "0fhkvkkcams4bmsnzhkhf7va5i5pg89dd0rf6b7hx7dlqxsr0d0n",
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/5a350a8f31bb7ef0c6e79aea3795a890cf7743d4.tar.gz",
"url": "https://github.com/NixOS/nixpkgs/archive/de098f6584d4f7bb9965b5a7ab49647f57e736c1.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"nixpkgs-stable": {
@ -101,10 +101,10 @@
"homepage": "",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "fce84890519f05703e4b1f4c70bf9bb118206ffd",
"sha256": "10c858gxxh5knvn6mi3s59kr1nx222rykrp6x38vykq93y3hq68m",
"rev": "c1df023b1aaded1b65a1f4ad604a98a58ab4db97",
"sha256": "141fkrkd8sjijwi3mn6kb3l2f6p2s6v3w28c36qzhknzrml4s9ra",
"type": "tarball",
"url": "https://github.com/oxalica/rust-overlay/archive/fce84890519f05703e4b1f4c70bf9bb118206ffd.tar.gz",
"url": "https://github.com/oxalica/rust-overlay/archive/c1df023b1aaded1b65a1f4ad604a98a58ab4db97.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"rustsec-advisory-db": {
@ -113,10 +113,10 @@
"homepage": "https://rustsec.org",
"owner": "RustSec",
"repo": "advisory-db",
"rev": "bb92d2d5d850c7c022290c53ca4faa55b5b498a3",
"sha256": "0wcfgc7nrn2qapib1hm1jzw57p8dvkgry9xwv2y2m6bqvr3nbysr",
"rev": "9a5b1008028e4b37e91f5951e639ad7848232f8e",
"sha256": "1ybx07s0y09qhhyhr8wysglbnfcnsb8q2i5vg39ndj4akqc02a9x",
"type": "tarball",
"url": "https://github.com/RustSec/advisory-db/archive/bb92d2d5d850c7c022290c53ca4faa55b5b498a3.tar.gz",
"url": "https://github.com/RustSec/advisory-db/archive/9a5b1008028e4b37e91f5951e639ad7848232f8e.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
}
}

View file

@ -32,6 +32,16 @@ rec {
AVR_CFLAGS = [
"-isystem ${avrlibc}/avr/include"
"-L${avrlibc}/avr/lib/avr5"
# GCC 12 has improved array-bounds warnings, failing the build of QMK.
# Newer versions of the firmware would work probably, but they heavily
# altered the build system, so it is non-trivial. Backporting the patch
# that fixes it seems difficult the next change to the offending matrix.c
# after the pinned qmkSource commit is
# https://github.com/qmk/qmk_firmware/commit/11c308d436180974b7719ce78cdffdd83a1302c0
# which heavily changes the way the code works.
#
# TODO(grfn): address this properly
"-Wno-error=array-bounds"
];
AVR_ASFLAGS = AVR_CFLAGS;

View file

@ -57,7 +57,8 @@ in
keybase
openssl
yubikey-manager
yubikey-manager-qt
# TODO(grfn): lagging behind yubikey-manager and doesn't support cryptography >= 39
# yubikey-manager-qt
# Spotify...etc
spotify

View file

@ -9,17 +9,6 @@
, ...
}:
let
# `Call $methodName --bytes-as-base64` support for evans
evans = pkgs.evans.overrideAttrs (old: {
patches = old.patches or [ ] ++ [
(pkgs.fetchpatch {
url = "https://github.com/ktr0731/evans/pull/611/commits/f2109627c0d20588980fe6fd6348d223dbdf7c33.patch";
hash = "sha256-ff8drvAYwQvHeymaHEruvwDYynClpzPM5lrB7IeQHBs=";
})
];
});
in
pkgs.mkShell {
name = "tvix-rust-dev-env";
packages = [
@ -30,7 +19,6 @@ pkgs.mkShell {
pkgs.rustc
pkgs.rustfmt
pkgs.protobuf
evans
pkgs.evans
];
}