Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add system packages to TOOLS.md #527

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions TOOLS.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,15 @@ If a tool not included in the list below is specified, this action uses [cargo-b
| [**cargo-valgrind**](https://github.com/jfrimmel/cargo-valgrind) | `$CARGO_HOME/bin` | [GitHub Releases](https://github.com/jfrimmel/cargo-valgrind/releases) | Linux, macOS, Windows | [MIT](https://github.com/jfrimmel/cargo-valgrind/blob/master/LICENSE-MIT) OR [Apache-2.0](https://github.com/jfrimmel/cargo-valgrind/blob/master/LICENSE-APACHE) |
| [**cargo-zigbuild**](https://github.com/rust-cross/cargo-zigbuild) | `$CARGO_HOME/bin` | [GitHub Releases](https://github.com/rust-cross/cargo-zigbuild/releases) | Linux, macOS, Windows | [MIT](https://github.com/rust-cross/cargo-zigbuild/blob/main/LICENSE) |
| [**cross**](https://github.com/cross-rs/cross) | `$CARGO_HOME/bin` | [GitHub Releases](https://github.com/cross-rs/cross/releases) | Linux, macOS, Windows | [MIT](https://github.com/cross-rs/cross/blob/main/LICENSE-MIT) OR [Apache-2.0](https://github.com/cross-rs/cross/blob/main/LICENSE-APACHE) |
| [**curl**](https://github.com/curl/curl) | `/usr/bin` | [distro package](https://repology.org/project/curl/versions) | Linux | [curl](https://github.com/curl/curl/blob/master/COPYING) |
| [**dprint**](https://github.com/dprint/dprint) | `$CARGO_HOME/bin` | [GitHub Releases](https://github.com/dprint/dprint/releases) | Linux, macOS, Windows | [MIT](https://github.com/dprint/dprint/blob/main/LICENSE) |
| [**editorconfig-checker**](https://github.com/editorconfig-checker/editorconfig-checker) | `/usr/local/bin` | [GitHub Releases](https://github.com/editorconfig-checker/editorconfig-checker/releases) | Linux, macOS, Windows | [MIT](https://github.com/editorconfig-checker/editorconfig-checker/blob/main/LICENSE) |
| [**espup**](https://github.com/esp-rs/espup) | `$CARGO_HOME/bin` | [GitHub Releases](https://github.com/esp-rs/espup/releases) | Linux, macOS, Windows | [MIT](https://github.com/esp-rs/espup/blob/main/LICENSE-MIT) OR [Apache-2.0](https://github.com/esp-rs/espup/blob/main/LICENSE-APACHE) |
| [**git-cliff**](https://github.com/orhun/git-cliff) | `$CARGO_HOME/bin` | [GitHub Releases](https://github.com/orhun/git-cliff/releases) | Linux, macOS, Windows | [MIT](https://github.com/orhun/git-cliff/blob/main/LICENSE-MIT) OR [Apache-2.0](https://github.com/orhun/git-cliff/blob/main/LICENSE-APACHE) |
| [**grcov**](https://github.com/mozilla/grcov) | `$CARGO_HOME/bin` | [GitHub Releases](https://github.com/mozilla/grcov/releases) | Linux, macOS, Windows | [MPL-2.0](https://github.com/mozilla/grcov/blob/HEAD/LICENSE-MPL-2.0) |
| [**hyperfine**](https://github.com/sharkdp/hyperfine) | `$CARGO_HOME/bin` | [GitHub Releases](https://github.com/sharkdp/hyperfine/releases) | Linux, macOS, Windows | [MIT](https://github.com/sharkdp/hyperfine/blob/master/LICENSE-MIT) OR [Apache-2.0](https://github.com/sharkdp/hyperfine/blob/master/LICENSE-APACHE) |
| [**jaq**](https://github.com/01mf02/jaq) | `$CARGO_HOME/bin` | [GitHub Releases](https://github.com/01mf02/jaq/releases) | Linux, macOS, Windows | [MIT](https://github.com/01mf02/jaq/blob/main/LICENSE-MIT) |
| [**jq**](https://github.com/jqlang/jq) | `/usr/bin` | [distro package](https://repology.org/project/jq/versions) | Linux, Windows | [MIT AND ICU AND CC-BY-3.0](https://github.com/jqlang/jq/blob/master/jq.spec#L9) |
| [**just**](https://github.com/casey/just) | `$CARGO_HOME/bin` | [GitHub Releases](https://github.com/casey/just/releases) | Linux, macOS, Windows | [CC0-1.0](https://github.com/casey/just/blob/master/LICENSE) |
| [**mdbook**](https://github.com/rust-lang/mdBook) | `$CARGO_HOME/bin` | [GitHub Releases](https://github.com/rust-lang/mdBook/releases) | Linux, macOS, Windows | [MPL-2.0](https://github.com/rust-lang/mdBook/blob/master/LICENSE) |
| [**mdbook-linkcheck**](https://github.com/Michael-F-Bryan/mdbook-linkcheck) | `$CARGO_HOME/bin` | [GitHub Releases](https://github.com/Michael-F-Bryan/mdbook-linkcheck/releases) | Linux, macOS, Windows | [MIT](https://github.com/Michael-F-Bryan/mdbook-linkcheck/blob/master/LICENSE) |
Expand All @@ -52,6 +54,7 @@ If a tool not included in the list below is specified, this action uses [cargo-b
| [**shellcheck**](https://www.shellcheck.net) | `/usr/local/bin` | [GitHub Releases](https://github.com/koalaman/shellcheck/releases) | Linux, macOS, Windows | [GPL-3.0](https://github.com/koalaman/shellcheck/blob/master/LICENSE) |
| [**shfmt**](https://github.com/mvdan/sh) | `/usr/local/bin` | [GitHub Releases](https://github.com/mvdan/sh/releases) | Linux, macOS, Windows | [BSD-3-Clause](https://github.com/mvdan/sh/blob/master/LICENSE) |
| [**syft**](https://github.com/anchore/syft) | `/usr/local/bin` | [GitHub Releases](https://github.com/anchore/syft/releases) | Linux, macOS, Windows | [Apache-2.0](https://github.com/anchore/syft/blob/main/LICENSE) |
| [**tar**](https://www.gnu.org/software/tar/) | `/usr/bin` | [distro package](https://repology.org/project/tar/versions) | Linux | [GPL-3.0-or-later](https://git.savannah.gnu.org/cgit/tar.git/tree/COPYING) |
| [**typos**](https://github.com/crate-ci/typos) | `$CARGO_HOME/bin` | [GitHub Releases](https://github.com/crate-ci/typos/releases) | Linux, macOS, Windows | [MIT](https://github.com/crate-ci/typos/blob/master/LICENSE-MIT) OR [Apache-2.0](https://github.com/crate-ci/typos/blob/master/LICENSE-APACHE) |
| [**valgrind**](https://valgrind.org/) | `/snap/bin` | [snap](https://snapcraft.io/install/valgrind/ubuntu) | Linux | [GPL-2.0](https://sourceware.org/git/?p=valgrind.git;a=blob;f=COPYING;hb=HEAD) |
| [**wait-for-them**](https://github.com/shenek/wait-for-them) | `$CARGO_HOME/bin` | [GitHub Releases](https://github.com/shenek/wait-for-them/releases) | Linux, macOS, Windows | [GPL-3.0](https://github.com/shenek/wait-for-them/blob/v0.4.0/Cargo.toml#L7) |
Expand Down
80 changes: 65 additions & 15 deletions tools/codegen/src/tools-markdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,55 @@ fn main() -> Result<()> {
fs::read_dir(manifest_dir.clone()).unwrap().map(|r| r.unwrap()).collect();
paths.sort_by_key(fs_err::DirEntry::path);

let mut tools = vec![MarkdownEntry {
name: "valgrind".to_string(),
alias: None,
website: "https://valgrind.org/".to_string(),
installed_to: InstalledTo::Snap,
installed_from: InstalledFrom::Snap,
platforms: Platforms { linux: true, ..Default::default() },
repository: "https://sourceware.org/git/valgrind.git".to_string(),
license_markdown:
"[GPL-2.0](https://sourceware.org/git/?p=valgrind.git;a=blob;f=COPYING;hb=HEAD)"
let mut tools = vec![
MarkdownEntry {
name: "valgrind".to_string(),
alias: None,
website: "https://valgrind.org/".to_string(),
installed_to: InstalledTo::Snap,
installed_from: InstalledFrom::Snap,
platforms: Platforms { linux: true, ..Default::default() },
repository: "https://sourceware.org/git/valgrind.git".to_string(),
license_markdown:
"[GPL-2.0](https://sourceware.org/git/?p=valgrind.git;a=blob;f=COPYING;hb=HEAD)"
.to_string(),
},
MarkdownEntry {
name: "jq".to_string(),
alias: None,
website: "https://github.com/jqlang/jq".to_string(),
installed_to: InstalledTo::UsrBin,
installed_from: InstalledFrom::DistroPackage,
platforms: Platforms { linux: true, windows: true, macos: false },
repository: "https://github.com/jqlang/jq".to_string(),
license_markdown:
"[MIT AND ICU AND CC-BY-3.0](https://github.com/jqlang/jq/blob/master/jq.spec#L9)"
.to_string(),
},
MarkdownEntry {
name: "curl".to_string(),
alias: None,
website: "https://github.com/curl/curl".to_string(),
installed_to: InstalledTo::UsrBin,
installed_from: InstalledFrom::DistroPackage,
platforms: Platforms { linux: true, ..Default::default() },
repository: "https://github.com/curl/curl".to_string(),
license_markdown: "[curl](https://github.com/curl/curl/blob/master/COPYING)"
.to_string(),
}];
},
MarkdownEntry {
name: "tar".to_string(),
alias: None,
website: "https://www.gnu.org/software/tar/".to_string(),
installed_to: InstalledTo::UsrBin,
installed_from: InstalledFrom::DistroPackage,
platforms: Platforms { linux: true, ..Default::default() },
repository: "https://git.savannah.gnu.org/cgit/tar.git".to_string(),
license_markdown:
"[GPL-3.0-or-later](https://git.savannah.gnu.org/cgit/tar.git/tree/COPYING)"
.to_string(),
},
];

for path in paths {
let file_name = path.file_name();
Expand All @@ -76,8 +113,11 @@ fn main() -> Result<()> {

let repository = base_info.repository;

let installed_to =
if manifests.rust_crate.is_some() { InstalledTo::Cargo } else { InstalledTo::UsrLocal };
let installed_to = if manifests.rust_crate.is_some() {
InstalledTo::Cargo
} else {
InstalledTo::UsrLocalBin
};

let installed_from = InstalledFrom::GitHubRelease;
let mut platforms = Platforms::default();
Expand Down Expand Up @@ -141,6 +181,7 @@ struct MarkdownEntry {
enum InstalledFrom {
GitHubRelease,
Snap,
DistroPackage,
}

#[derive(Debug, Default, Eq, PartialEq)]
Expand Down Expand Up @@ -172,15 +213,17 @@ impl fmt::Display for Platforms {
enum InstalledTo {
Cargo,
Snap,
UsrLocal,
UsrBin,
UsrLocalBin,
}

impl fmt::Display for InstalledTo {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
InstalledTo::Cargo => f.write_str("`$CARGO_HOME/bin`")?,
InstalledTo::Snap => f.write_str("`/snap/bin`")?,
InstalledTo::UsrLocal => f.write_str("`/usr/local/bin`")?,
InstalledTo::UsrBin => f.write_str("`/usr/bin`")?,
InstalledTo::UsrLocalBin => f.write_str("`/usr/local/bin`")?,
}

Ok(())
Expand All @@ -204,6 +247,13 @@ impl fmt::Display for MarkdownEntry {
let markdown = format!("| [GitHub Releases]({}/releases) ", self.repository);
f.write_str(&markdown)?;
}
InstalledFrom::DistroPackage => {
let markdown = format!(
"| [distro package](https://repology.org/project/{}/versions) ",
self.name
);
f.write_str(&markdown)?;
}
InstalledFrom::Snap => {
let markdown =
format!("| [snap](https://snapcraft.io/install/{}/ubuntu) ", self.name);
Expand Down