sysutils/bkt: Add new port

bkt (pronounced bucket) is a subprocess caching utility written in Rust,
inspired by bash-cache.
Wrapping expensive process invocations with bkt allows callers to reuse recent
invocations without complicating their application logic. This can be useful in
shell prompts, interactive applications such as fzf, and long-running programs
that poll other processes.

When bkt is passed a command it hasn't seen before (or recently) it executes
the command synchronously and caches its stdout, stderr, and exit code.
Calling bkt again with the same command reads the data from the cache and
outputs it as if the command had been run again.
This commit is contained in:
Emanuel Haupt 2022-02-15 22:24:29 +01:00
parent 8868e125ba
commit 6f16c9c835
5 changed files with 186 additions and 0 deletions

View file

@ -123,6 +123,7 @@
SUBDIR += biosfont
SUBDIR += bkpupsd
SUBDIR += bksh
SUBDIR += bkt
SUBDIR += boot-extract
SUBDIR += boxbackup-devel
SUBDIR += bpytop

22
sysutils/bkt/Makefile Normal file
View file

@ -0,0 +1,22 @@
# Created by: Emanuel Haupt <ehaupt@FreeBSD.org>
PORTNAME= bkt
PORTVERSION= 0.5.2
CATEGORIES= sysutils
MAINTAINER= ehaupt@FreeBSD.org
COMMENT= Subprocess caching utility
LICENSE= MIT
LICENSE_FILE= ${WRKSRC}/LICENSE
USES= cargo
USE_GITHUB= yes
GH_ACCOUNT= dimo414
PLIST_FILES= bin/bkt
post-install:
${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/bkt
.include <bsd.port.mk>

View file

@ -0,0 +1,49 @@
CARGO_CRATES= anyhow-1.0.38 \
autocfg-1.0.1 \
bincode-1.3.1 \
bitflags-1.2.1 \
byteorder-1.4.2 \
cfg-if-1.0.0 \
clap-3.0.0 \
clap_derive-3.0.0 \
filetime-0.2.14 \
getrandom-0.1.16 \
getrandom-0.2.2 \
hashbrown-0.11.2 \
heck-0.3.3 \
humantime-2.1.0 \
indexmap-1.7.0 \
itoa-0.4.7 \
lazy_static-1.4.0 \
libc-0.2.86 \
memchr-2.4.1 \
os_str_bytes-6.0.0 \
ppv-lite86-0.2.10 \
proc-macro-error-1.0.4 \
proc-macro-error-attr-1.0.4 \
proc-macro2-1.0.36 \
quote-1.0.9 \
rand-0.7.3 \
rand-0.8.3 \
rand_chacha-0.2.2 \
rand_chacha-0.3.0 \
rand_core-0.5.1 \
rand_core-0.6.2 \
rand_hc-0.2.0 \
rand_hc-0.3.0 \
redox_syscall-0.2.5 \
ryu-1.0.5 \
serde-1.0.123 \
serde_derive-1.0.123 \
serde_json-1.0.62 \
syn-1.0.84 \
test_dir-0.1.0 \
textwrap-0.14.2 \
unicode-segmentation-1.8.0 \
unicode-xid-0.2.1 \
version_check-0.9.3 \
wasi-0.9.0+wasi-snapshot-preview1 \
wasi-0.10.2+wasi-snapshot-preview1 \
winapi-0.3.9 \
winapi-i686-pc-windows-gnu-0.4.0 \
winapi-x86_64-pc-windows-gnu-0.4.0

101
sysutils/bkt/distinfo Normal file
View file

@ -0,0 +1,101 @@
TIMESTAMP = 1644953250
SHA256 (rust/crates/anyhow-1.0.38.crate) = afddf7f520a80dbf76e6f50a35bca42a2331ef227a28b3b6dc5c2e2338d114b1
SIZE (rust/crates/anyhow-1.0.38.crate) = 30417
SHA256 (rust/crates/autocfg-1.0.1.crate) = cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a
SIZE (rust/crates/autocfg-1.0.1.crate) = 12908
SHA256 (rust/crates/bincode-1.3.1.crate) = f30d3a39baa26f9651f17b375061f3233dde33424a8b72b0dbe93a68a0bc896d
SIZE (rust/crates/bincode-1.3.1.crate) = 26121
SHA256 (rust/crates/bitflags-1.2.1.crate) = cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693
SIZE (rust/crates/bitflags-1.2.1.crate) = 16745
SHA256 (rust/crates/byteorder-1.4.2.crate) = ae44d1a3d5a19df61dd0c8beb138458ac2a53a7ac09eba97d55592540004306b
SIZE (rust/crates/byteorder-1.4.2.crate) = 22148
SHA256 (rust/crates/cfg-if-1.0.0.crate) = baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd
SIZE (rust/crates/cfg-if-1.0.0.crate) = 7934
SHA256 (rust/crates/clap-3.0.0.crate) = d17bf219fcd37199b9a29e00ba65dfb8cd5b2688b7297ec14ff829c40ac50ca9
SIZE (rust/crates/clap-3.0.0.crate) = 189026
SHA256 (rust/crates/clap_derive-3.0.0.crate) = e1b9752c030a14235a0bd5ef3ad60a1dcac8468c30921327fc8af36b20c790b9
SIZE (rust/crates/clap_derive-3.0.0.crate) = 24684
SHA256 (rust/crates/filetime-0.2.14.crate) = 1d34cfa13a63ae058bfa601fe9e313bbdb3746427c1459185464ce0fcf62e1e8
SIZE (rust/crates/filetime-0.2.14.crate) = 14358
SHA256 (rust/crates/getrandom-0.1.16.crate) = 8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce
SIZE (rust/crates/getrandom-0.1.16.crate) = 25077
SHA256 (rust/crates/getrandom-0.2.2.crate) = c9495705279e7140bf035dde1f6e750c162df8b625267cd52cc44e0b156732c8
SIZE (rust/crates/getrandom-0.2.2.crate) = 26010
SHA256 (rust/crates/hashbrown-0.11.2.crate) = ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e
SIZE (rust/crates/hashbrown-0.11.2.crate) = 85713
SHA256 (rust/crates/heck-0.3.3.crate) = 6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c
SIZE (rust/crates/heck-0.3.3.crate) = 10260
SHA256 (rust/crates/humantime-2.1.0.crate) = 9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4
SIZE (rust/crates/humantime-2.1.0.crate) = 16749
SHA256 (rust/crates/indexmap-1.7.0.crate) = bc633605454125dec4b66843673f01c7df2b89479b32e0ed634e43a91cff62a5
SIZE (rust/crates/indexmap-1.7.0.crate) = 50363
SHA256 (rust/crates/itoa-0.4.7.crate) = dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736
SIZE (rust/crates/itoa-0.4.7.crate) = 12099
SHA256 (rust/crates/lazy_static-1.4.0.crate) = e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646
SIZE (rust/crates/lazy_static-1.4.0.crate) = 10443
SHA256 (rust/crates/libc-0.2.86.crate) = b7282d924be3275cec7f6756ff4121987bc6481325397dde6ba3e7802b1a8b1c
SIZE (rust/crates/libc-0.2.86.crate) = 522986
SHA256 (rust/crates/memchr-2.4.1.crate) = 308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a
SIZE (rust/crates/memchr-2.4.1.crate) = 64977
SHA256 (rust/crates/os_str_bytes-6.0.0.crate) = 8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64
SIZE (rust/crates/os_str_bytes-6.0.0.crate) = 21046
SHA256 (rust/crates/ppv-lite86-0.2.10.crate) = ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857
SIZE (rust/crates/ppv-lite86-0.2.10.crate) = 20915
SHA256 (rust/crates/proc-macro-error-1.0.4.crate) = da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c
SIZE (rust/crates/proc-macro-error-1.0.4.crate) = 25293
SHA256 (rust/crates/proc-macro-error-attr-1.0.4.crate) = a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869
SIZE (rust/crates/proc-macro-error-attr-1.0.4.crate) = 7971
SHA256 (rust/crates/proc-macro2-1.0.36.crate) = c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029
SIZE (rust/crates/proc-macro2-1.0.36.crate) = 41411
SHA256 (rust/crates/quote-1.0.9.crate) = c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7
SIZE (rust/crates/quote-1.0.9.crate) = 25042
SHA256 (rust/crates/rand-0.7.3.crate) = 6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03
SIZE (rust/crates/rand-0.7.3.crate) = 112246
SHA256 (rust/crates/rand-0.8.3.crate) = 0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e
SIZE (rust/crates/rand-0.8.3.crate) = 84493
SHA256 (rust/crates/rand_chacha-0.2.2.crate) = f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402
SIZE (rust/crates/rand_chacha-0.2.2.crate) = 13267
SHA256 (rust/crates/rand_chacha-0.3.0.crate) = e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d
SIZE (rust/crates/rand_chacha-0.3.0.crate) = 13920
SHA256 (rust/crates/rand_core-0.5.1.crate) = 90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19
SIZE (rust/crates/rand_core-0.5.1.crate) = 21116
SHA256 (rust/crates/rand_core-0.6.2.crate) = 34cf66eb183df1c5876e2dcf6b13d57340741e8dc255b48e40a26de954d06ae7
SIZE (rust/crates/rand_core-0.6.2.crate) = 21708
SHA256 (rust/crates/rand_hc-0.2.0.crate) = ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c
SIZE (rust/crates/rand_hc-0.2.0.crate) = 11670
SHA256 (rust/crates/rand_hc-0.3.0.crate) = 3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73
SIZE (rust/crates/rand_hc-0.3.0.crate) = 11780
SHA256 (rust/crates/redox_syscall-0.2.5.crate) = 94341e4e44e24f6b591b59e47a8a027df12e008d73fd5672dbea9cc22f4507d9
SIZE (rust/crates/redox_syscall-0.2.5.crate) = 23449
SHA256 (rust/crates/ryu-1.0.5.crate) = 71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e
SIZE (rust/crates/ryu-1.0.5.crate) = 49570
SHA256 (rust/crates/serde-1.0.123.crate) = 92d5161132722baa40d802cc70b15262b98258453e85e5d1d365c757c73869ae
SIZE (rust/crates/serde-1.0.123.crate) = 74379
SHA256 (rust/crates/serde_derive-1.0.123.crate) = 9391c295d64fc0abb2c556bad848f33cb8296276b1ad2677d1ae1ace4f258f31
SIZE (rust/crates/serde_derive-1.0.123.crate) = 54122
SHA256 (rust/crates/serde_json-1.0.62.crate) = ea1c6153794552ea7cf7cf63b1231a25de00ec90db326ba6264440fa08e31486
SIZE (rust/crates/serde_json-1.0.62.crate) = 114960
SHA256 (rust/crates/syn-1.0.84.crate) = ecb2e6da8ee5eb9a61068762a32fa9619cc591ceb055b3687f4cd4051ec2e06b
SIZE (rust/crates/syn-1.0.84.crate) = 235025
SHA256 (rust/crates/test_dir-0.1.0.crate) = e571ebf9127a9da821890a9fa8a8ef777fce3e0f959ff6949cf06ca8b736381d
SIZE (rust/crates/test_dir-0.1.0.crate) = 4241
SHA256 (rust/crates/textwrap-0.14.2.crate) = 0066c8d12af8b5acd21e00547c3797fde4e8677254a7ee429176ccebbe93dd80
SIZE (rust/crates/textwrap-0.14.2.crate) = 52016
SHA256 (rust/crates/unicode-segmentation-1.8.0.crate) = 8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b
SIZE (rust/crates/unicode-segmentation-1.8.0.crate) = 94011
SHA256 (rust/crates/unicode-xid-0.2.1.crate) = f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564
SIZE (rust/crates/unicode-xid-0.2.1.crate) = 14392
SHA256 (rust/crates/version_check-0.9.3.crate) = 5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe
SIZE (rust/crates/version_check-0.9.3.crate) = 12547
SHA256 (rust/crates/wasi-0.9.0+wasi-snapshot-preview1.crate) = cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519
SIZE (rust/crates/wasi-0.9.0+wasi-snapshot-preview1.crate) = 31521
SHA256 (rust/crates/wasi-0.10.2+wasi-snapshot-preview1.crate) = fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6
SIZE (rust/crates/wasi-0.10.2+wasi-snapshot-preview1.crate) = 27505
SHA256 (rust/crates/winapi-0.3.9.crate) = 5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419
SIZE (rust/crates/winapi-0.3.9.crate) = 1200382
SHA256 (rust/crates/winapi-i686-pc-windows-gnu-0.4.0.crate) = ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6
SIZE (rust/crates/winapi-i686-pc-windows-gnu-0.4.0.crate) = 2918815
SHA256 (rust/crates/winapi-x86_64-pc-windows-gnu-0.4.0.crate) = 712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f
SIZE (rust/crates/winapi-x86_64-pc-windows-gnu-0.4.0.crate) = 2947998
SHA256 (dimo414-bkt-0.5.2_GH0.tar.gz) = e6acab9ae6a617fe471dceed9f69064e1f0cb3a8eb93d82e2087faeab4d48ee8
SIZE (dimo414-bkt-0.5.2_GH0.tar.gz) = 27405

13
sysutils/bkt/pkg-descr Normal file
View file

@ -0,0 +1,13 @@
bkt (pronounced bucket) is a subprocess caching utility written in Rust,
inspired by bash-cache.
Wrapping expensive process invocations with bkt allows callers to reuse recent
invocations without complicating their application logic. This can be useful in
shell prompts, interactive applications such as fzf, and long-running programs
that poll other processes.
When bkt is passed a command it hasn't seen before (or recently) it executes
the command synchronously and caches its stdout, stderr, and exit code.
Calling bkt again with the same command reads the data from the cache and
outputs it as if the command had been run again.
WWW: https://github.com/dimo414/bkt