kornelski / cargo-deb

A cargo subcommand that generates Debian packages from information in Cargo.toml
https://lib.rs/cargo-deb
MIT License
404 stars 48 forks source link

[Feature-Request] Advanced Usage, "append" option for assets #114

Closed juliusl closed 9 months ago

juliusl commented 10 months ago

It would be useful if there was an option to append the assets array for variants. For example, if I had a Cargo.toml like this,

[package]
name = "test-deb"
authors = ["foo"]
version = "0.1.0"
edition = "2021"
description = "example deb"
license = "MIT"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]

[package.metadata.deb]
name = "test-deb"
assets = [
    [
    "lib/hello-world.txt",
    "hello-world.txt",
    "755"
    ]
]

[package.metadata.deb.variants.test]
assets=[
    [
    "lib/hello-world-2.txt",
    "hello-world-2.txt",
    "755"
    ]
]

Variant "test" would end up w/ both hello-world-2.txt, and hello-world.txt.

"Merging" would be cool too but, I think appending would probably be easier to implement.

I am willing to contribute a PR.

I'm thinking it would be an option like this,

[package.metadata.deb.variants.test]
append_assets=[
...
]
kornelski commented 9 months ago

Yes that makes sense. Perhaps it should be a merge, so that you can also replace destination paths of existing assets?

juliusl commented 9 months ago

@kornelski merge would be even better, would you be open to a PR for this?

kornelski commented 9 months ago

Yes please.