thin-edge / thin-edge.io

The open edge framework for lightweight IoT devices
https://thin-edge.io
Apache License 2.0
223 stars 55 forks source link

Debian release artefacts do not conform to Debian package naming standards #1552

Closed reubenmiller closed 1 year ago

reubenmiller commented 2 years ago

Describe the bug

The released .deb packages do not conform to the Debian package naming conventions as it uses underscores _ in the package names (e.g. the Package field in the Debian control file).

This causes downstream problems when trying to use any of the packages with naming convention violations with other package building tooling like equivs-build.

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.

Affected packages

To Reproduce

The Debian control file (which includes the package meta information) can be viewed from any of the releases' .deb artefacts by executing the following commands:

ar -x c8y_configuration_plugin_0.8.0_arm64.deb
xz --decompress control.tar.xz
tar xvf control.tar
cat control

Example output (from Debian control)

Package: c8y_configuration_plugin        <- This field is not allowed to have underscores!
Version: 0.8.0
Architecture: arm64
Vcs-Browser: https://github.com/thin-edge/thin-edge.io
Vcs-Git: https://github.com/thin-edge/thin-edge.io
Homepage: https://thin-edge.io
Priority: optional
Maintainer: thin-edge.io team <info@thin-edge.io>
Installed-Size: 3739
Description: Thin-edge device configuration management for Cumulocity

Expected behavior

The Package field in the Debian control files should use a minus - instead of underscore _.

Recommended packages names

Old name new name
c8y_configuration_plugin c8y-configuration-plugin
c8y_log_plugin c8y-log-plugin
tedge_agent tedge-agent
tedge_apama_plugin tedge-apama-plugin
tedge_mapper tedge-mapper
tedge_watchdog tedge-watchdog

Screenshots

Not applicable

Environment (please complete the following information):

Additional context

Not applicable

reubenmiller commented 2 years ago

By default the Debian package name is taken from the package.name field in the Cargo.toml. It can be overridden in the package.metadata.deb section (as per the docs).

It is also important that the [package.metadata.deb].replaces field is also set to facilitate a smooth upgrade path between the renamed packages.

Below is a snippet from a modified Cargo.toml (note: some fields have been left out for demonstration purposes only)

[package]
name = "tedge_agent"

[package.metadata.deb]
name = "tedge-agent"
replaces = "tedge_agent"
pre-depends = "tedge-mapper"
reubenmiller commented 2 years ago

After experimenting with a Debian repository, I can confirm that packages which use an underscore _ in their name are NOT installable via apt. The apt packages lists somehow just ignore any package that does not confirm to the naming convention.

# This does not work!
apt-get install tedge_agent

So the packages names will definitely need to be changed before we can offer the tedge packages via apt.

reubenmiller commented 2 years ago

It seems that some validation/name translation will be added to cargo-deb soonish. Here is the ticket I created which has already been merged into main.