mmstick / cargo-deb

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

Override revision instead of whole version at command line #196

Open 2rs2ts opened 3 years ago

2rs2ts commented 3 years ago

--deb-version lets me override the version string, so I use this to build multiple versions of my deb for different versions of Debian (stretch, buster, etc.)

However, this flag replaces the entire version string, meaning I have to manually re-specify the whole thing every time (or write a script to do it.)

$ cargo deb --deb-version 1.2.3-stretch1
$ cargo deb --deb-version 1.2.3-buster1
...

It would be great to just be able to override the revision field instead. Something like this:

$ cargo deb --deb-revision stretch1
$ cargo deb --deb-revision buster1

I am sure there are use cases for this besides supporting different versions of Debian, but that's just the one I'm dealing with right now.

kornelski commented 3 years ago

Sounds useful. Can you make a PR?

2rs2ts commented 3 years ago

I've never written rust before in my life, so while I would be glad to open a PR, you may end up waiting a very long time for me to get around to it

kornelski commented 3 years ago

If you're interested in trying Rust, I recommend giving it a shot. You can start by copy-pasting existing version option. Appending a suffix can be done with format!(). If you want to remove any old suffix, that may need some wrangling with str.rsplitn or such.