Skip to content

Conversation

@coleplx
Copy link

@coleplx coleplx commented Oct 21, 2024

I faced an issue packaging ImageMagick for Ubuntu 20.04 where fpm complained about an invalid relationship field for a package.

According to https://www.debian.org/doc/debian-policy/ch-controlfields.html#version, I believe the field should support more characters.

The version number of a package. The format is: [epoch:]upstream_version[-debian_revision].
(...)
The upstream_version must contain only alphanumerics 6 and the characters . + - ~ (full stop, plus, hyphen, tilde) and should start with a digit. If there is no debian_revision then hyphens are not allowed.

Also, according to https://www.debian.org/doc/debian-policy/ch-relationships.html#syntax-of-relationship-fields,

All of the fields may restrict their applicability to particular versions of each named package. This is done in parentheses after each individual package name; the parentheses should contain a relation from the list below followed by a version number, in the format described in Version.

@jordansissel
Copy link
Owner

@coleplx Thank you for helping improve fpm! I think I'd like some more information -- Your summary talks about the acceptable values for versions, but your patch affects the package name not the version pattern. I may be forgetting or misreading some parts of the Debian docs, though.

Can you show me an example where fpm is telling you about an invalid relationship field? I'd like to get this fixed :)

@coleplx
Copy link
Author

coleplx commented Dec 10, 2024

Hey @jordansissel,

I wonder if I misunderstood the docs. 🤔 That's quite possible given I'm not usually working with this kind of stuff.

Here's the issue I faced when packaging ImageMagick-7:

{:timestamp=>"2024-12-10T10:35:43.344676-0300", :message=>"Invalid relationship field for debian package: libmagick++-7.q8-dev (= 7.1.1-39+imei3)", :level=>:error}
{:timestamp=>"2024-12-10T10:35:43.344853-0300", :message=>"Invalid package configuration: Found invalid Provides field values (\"libmagick++-7.q8-dev (= 7.1.1-39+imei3)\"). This is not valid in a Debian package.", :level=>:error}

I'm checking the docs again now: https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-package

Binary package names must follow the same syntax and restrictions as source package names. See Source for the details.
Which says:
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.

Hmmm, so yeah, my PR is a bit wrong. I added the ~ symbol, but that's not valid for package name, only versions. Removed it now. :)

After the latest patch:

{:timestamp=>"2024-12-10T11:17:49.895058-0300", :message=>"Created package", :path=>"/usr/local/imei_packages/imagemagick-7.q8_7.1.1-39+imei3.deb"}

And for future reference, the partial FPM command used:

          $FPM_BIN -s dir -t deb \
          --name "imagemagick-${MAIN_VER}.q${QUANTUM_DEPTH}" \
          --force \
          --license "" \
          --version "${IMAGEMAGICK_VER}+imei${BUILD_VERSION:-1}" \
          --package "${DEB_DIR}/imagemagick-${MAIN_VER}.q${QUANTUM_DEPTH}_${IMAGEMAGICK_VER}+imei${BUILD_VERSION:-1}.deb" \
          --depends "$REQUIRES" \
          --provides "imagemagick (= ${IMAGEMAGICK_VER}+imei${BUILD_VERSION:-1})" \
          --provides "imagemagick-${MAIN_VER}.q${QUANTUM_DEPTH} (= ${IMAGEMAGICK_VER}+imei${BUILD_VERSION:-1})" \
          --provides "libmagickcore-${MAIN_VER}.q${QUANTUM_DEPTH} (= ${IMAGEMAGICK_VER}+imei${BUILD_VERSION:-1})" \
          --provides "libmagickcore-${MAIN_VER}.q${QUANTUM_DEPTH}-dev (= ${IMAGEMAGICK_VER}+imei${BUILD_VERSION:-1})" \
          --provides "libmagickwand-${MAIN_VER}.q${QUANTUM_DEPTH} (= ${IMAGEMAGICK_VER}+imei${BUILD_VERSION:-1})" \
          --provides "libmagickwand-${MAIN_VER}.q${QUANTUM_DEPTH}-dev (= ${IMAGEMAGICK_VER}+imei${BUILD_VERSION:-1})" \
          --provides "libmagick-${MAIN_VER}.q${QUANTUM_DEPTH} (= ${IMAGEMAGICK_VER}+imei${BUILD_VERSION:-1})" \
          --provides "libmagick++-${MAIN_VER}.q${QUANTUM_DEPTH}-dev (= ${IMAGEMAGICK_VER}+imei${BUILD_VERSION:-1})" \
          --provides "libmagick++-${MAIN_VER}-headers (= ${IMAGEMAGICK_VER}+imei${BUILD_VERSION:-1})" \
          --provides "imagemagick-${MAIN_VER}-common (= ${IMAGEMAGICK_VER}+imei${BUILD_VERSION:-1})" \

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants