mmstick / cargo-deb

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

Use a custom copyright/license file without adding auto-generated lines #187

Open filips123 opened 3 years ago

filips123 commented 3 years ago

I created a custom copyright file that complies with debian/copyright file specification and I would like to package it into a DEB archive.

If I just add license-file = ["debian/copyright", "0"] to Cargo.toml, the file will be packed into an archive, but cargo-deb will add auto-generated lines at the start of file, causing duplicated or possibly incorrect data.

Maybe there could be an additional option in license-file to prevent adding auto-generated lines to the copyright/license file?

kornelski commented 3 years ago

The assumption for license-file is that it's a plain file used for Cargo.

I suppose cargo-deb could try being smart about this and see if the file already uses Debian's syntax, and not add its fields if it does.

filips123 commented 3 years ago

Considering that license-file inside [package.metadata.deb] section already uses a different format (array with filename and numbers of lines to skip) than package-level license-file (just string filename), could there be another array element to tell cargo-deb to now add any fields?

For example:

# Standard Cargo.toml stuff
# ...

[package.metadata.deb]
license-file = ["debian/copyright", "0", true]
# So this means debian/copyright filename, skip zero lines, and it is already Debian-formatted file so don't add any new fields
kornelski commented 3 years ago

There could be (although arrays need all elements to be strings, so ["path", "0", "true"]), but the downside is that this requires us documenting it and users knowing to set it. I much prefer "just works" approach.