mmstick / cargo-deb

A cargo subcommand that generates Debian packages from information in Cargo.toml
615 stars 50 forks source link

Guidance on how to build multiple versions of same .deb #186

Closed julianandrews closed 3 years ago

julianandrews commented 3 years ago

I've got a project where I need to install assets to one of two locations, depending on the distribution version (assets go to /usr/lib for Buster/Hirsute, and to /usr/libexec/ for Bullseye/Impish).

Is there a good way to build both packages from the same config? I tried using variants, but I want the package name to stay the same.

apiraino commented 3 years ago

@julianandrews I think you can create a "base" build and using variants build for different environments. Example:

[package.metadata.deb]
# common .deb name (e.g. my-project_x.y.z_amd64.deb)
name = "my-project"

[package.metadata.deb.variants.buster]
assets = [
       ["assets/*", "usr/lib/", "664"]

[package.metadata.deb.variants.bullseye]
assets = [
       ["assets/*", "usr/libexec/", "664"]

hth

julianandrews commented 3 years ago

@apiraino - that seems to work. Thanks!