Skip to content

cmake -DCPACK_BINARY_DEB=ON and CPACK_PACKAGE_VERSION #1503

@DimitriPapadopoulos

Description

@DimitriPapadopoulos

I am attempting to build a local DEB package, loosely following Compiling ANTs on Linux and Mac OS:

workingDir=${PWD}
git clone https://github.com/ANTsX/ANTs.git
mkdir build install
cd build

cmake \
    -DCMAKE_INSTALL_PREFIX=${workingDir}/install \
    -DCPACK_BINARY_DEB=ON -DCPACK_BINARY_TGZ=OFF -DCPACK_BINARY_TZ=OFF \
    -DBUILD_TESTING=OFF -DRUN_LONG_TESTS=OFF -DRUN_SHORT_TESTS=OFF \
    ../ANTs

make -j 16 package

The resulting DEB package version starts with v. From the resulting file ANTS-build/CPackConfig.cmake:

[...]
set(CPACK_PACKAGE_FILE_NAME "ANTs-v2.4.3.post10-g871cad0-Linux")
set(CPACK_PACKAGE_HOMEPAGE_URL "https://github.com/ANTsX/ANTs")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "ANTS_Install")
set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "ANTS_Install")
set(CPACK_PACKAGE_NAME "ANTs")
set(CPACK_PACKAGE_RELOCATABLE "true")
set(CPACK_PACKAGE_VENDOR "CMake.org")
set(CPACK_PACKAGE_VERSION "v2.4.3.post10-g871cad0")
set(CPACK_PACKAGE_VERSION_MAJOR "2")
set(CPACK_PACKAGE_VERSION_MINOR "4")
set(CPACK_PACKAGE_VERSION_PATCH "3")
[...]

Unfortunately, recent versions of dpkg, such as dpkg 1.21 available on Ubuntu 22.04, complain if the upstream-version of a DEB package does not start with a digit. From the deb-version(7) man page:

           The upstream-version may contain only alphanumerics (“A-Za-z0-9”) and the characters .
           + - : ~ (full stop, plus, hyphen, colon, tilde) and should start with a digit.  If
           there is no debian-revision then hyphens are not allowed; if there is no epoch then
           colons are not allowed.

Typical resulting error message:

$ sudo dpkg -i ANTs-v2.4.3.post10-g871cad0-Linux.deb
dpkg: error processing archive ANTs-v2.4.3.post10-g871cad0-Linux.deb (--install):
 parsing file '/var/lib/dpkg/tmp.ci/control' near line 374 package 'ants':
 'Version' field value 'v2.4.3.post10-g871cad0': version number does not start with digit
Errors were encountered while processing:
 ANTs-v2.4.3.post10-g871cad0-Linux.deb

When did the error occur?

[X] CMake configuration (cmake / ccmake)
[ ] Compilation (make)
[ ] Installation (make install)

Build environment

  • OS: GNU/Linux Ubuntu
  • OS version: 22.04
  • Type of system: desktop

ANTs version

master branch

Build configuration and logs

Additional context

Projects I know of on GitHub start version tags with a v, but drop the v when building tarballs or DEB/RPM packages.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementEnhancements under development - feel free to join discussion if you'd like to contributefeature requestIdeas for new or improved ANTs featureshelp neededIssues that require feedback or expertise from the community. Discussion and PRs welcome

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions