From 4cb8296b02d7ddffedbaa67a00736d61da7a7b2a Mon Sep 17 00:00:00 2001 From: Ben Beasley Date: Sat, 17 Feb 2024 15:20:17 -0500 Subject: [PATCH] Exclude more files from the published crate (#591) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There was an incorrect glob `bench/*` that was doing nothing, since the benchmarks are in `benches/`; when I corrected it to `benches/*`, `cargo publish --dry-run` failed: ``` error: failed to verify package tarball Caused by: failed to parse manifest at `/home/ben/src/forks/oxipng/target/package/oxipng-9.0.0/Cargo.toml` Caused by: can't find `zopfli` bench at `benches/zopfli.rs` or `benches/zopfli/main.rs`. Please specify bench.path if you want to use a non-default path. ``` …so I stopped trying to exclude the benchmarks from published crates at all. ----- Then, I added `Dockerfile`, `index.html`, and `scripts/` to the list of paths to exclude from published crates. Finally, I added some unnecessary “dotfiles” to the list of paths to exclude from published crates. ----- Some of this was suggested in a [package review for Fedora Linux](https://bugzilla.redhat.com/show_bug.cgi?id=2259760). After the PR: ``` $ cargo package --list .cargo/config.toml .cargo_vcs_info.json CHANGELOG.md Cargo.lock Cargo.toml Cargo.toml.orig LICENSE MANUAL.txt README.md benches/deflate.rs […] benches/zopfli.rs src/atomicmin.rs […] src/sanity_checks.rs $ cargo publish --dry-run […] Compiling oxipng v9.0.0 (/home/ben/src/forks/oxipng/target/package/oxipng-9.0.0) Finished dev [optimized + debuginfo] target(s) in 15.76s Packaged 37 files, 255.4KiB (61.6KiB compressed) Uploading oxipng v9.0.0 (/home/ben/src/forks/oxipng) warning: aborting upload due to dry run ``` --- Cargo.toml | 11 ++++++++++- index.html | 1 - 2 files changed, 10 insertions(+), 2 deletions(-) delete mode 100644 index.html diff --git a/Cargo.toml b/Cargo.toml index 0b04778a8..17dd26121 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,16 @@ categories = ["command-line-utilities", "compression"] description = "A lossless PNG compression optimizer" documentation = "https://docs.rs/oxipng" edition = "2021" -exclude = ["tests/*", "bench/*"] +exclude = [ + ".editorconfig", + ".gitattributes", + ".github/*", + ".gitignore", + ".pre-commit-hooks.yaml", + "Dockerfile", + "scripts/*", + "tests/*", +] homepage = "https://github.com/shssoichiro/oxipng" license = "MIT" name = "oxipng" diff --git a/index.html b/index.html deleted file mode 100644 index 12c5bdc4b..000000000 --- a/index.html +++ /dev/null @@ -1 +0,0 @@ -