kornelski / cargo-deb

Make Debian packages directly from Rust/Cargo projects
https://lib.rs/cargo-deb
MIT License
408 stars 48 forks source link

Debian package name validation #57

Closed reubenmiller closed 1 year ago

reubenmiller commented 1 year ago

Currently there is no validation (or automatic translation) of the Debian package name when building the .deb package. This can result in a situation where the produced Debian packages are not actually installable via apt as packages which do not conform to the naming convention are ignored.

Below is an example which will produce a .deb file, however when it is uploaded to a Debian repository (such as jfrog.io) it will not be installable as apt just says that the package could not be found.

[package]
name = "tedge_agent"

The problem is also not just limited to Debian repositories/apt, but also additional tooling such as equivs-build which is used to create meta Debian packages. The command fails when you try to reference any non-name-conform package in the dependencies fields (e.g. Pre-Depends, Depends, Recommends etc.).

Currently the only work around is to set the package name in the configuration under [packages.metadata.deb].name. This is unexpected for people who are not familiar with Debian packaging.

[package]
name = "tedge_agent"

[package.metadata.deb]
# Change to use `-` instead of `_`
name = "tedge-agent"

Background

The Debian standard states that following under the package naming convention:

Package names (both source and binary, see Package) must consist only of lower case letters (a-z), digits (0-9), plus (+) and minus (-) signs, and periods (.). They must be at least two characters long and must start with an alphanumeric character.

Possible solutions

kornelski commented 1 year ago

Thanks for the report.