feat(3p/rust-crates): DRY by inferring crateName

Change-Id: I5872d9189ef56d9a40f7183633056745b98dc2ea
Reviewed-on: https://cl.tvl.fyi/c/depot/+/4556
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
This commit is contained in:
zseri 2021-12-24 12:45:06 +01:00
parent e9f431aca4
commit f8f5804c50

View file

@ -6,9 +6,12 @@
let let
buildRustCrate = attrs@{ buildRustCrate = attrs@{
edition ? "2018", edition ? "2018",
pname,
crateName ? pname,
... ...
}: pkgs.buildRustCrate (attrs // { }: pkgs.buildRustCrate (attrs // {
inherit inherit
crateName
edition edition
; ;
}); });
@ -20,21 +23,18 @@ with depot.third_party.rust-crates;
{ {
cfg-if = buildRustCrate { cfg-if = buildRustCrate {
pname = "cfg-if"; pname = "cfg-if";
crateName = "cfg-if";
version = "1.0.0"; version = "1.0.0";
sha256 = "1fzidq152hnxhg4lj6r2gv4jpnn8yivp27z6q6xy7w6v0dp6bai9"; sha256 = "1fzidq152hnxhg4lj6r2gv4jpnn8yivp27z6q6xy7w6v0dp6bai9";
}; };
cc = buildRustCrate { cc = buildRustCrate {
pname = "cc"; pname = "cc";
crateName = "cc";
version = "1.0.66"; version = "1.0.66";
sha256 = "12q71z6ck8wlqrwgi25x3lrryyks9djymswn9b1c6qq0i01jpc1p"; sha256 = "12q71z6ck8wlqrwgi25x3lrryyks9djymswn9b1c6qq0i01jpc1p";
}; };
ascii = buildRustCrate { ascii = buildRustCrate {
pname = "ascii"; pname = "ascii";
crateName = "ascii";
version = "1.0.0"; version = "1.0.0";
edition = "2015"; edition = "2015";
sha256 = "0gam8xsn981wfa40srsniivffjsfz1pg0xnigmczk9k7azb1ks1m"; sha256 = "0gam8xsn981wfa40srsniivffjsfz1pg0xnigmczk9k7azb1ks1m";
@ -42,7 +42,6 @@ with depot.third_party.rust-crates;
regex-syntax = buildRustCrate { regex-syntax = buildRustCrate {
pname = "regex-syntax"; pname = "regex-syntax";
crateName = "regex-syntax";
version = "0.6.22"; version = "0.6.22";
edition = "2015"; edition = "2015";
sha256 = "0r00n2dgyixacl1sczqp18gxf0xh7x272hcdp62412lypba2gqyg"; sha256 = "0r00n2dgyixacl1sczqp18gxf0xh7x272hcdp62412lypba2gqyg";
@ -50,7 +49,6 @@ with depot.third_party.rust-crates;
regex = buildRustCrate { regex = buildRustCrate {
pname = "regex"; pname = "regex";
crateName = "regex";
version = "1.4.3"; version = "1.4.3";
features = [ "std" ]; features = [ "std" ];
dependencies = [ regex-syntax ]; dependencies = [ regex-syntax ];
@ -60,7 +58,6 @@ with depot.third_party.rust-crates;
libloading = buildRustCrate { libloading = buildRustCrate {
pname = "libloading"; pname = "libloading";
crateName = "libloading";
version = "0.6.7"; version = "0.6.7";
dependencies = [ cfg-if ]; dependencies = [ cfg-if ];
edition = "2015"; edition = "2015";
@ -68,8 +65,7 @@ with depot.third_party.rust-crates;
}; };
tree-sitter = buildRustCrate { tree-sitter = buildRustCrate {
pname = "tree_sitter"; pname = "tree-sitter";
crateName = "tree-sitter";
# buildRustCrate isnt really smart enough to detect the subdir # buildRustCrate isnt really smart enough to detect the subdir
libPath = "binding_rust/lib.rs"; libPath = "binding_rust/lib.rs";
# and the build.rs is also not where buildRustCrate would find it # and the build.rs is also not where buildRustCrate would find it
@ -82,7 +78,6 @@ with depot.third_party.rust-crates;
libc = buildRustCrate { libc = buildRustCrate {
pname = "libc"; pname = "libc";
crateName = "libc";
version = "0.2.82"; version = "0.2.82";
edition = "2015"; edition = "2015";
sha256 = "02zgn6c0xwh331hky417lbr29kmvrw3ylxs8822syyhjfjqszvsx"; sha256 = "02zgn6c0xwh331hky417lbr29kmvrw3ylxs8822syyhjfjqszvsx";
@ -90,14 +85,12 @@ with depot.third_party.rust-crates;
bitflags = buildRustCrate { bitflags = buildRustCrate {
pname = "bitflags"; pname = "bitflags";
crateName = "bitflags";
version = "1.2.1"; version = "1.2.1";
sha256 = "0b77awhpn7yaqjjibm69ginfn996azx5vkzfjj39g3wbsqs7mkxg"; sha256 = "0b77awhpn7yaqjjibm69ginfn996azx5vkzfjj39g3wbsqs7mkxg";
}; };
inotify-sys = buildRustCrate { inotify-sys = buildRustCrate {
pname = "inotify-sys"; pname = "inotify-sys";
crateName = "inotify-sys";
version = "0.1.5"; version = "0.1.5";
dependencies = [ libc ]; dependencies = [ libc ];
sha256 = "1yiy577xxhi0j90nbg9nkd8cqwc1xix62rz55jjngvxa5jl5613v"; sha256 = "1yiy577xxhi0j90nbg9nkd8cqwc1xix62rz55jjngvxa5jl5613v";
@ -105,7 +98,6 @@ with depot.third_party.rust-crates;
inotify = buildRustCrate { inotify = buildRustCrate {
pname = "inotify"; pname = "inotify";
crateName = "inotify";
version = "0.9.2"; version = "0.9.2";
dependencies = [ bitflags libc inotify-sys ]; dependencies = [ bitflags libc inotify-sys ];
sha256 = "0fcknyvknglwwk1pdzdlb4m0ry2dym1yx8r5prf2v00pxnjk0hv2"; sha256 = "0fcknyvknglwwk1pdzdlb4m0ry2dym1yx8r5prf2v00pxnjk0hv2";
@ -114,7 +106,6 @@ with depot.third_party.rust-crates;
httparse = buildRustCrate { httparse = buildRustCrate {
pname = "httparse"; pname = "httparse";
version = "1.3.4"; version = "1.3.4";
crateName = "httparse";
edition = "2015"; edition = "2015";
sha256 = "0dggj4s0cq69bn63q9nqzzay5acmwl33nrbhjjsh5xys8sk2x4jw"; sha256 = "0dggj4s0cq69bn63q9nqzzay5acmwl33nrbhjjsh5xys8sk2x4jw";
}; };
@ -122,7 +113,6 @@ with depot.third_party.rust-crates;
version-check = buildRustCrate { version-check = buildRustCrate {
pname = "version-check"; pname = "version-check";
version = "0.9.2"; version = "0.9.2";
crateName = "version-check";
edition = "2015"; edition = "2015";
sha256 = "1vwvc1mzwv8ana9jv8z933p2xzgj1533qwwl5zr8mi89azyhq21v"; sha256 = "1vwvc1mzwv8ana9jv8z933p2xzgj1533qwwl5zr8mi89azyhq21v";
}; };
@ -130,14 +120,12 @@ with depot.third_party.rust-crates;
memchr = buildRustCrate { memchr = buildRustCrate {
pname = "memchr"; pname = "memchr";
version = "2.3.3"; version = "2.3.3";
crateName = "memchr";
edition = "2015"; edition = "2015";
sha256 = "1ivxvlswglk6wd46gadkbbsknr94gwryk6y21v64ja7x4icrpihw"; sha256 = "1ivxvlswglk6wd46gadkbbsknr94gwryk6y21v64ja7x4icrpihw";
}; };
nom = buildRustCrate { nom = buildRustCrate {
pname = "nom"; pname = "nom";
version = "5.1.1"; version = "5.1.1";
crateName = "nom";
sha256 = "1gb4r6mjwd645jqh02nhn60i7qkw8cgy3xq1r4clnmvz3cmkv1l0"; sha256 = "1gb4r6mjwd645jqh02nhn60i7qkw8cgy3xq1r4clnmvz3cmkv1l0";
dependencies = [ memchr ]; dependencies = [ memchr ];
buildDependencies = [ version-check ]; buildDependencies = [ version-check ];
@ -147,7 +135,6 @@ with depot.third_party.rust-crates;
base64 = buildRustCrate { base64 = buildRustCrate {
pname = "base64"; pname = "base64";
version = "0.13.0"; version = "0.13.0";
crateName = "base64";
sha256 = "0i0jk5sgq37kc4c90d1g7dp7zvphbg0dbqc1ajnn0vffjxblgamg"; sha256 = "0i0jk5sgq37kc4c90d1g7dp7zvphbg0dbqc1ajnn0vffjxblgamg";
features = [ "alloc" "std" ]; features = [ "alloc" "std" ];
}; };
@ -155,14 +142,12 @@ with depot.third_party.rust-crates;
bufstream = buildRustCrate { bufstream = buildRustCrate {
pname = "bufstream"; pname = "bufstream";
version = "0.1.4"; version = "0.1.4";
crateName = "bufstream";
sha256 = "10rqm7jly5jjx7wcc19q6q4m2zsrw3l2v3m1054wnbwvdh42xxf1"; sha256 = "10rqm7jly5jjx7wcc19q6q4m2zsrw3l2v3m1054wnbwvdh42xxf1";
}; };
autocfg = buildRustCrate { autocfg = buildRustCrate {
pname = "autocfg"; pname = "autocfg";
version = "1.0.1"; version = "1.0.1";
crateName = "autocfg";
edition = "2015"; edition = "2015";
sha256 = "1lsjz23jdcchcqbsmlzd4iksg3hc8bdvy677jy0938i2gp24frw1"; sha256 = "1lsjz23jdcchcqbsmlzd4iksg3hc8bdvy677jy0938i2gp24frw1";
}; };
@ -170,7 +155,6 @@ with depot.third_party.rust-crates;
num-traits = buildRustCrate { num-traits = buildRustCrate {
pname = "num-traits"; pname = "num-traits";
version = "0.2.14"; version = "0.2.14";
crateName = "num-traits";
edition = "2015"; edition = "2015";
buildDependencies = [ autocfg ]; buildDependencies = [ autocfg ];
sha256 = "09ac9dcp6cr57vjzyiy213y7312jqcy84mkamp99zr40qd1gwnyk"; sha256 = "09ac9dcp6cr57vjzyiy213y7312jqcy84mkamp99zr40qd1gwnyk";
@ -179,7 +163,6 @@ with depot.third_party.rust-crates;
num-integer = buildRustCrate { num-integer = buildRustCrate {
pname = "num-integer"; pname = "num-integer";
version = "0.1.44"; version = "0.1.44";
crateName = "num-integer";
edition = "2015"; edition = "2015";
dependencies = [ num-traits ]; dependencies = [ num-traits ];
buildDependencies = [ autocfg ]; buildDependencies = [ autocfg ];
@ -189,7 +172,6 @@ with depot.third_party.rust-crates;
chrono = buildRustCrate { chrono = buildRustCrate {
pname = "chrono"; pname = "chrono";
version = "0.4.19"; version = "0.4.19";
crateName = "chrono";
edition = "2015"; edition = "2015";
dependencies = [ num-traits num-integer ]; dependencies = [ num-traits num-integer ];
features = [ "alloc" "std" ]; features = [ "alloc" "std" ];
@ -199,7 +181,6 @@ with depot.third_party.rust-crates;
imap-proto = buildRustCrate { imap-proto = buildRustCrate {
pname = "imap-proto"; pname = "imap-proto";
version = "0.10.2"; version = "0.10.2";
crateName = "imap-proto";
dependencies = [ nom ]; dependencies = [ nom ];
sha256 = "1bf5r4d0z7c8wxrvr7kjy26500wr7cd4sxz49ix3b3yzc6ayyqv1"; sha256 = "1bf5r4d0z7c8wxrvr7kjy26500wr7cd4sxz49ix3b3yzc6ayyqv1";
}; };
@ -207,14 +188,12 @@ with depot.third_party.rust-crates;
lazy_static = buildRustCrate { lazy_static = buildRustCrate {
pname = "lazy_static"; pname = "lazy_static";
version = "1.4.0"; version = "1.4.0";
crateName = "lazy_static";
sha256 = "13h6sdghdcy7vcqsm2gasfw3qg7ssa0fl3sw7lq6pdkbk52wbyfr"; sha256 = "13h6sdghdcy7vcqsm2gasfw3qg7ssa0fl3sw7lq6pdkbk52wbyfr";
}; };
imap = buildRustCrate { imap = buildRustCrate {
pname = "imap"; pname = "imap";
version = "2.4.0"; version = "2.4.0";
crateName = "imap";
dependencies = [ dependencies = [
base64 base64
bufstream bufstream
@ -230,14 +209,12 @@ with depot.third_party.rust-crates;
epoll = buildRustCrate { epoll = buildRustCrate {
pname = "epoll"; pname = "epoll";
version = "4.3.1"; version = "4.3.1";
crateName = "epoll";
dependencies = [ bitflags libc ]; dependencies = [ bitflags libc ];
sha256 = "0dgmgdmrfbjkpxn1w3xmmwsm2a623a9qdwn90s8yl78n4a36kbh9"; sha256 = "0dgmgdmrfbjkpxn1w3xmmwsm2a623a9qdwn90s8yl78n4a36kbh9";
}; };
serde = buildRustCrate { serde = buildRustCrate {
pname = "serde"; pname = "serde";
crateName = "serde";
version = "1.0.123"; version = "1.0.123";
edition = "2015"; edition = "2015";
sha256 = "05xl2s1vpf3p7fi2yc9qlzw88d5ap0z3qmhmd7axa6pp9pn1s5xc"; sha256 = "05xl2s1vpf3p7fi2yc9qlzw88d5ap0z3qmhmd7axa6pp9pn1s5xc";
@ -247,21 +224,18 @@ with depot.third_party.rust-crates;
ryu = buildRustCrate { ryu = buildRustCrate {
pname = "ryu"; pname = "ryu";
version = "1.0.5"; version = "1.0.5";
crateName = "ryu";
sha256 = "060y2ln1csix593ingwxr2y3wl236ls0ly1ffkv39h5im7xydhrc"; sha256 = "060y2ln1csix593ingwxr2y3wl236ls0ly1ffkv39h5im7xydhrc";
}; };
itoa = buildRustCrate { itoa = buildRustCrate {
pname = "itoa"; pname = "itoa";
version = "0.4.7"; version = "0.4.7";
crateName = "itoa";
sha256 = "0079jlkcmcaw37wljrvb6r3dqq15nfahkqnl5npvlpdvkg31k11x"; sha256 = "0079jlkcmcaw37wljrvb6r3dqq15nfahkqnl5npvlpdvkg31k11x";
}; };
serde_json = buildRustCrate { serde_json = buildRustCrate {
pname = "serde_json"; pname = "serde_json";
version = "1.0.62"; version = "1.0.62";
crateName = "serde_json";
sha256 = "0sgc8dycigq0nxr4j613m4q733alfb2i10s6nz80lsbbqgrka21q"; sha256 = "0sgc8dycigq0nxr4j613m4q733alfb2i10s6nz80lsbbqgrka21q";
dependencies = [ serde ryu itoa ]; dependencies = [ serde ryu itoa ];
features = [ "std" ]; features = [ "std" ];
@ -270,7 +244,6 @@ with depot.third_party.rust-crates;
log = buildRustCrate { log = buildRustCrate {
pname = "log"; pname = "log";
version = "0.4.11"; version = "0.4.11";
crateName = "log";
sha256 = "0m6xhqxsps5mgd7r91g5mqkndbh8zbjd58p7w75r330zl4n40l07"; sha256 = "0m6xhqxsps5mgd7r91g5mqkndbh8zbjd58p7w75r330zl4n40l07";
dependencies = [ cfg-if ]; dependencies = [ cfg-if ];
}; };
@ -278,7 +251,6 @@ with depot.third_party.rust-crates;
mustache = buildRustCrate { mustache = buildRustCrate {
pname = "mustache"; pname = "mustache";
version = "0.9.0"; version = "0.9.0";
crateName = "mustache";
edition = "2015"; edition = "2015";
sha256 = "1zgl8l15i19lzp90icgwyi6zqdd31b9vm8w129f41d1zd0hs7ayq"; sha256 = "1zgl8l15i19lzp90icgwyi6zqdd31b9vm8w129f41d1zd0hs7ayq";
dependencies = [ log serde ]; dependencies = [ log serde ];
@ -287,16 +259,13 @@ with depot.third_party.rust-crates;
semver-parser = buildRustCrate { semver-parser = buildRustCrate {
pname = "semver-parser"; pname = "semver-parser";
version = "0.7.0"; version = "0.7.0";
crateName = "semver-parser";
edition = "2015"; edition = "2015";
sha256 = "1da66c8413yakx0y15k8c055yna5lyb6fr0fw9318kdwkrk5k12h"; sha256 = "1da66c8413yakx0y15k8c055yna5lyb6fr0fw9318kdwkrk5k12h";
dependencies = [ ];
}; };
semver = buildRustCrate { semver = buildRustCrate {
pname = "semver"; pname = "semver";
version = "0.10.0"; version = "0.10.0";
crateName = "semver";
edition = "2015"; edition = "2015";
sha256 = "0pbkdwlpq4d0hgdrymm2rcw31plni2siwd882gbcbscjvyvrrrqa"; sha256 = "0pbkdwlpq4d0hgdrymm2rcw31plni2siwd882gbcbscjvyvrrrqa";
dependencies = [ semver-parser ]; dependencies = [ semver-parser ];
@ -305,7 +274,6 @@ with depot.third_party.rust-crates;
toml = buildRustCrate { toml = buildRustCrate {
pname = "toml"; pname = "toml";
version = "0.5.8"; version = "0.5.8";
crateName = "toml";
sha256 = "1vwjwmwsy83pbgvvm11a6grbhb09zkcrv9v95wfwv48wjm01wdj4"; sha256 = "1vwjwmwsy83pbgvvm11a6grbhb09zkcrv9v95wfwv48wjm01wdj4";
edition = "2018"; edition = "2018";
dependencies = [ serde ]; dependencies = [ serde ];