From 32b530be8d99a9d08bc3d22c1e22843aa0eec2bd Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Tue, 27 Nov 2018 11:35:25 +0100 Subject: some more changes --- Cargo.lock | 30 ++++++++++++------------ Cargo.toml | 4 ++-- people/BurntSushi.toml | 2 +- people/Centril.toml | 2 +- people/GuillaumeGomez.toml | 2 +- people/Kimundi.toml | 2 +- people/Mark-Simulacrum.toml | 2 +- people/QuietMisdreavus.toml | 2 +- people/alexcrichton.toml | 2 +- people/arshiamufti.toml | 2 +- people/ashleygwilliams.toml | 2 +- people/dotdash.toml | 2 +- people/flaki.toml | 2 +- people/frewsxcv.toml | 2 +- people/huonw.toml | 2 +- people/jonathandturner.toml | 2 +- people/joshtriplett.toml | 2 +- people/jseyfried.toml | 2 +- people/manishearth.toml | 2 +- people/matthieu-m.toml | 2 +- people/michaelwoerister.toml | 2 +- people/nagisa.toml | 2 +- people/niconii.toml | 2 +- people/nikomatsakis.toml | 2 +- people/oe.toml | 2 +- people/peschkaj.toml | 2 +- people/petrochenkov.toml | 2 +- people/rpjohnst.toml | 2 +- people/shepmaster.toml | 2 +- people/solson.toml | 2 +- src/schema.rs | 55 ++++++++++++++++++++++++++++++++++++++------ src/validate.rs | 32 ++++++++++++++++++++++++++ teams/leads.toml | 11 ++------- teams/wg-embedded.toml | 1 + teams/wg-leads.toml | 9 ++------ teams/wg-net.toml | 1 + teams/wg-wasm.toml | 1 + 37 files changed, 132 insertions(+), 68 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ffffe11..f635876 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -188,21 +188,6 @@ dependencies = [ "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "mailgun-mailmap" -version = "0.1.0" -dependencies = [ - "curl 0.4.18 (registry+https://github.com/rust-lang/crates.io-index)", - "env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)", - "failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.32 (registry+https://github.com/rust-lang/crates.io-index)", - "structopt 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", - "toml 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "openssl-probe" version = "0.1.2" @@ -258,6 +243,21 @@ dependencies = [ "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rust-team" +version = "0.1.0" +dependencies = [ + "curl 0.4.18 (registry+https://github.com/rust-lang/crates.io-index)", + "env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.32 (registry+https://github.com/rust-lang/crates.io-index)", + "structopt 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", + "toml 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rustc-demangle" version = "0.1.9" diff --git a/Cargo.toml b/Cargo.toml index 83b3422..6a3c115 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] -name = "mailgun-mailmap" +name = "rust-team" version = "0.1.0" -authors = ["Alex Crichton "] +authors = ["Alex Crichton ", "Pietro Albini "] edition = '2018' [dependencies] diff --git a/people/BurntSushi.toml b/people/BurntSushi.toml index c1e7ef1..9e9c9f6 100644 --- a/people/BurntSushi.toml +++ b/people/BurntSushi.toml @@ -1,4 +1,4 @@ name = "Andrew Gallant" github = "BurntSushi" -irc-nickname = "burntsushi" +irc = "burntsushi" email = "jamslam@gmail.com" diff --git a/people/Centril.toml b/people/Centril.toml index 0c17cf6..20fb7ae 100644 --- a/people/Centril.toml +++ b/people/Centril.toml @@ -1,4 +1,4 @@ name = "Mazdak Farrokhzad" github = "Centril" -irc-nickname = "centril" +irc = "centril" email = "twingoow@gmail.com" diff --git a/people/GuillaumeGomez.toml b/people/GuillaumeGomez.toml index 2c2cc32..9e12220 100644 --- a/people/GuillaumeGomez.toml +++ b/people/GuillaumeGomez.toml @@ -1,4 +1,4 @@ name = "Guillaume Gomez" github = "GuillaumeGomez" -irc-nickname = "imperio" +irc = "imperio" email = "guillaume1.gomez@gmail.com" diff --git a/people/Kimundi.toml b/people/Kimundi.toml index 1759cc9..f8c65e5 100644 --- a/people/Kimundi.toml +++ b/people/Kimundi.toml @@ -1,4 +1,4 @@ name = "Marvin Löbel" github = "Kimundi" -irc-nickname = "kimundi" +irc = "kimundi" email = "loebel.marvin@gmail.com" diff --git a/people/Mark-Simulacrum.toml b/people/Mark-Simulacrum.toml index 0d06885..04573ae 100644 --- a/people/Mark-Simulacrum.toml +++ b/people/Mark-Simulacrum.toml @@ -1,4 +1,4 @@ name = "Mark Rousskov" github = "Mark-Simulacrum" -irc-nickname = "simulacrum" +irc = "simulacrum" email = "mark.simulacrum@gmail.com" diff --git a/people/QuietMisdreavus.toml b/people/QuietMisdreavus.toml index f2465d3..fece075 100644 --- a/people/QuietMisdreavus.toml +++ b/people/QuietMisdreavus.toml @@ -1,4 +1,4 @@ name = "QuietMisdreavus" github = "QuietMisdreavus" -irc-nickname = "misdreavus" +irc = "misdreavus" email = "grey@quietmisdreavus.net" diff --git a/people/alexcrichton.toml b/people/alexcrichton.toml index cd03b7c..a3ab0a9 100644 --- a/people/alexcrichton.toml +++ b/people/alexcrichton.toml @@ -1,4 +1,4 @@ name = "Alex Crichton" github = "alexcrichton" -irc-nickname = "acrichto" +irc = "acrichto" email = "acrichton@mozilla.com" diff --git a/people/arshiamufti.toml b/people/arshiamufti.toml index 0f745b3..cd99d32 100644 --- a/people/arshiamufti.toml +++ b/people/arshiamufti.toml @@ -1,4 +1,4 @@ name = "Arshia Mufti" github = "arshiamufti" -irc-nickname = "arshia" +irc = "arshia" email = "amufti16@gmail.com" diff --git a/people/ashleygwilliams.toml b/people/ashleygwilliams.toml index ae9bb16..9081030 100644 --- a/people/ashleygwilliams.toml +++ b/people/ashleygwilliams.toml @@ -1,4 +1,4 @@ name = "Ashley Williams" github = "ashleygwilliams" -irc-nickname = "agdubs" +irc = "agdubs" email = "ashley@integer32.com" diff --git a/people/dotdash.toml b/people/dotdash.toml index cd76d51..fb45f59 100644 --- a/people/dotdash.toml +++ b/people/dotdash.toml @@ -1,3 +1,3 @@ name = "Björn Steinbrink" github = "dotdash" -irc-nickname = "doener" +irc = "doener" diff --git a/people/flaki.toml b/people/flaki.toml index 7e93ecb..10ddcbe 100644 --- a/people/flaki.toml +++ b/people/flaki.toml @@ -1,4 +1,4 @@ name = "István Szmozsánszky" github = "flaki" -irc-nickname = "flaki" +irc = "flaki" email = "rust@flaki.hu" diff --git a/people/frewsxcv.toml b/people/frewsxcv.toml index d34707f..575a62a 100644 --- a/people/frewsxcv.toml +++ b/people/frewsxcv.toml @@ -1,4 +1,4 @@ name = "Corey Farwell" github = "frewsxcv" -irc-nickname = "frewsxcv" +irc = "frewsxcv" email = "coreyf@rwell.org" diff --git a/people/huonw.toml b/people/huonw.toml index f434b3d..4bfdd8e 100644 --- a/people/huonw.toml +++ b/people/huonw.toml @@ -1,3 +1,3 @@ name = "Huon Wilson" github = "huonw" -irc-nickname = "huon" +irc = "huon" diff --git a/people/jonathandturner.toml b/people/jonathandturner.toml index 8accd37..609ba6a 100644 --- a/people/jonathandturner.toml +++ b/people/jonathandturner.toml @@ -1,4 +1,4 @@ name = "Jonathan Turner" github = "jonathandturner" -irc-nickname = "jntrnr" +irc = "jntrnr" email = "jonathan.d.turner@gmail.com" diff --git a/people/joshtriplett.toml b/people/joshtriplett.toml index afa7013..b922ab8 100644 --- a/people/joshtriplett.toml +++ b/people/joshtriplett.toml @@ -1,4 +1,4 @@ name = "Josh Triplett" github = "joshtriplett" -irc-nickname = "JoshTriplett" +irc = "JoshTriplett" email = "josh@joshtriplett.org" diff --git a/people/jseyfried.toml b/people/jseyfried.toml index f6a4637..acf71af 100644 --- a/people/jseyfried.toml +++ b/people/jseyfried.toml @@ -1,4 +1,4 @@ name = "Jeffrey Seyfried" github = "jseyfried" -irc-nickname = "jseyfried" +irc = "jseyfried" email = "jeffrey.seyfried@gmail.com" diff --git a/people/manishearth.toml b/people/manishearth.toml index ed0e133..5255b96 100644 --- a/people/manishearth.toml +++ b/people/manishearth.toml @@ -1,4 +1,4 @@ name = "Manish Goregaokar" github = "manishearth" -irc-nickname = "Manishearth" +irc = "Manishearth" email = "manishsmail@gmail.com" diff --git a/people/matthieu-m.toml b/people/matthieu-m.toml index 8f3f6c1..4a50d0b 100644 --- a/people/matthieu-m.toml +++ b/people/matthieu-m.toml @@ -1,4 +1,4 @@ name = "Matthieu M." github = "matthieu-m" -irc-nickname = "matthieum" +irc = "matthieum" email = "matthieu.monrocq@gmail.com" diff --git a/people/michaelwoerister.toml b/people/michaelwoerister.toml index b3b88fa..b3ba208 100644 --- a/people/michaelwoerister.toml +++ b/people/michaelwoerister.toml @@ -1,4 +1,4 @@ name = "Michael Woerister" github = "michaelwoerister" -irc-nickname = "mw" +irc = "mw" email = "michaelwoerister@gmail.com" diff --git a/people/nagisa.toml b/people/nagisa.toml index 69cbcc1..c58b316 100644 --- a/people/nagisa.toml +++ b/people/nagisa.toml @@ -1,4 +1,4 @@ name = "Simonas Kazlauskas" github = "nagisa" -irc-nickname = "nagisa" +irc = "nagisa" email = "simonas+t-compiler@kazlauskas.me" diff --git a/people/niconii.toml b/people/niconii.toml index 0a1a856..0cbf557 100644 --- a/people/niconii.toml +++ b/people/niconii.toml @@ -1,3 +1,3 @@ name = "Nicolette Verlinden" github = "niconii" -irc-nickname = "niconii" +irc = "niconii" diff --git a/people/nikomatsakis.toml b/people/nikomatsakis.toml index 05d8466..bbb1e9d 100644 --- a/people/nikomatsakis.toml +++ b/people/nikomatsakis.toml @@ -1,4 +1,4 @@ name = "Niko Matsakis" github = "nikomatsakis" -irc-nickname = "nmatsakis" +irc = "nmatsakis" email = "nmatsakis@mozilla.com" diff --git a/people/oe.toml b/people/oe.toml index f325302..bd5c290 100644 --- a/people/oe.toml +++ b/people/oe.toml @@ -1,4 +1,4 @@ name = "Olivia Hugger" github = "oe" -irc-nickname = "liv" +irc = "liv" email = "olivia@fastmail.com" diff --git a/people/peschkaj.toml b/people/peschkaj.toml index eb2ff95..09b5faf 100644 --- a/people/peschkaj.toml +++ b/people/peschkaj.toml @@ -1,3 +1,3 @@ name = "Jeremiah Peschka" github = "peschkaj" -irc-nickname = "peschkaj" +irc = "peschkaj" diff --git a/people/petrochenkov.toml b/people/petrochenkov.toml index 3c89ce9..1e46855 100644 --- a/people/petrochenkov.toml +++ b/people/petrochenkov.toml @@ -1,4 +1,4 @@ name = "Vadim Petrochenkov" github = "petrochenkov" -irc-nickname = "petrochenkov" +irc = "petrochenkov" email = "vadim.petrochenkov@gmail.com" diff --git a/people/rpjohnst.toml b/people/rpjohnst.toml index 8487ea4..2495ac2 100644 --- a/people/rpjohnst.toml +++ b/people/rpjohnst.toml @@ -1,4 +1,4 @@ name = "Russell Johnston" github = "rpjohnst" -irc-nickname = "Rusky" +irc = "Rusky" email = "rpjohnst@gmail.com" diff --git a/people/shepmaster.toml b/people/shepmaster.toml index b5e5c84..9e154bd 100644 --- a/people/shepmaster.toml +++ b/people/shepmaster.toml @@ -1,4 +1,4 @@ name = "Jake Goulding" github = "shepmaster" -irc-nickname = "shep" +irc = "shep" email = "jake.goulding@gmail.com" diff --git a/people/solson.toml b/people/solson.toml index 4baf818..eb7cdf0 100644 --- a/people/solson.toml +++ b/people/solson.toml @@ -1,4 +1,4 @@ name = "Scott Olson" github = "solson" -irc-nickname = "scott" +irc = "scott" email = "scott@solson.me" diff --git a/src/schema.rs b/src/schema.rs index 5e08a26..ac5b243 100644 --- a/src/schema.rs +++ b/src/schema.rs @@ -3,6 +3,7 @@ use failure::{err_msg, Error}; use std::collections::HashSet; #[derive(serde_derive::Deserialize, Debug)] +#[serde(deny_unknown_fields)] pub(crate) struct Person { name: String, github: String, @@ -35,11 +36,15 @@ impl Person { } #[derive(serde_derive::Deserialize, Debug)] +#[serde(deny_unknown_fields)] pub(crate) struct Team { name: String, + #[serde(default = "default_false")] + wg: bool, #[serde(default)] children: Vec, people: TeamPeople, + website: Option, #[serde(default)] lists: Vec, } @@ -49,6 +54,10 @@ impl Team { &self.name } + pub(crate) fn is_wg(&self) -> bool { + self.wg + } + pub(crate) fn leads(&self) -> HashSet<&str> { self.people.leads.iter().map(|s| s.as_str()).collect() } @@ -63,9 +72,24 @@ impl Team { members.insert(person); } } + if self.people.include_team_leads || self.people.include_wg_leads { + for team in data.teams() { + let include_wg = team.is_wg() && self.people.include_wg_leads; + let include_team = !team.is_wg() && self.people.include_team_leads; + if include_wg || include_team { + for lead in team.leads() { + members.insert(lead); + } + } + } + } Ok(members) } + pub(crate) fn raw_lists(&self) -> &[TeamList] { + &self.lists + } + pub(crate) fn lists(&self, data: &Data) -> Result, Error> { let mut lists = Vec::new(); for raw_list in &self.lists { @@ -110,24 +134,37 @@ impl Team { } #[derive(serde_derive::Deserialize, Debug)] +#[serde(rename_all = "kebab-case", deny_unknown_fields)] struct TeamPeople { leads: Vec, members: Vec, + #[serde(default = "default_false")] + include_team_leads: bool, + #[serde(default = "default_false")] + include_wg_leads: bool, } #[derive(serde_derive::Deserialize, Debug)] -#[serde(rename_all = "kebab-case")] +#[serde(deny_unknown_fields)] +pub(crate) struct WebsiteData { + name: String, + description: String, + email: Option, +} + +#[derive(serde_derive::Deserialize, Debug)] +#[serde(rename_all = "kebab-case", deny_unknown_fields)] pub(crate) struct TeamList { - address: String, - access_level: ListAccessLevel, + pub(crate) address: String, + pub(crate) access_level: ListAccessLevel, #[serde(default = "default_true")] - include_team_members: bool, + pub(crate) include_team_members: bool, #[serde(default)] - extra_people: Vec, + pub(crate) extra_people: Vec, #[serde(default)] - extra_emails: Vec, + pub(crate) extra_emails: Vec, #[serde(default)] - extra_teams: Vec, + pub(crate) extra_teams: Vec, } #[derive(serde_derive::Deserialize, Debug, Copy, Clone)] @@ -159,3 +196,7 @@ impl List { fn default_true() -> bool { true } + +fn default_false() -> bool { + false +} diff --git a/src/validate.rs b/src/validate.rs index 250f172..b96c477 100644 --- a/src/validate.rs +++ b/src/validate.rs @@ -9,6 +9,8 @@ pub(crate) fn validate(data: &Data) -> Result<(), Error> { validate_team_members(data, &mut errors); validate_inactive_members(data, &mut errors); validate_list_email_addresses(data, &mut errors); + validate_list_extra_people(data, &mut errors); + validate_list_extra_teams(data, &mut errors); if !errors.is_empty() { for err in &errors { @@ -82,6 +84,36 @@ fn validate_list_email_addresses(data: &Data, errors: &mut Vec) { }); } +/// Ensure members of extra-people in a list are real people +fn validate_list_extra_people(data: &Data, errors: &mut Vec) { + wrapper(data.teams(), errors, |team, errors| { + wrapper(team.raw_lists().iter(), errors, |list, _| { + for person in &list.extra_people { + if data.person(person).is_none() { + bail!("person `{}` does not exist (in list `{}`)", person, list.address); + } + } + Ok(()) + }); + Ok(()) + }); +} + +/// Ensure members of extra-people in a list are real people +fn validate_list_extra_teams(data: &Data, errors: &mut Vec) { + wrapper(data.teams(), errors, |team, errors| { + wrapper(team.raw_lists().iter(), errors, |list, _| { + for list_team in &list.extra_teams { + if data.team(list_team).is_none() { + bail!("team `{}` does not exist (in list `{}`)", list_team, list.address); + } + } + Ok(()) + }); + Ok(()) + }); +} + fn wrapper(iter: I, errors: &mut Vec, mut func: F) where I: Iterator, diff --git a/teams/leads.toml b/teams/leads.toml index 27def3e..65dd947 100644 --- a/teams/leads.toml +++ b/teams/leads.toml @@ -2,15 +2,8 @@ name = "leads" [people] leads = [] -members = [ - "aturon", - "ashleygwilliams", - "nikomatsakis", - "nrc", - "aidanhs", - "Mark-Simulacrum", - "steveklabnik", -] +members = [] +include-team-leads = true [[lists]] address = "leads@rust-lang.org" diff --git a/teams/wg-embedded.toml b/teams/wg-embedded.toml index 76e2942..ee430bd 100644 --- a/teams/wg-embedded.toml +++ b/teams/wg-embedded.toml @@ -1,4 +1,5 @@ name = "wg-embedded" +wg = true [people] leads = ["japaric"] diff --git a/teams/wg-leads.toml b/teams/wg-leads.toml index 022199c..c3e8999 100644 --- a/teams/wg-leads.toml +++ b/teams/wg-leads.toml @@ -2,10 +2,5 @@ name = "wg-leads" [people] leads = [] -members = [ - "cramertj", - "withoutboats", - "killercup", - "fitzgen", - "japaric", -] +members = [] +include-wg-leads = true diff --git a/teams/wg-net.toml b/teams/wg-net.toml index f95494c..9a06ffd 100644 --- a/teams/wg-net.toml +++ b/teams/wg-net.toml @@ -1,4 +1,5 @@ name = "wg-net" +wg = true [people] leads = ["withoutboats", "cramertj"] diff --git a/teams/wg-wasm.toml b/teams/wg-wasm.toml index 8788bbb..2a36f16 100644 --- a/teams/wg-wasm.toml +++ b/teams/wg-wasm.toml @@ -1,4 +1,5 @@ name = "wg-wasm" +wg = true [people] leads = ["fitzgen"] -- cgit v1.2.3