Hi all,
Please find attached a patch that enables the proper handling of the
"Source" field for binary Debian packages.
For the little story, this field references the source package (with
possible revision number) that was used to generate the binary package.
This is indeed needed when several .deb packages are generated by one
source tree, otherwise the generated binary packages are rejected by eg.
Launchpad at the upload step.
Without this patch, mono-component installs work as expected (see cmake
below).
I have successfully used the patch (and all the previous developments on
CPackDEB) to generate my little C++ project on Launchpad from a GIT
repository (check the packages content):
https://code.launchpad.net/~raffi-enficiaud-x/+archive/ubuntu/yayi/+packages
Also, I would like to announce that I created a little "debian/" folder
for the cmake project that allows to build "cmake" on Launchpad without
any effort/hassle, just by using a few dpkg tools and the cmake CPackDEB
machinery (based on the previous improvements of CPackDEB):
https://bitbucket.org/renficiaud/cmake-debian-ppa/src/3f79ec63ccdc331a7142f2088cd5e0311d04c7cc?at=master
The generated cmake debian packages are also in the same PPA.
I would be happy to know more about the best practices for being able to
generate multiple Debian packages from one source. Any comments more
than welcome.
Kind regards,
Raffi Enficiaud
PS: I posted on the gmane.linux.debian.devel.mentors list in the
following thread
http://thread.gmane.org/gmane.linux.debian.devel.mentors/72992
From c8fdbafdff7ed2556be53371a2357aa82ad6db5c Mon Sep 17 00:00:00 2001
From: Raffi Enficiaud
Date: Wed, 28 Oct 2015 23:59:42 +0100
Subject: [PATCH] CPackDEB: handling binary packages "Source" field
- CPackeDEB now honour the Source field with multicomponent support
- minor documentation enhancements
---
Modules/CPackDeb.cmake | 48 --
Source/CPack/cmCPackDebGenerator.cxx | 7 ++
Tests/CMakeLists.txt | 3 +-
.../MyLibCPackConfig-components-source.cmake.in| 33 ++
.../RunCPackVerifyResult-components-source.cmake | 75 ++
5 files changed, 158 insertions(+), 8 deletions(-)
create mode 100644
Tests/CPackComponentsDEB/MyLibCPackConfig-components-source.cmake.in
create mode 100644
Tests/CPackComponentsDEB/RunCPackVerifyResult-components-source.cmake
diff --git a/Modules/CPackDeb.cmake b/Modules/CPackDeb.cmake
index 60e0d1f..3b82c73 100644
--- a/Modules/CPackDeb.cmake
+++ b/Modules/CPackDeb.cmake
@@ -8,7 +8,7 @@
# ^^
#
# CPackDeb may be used to create Deb package using CPack.
-# CPackDeb is a CPack generator thus it uses the CPACK_XXX variables
+# CPackDeb is a CPack generator thus it uses the `CPACK_XXX` variables
# used by CPack : https://cmake.org/Wiki/CMake:CPackConfiguration.
# CPackDeb generator should work on any linux host but it will produce
# better deb package when Debian specific tools 'dpkg-xxx' are usable on
@@ -18,7 +18,7 @@
# :code:`CPACK_DEBIAN_XXX` variables.
#
# :code:`CPACK_DEBIAN__` variables may be used in order to have
-# **component** specific values. Note however that refers to the
+# **component** specific values. Note however that `` refers to the
# **grouping name** written in upper case. It may be either a component name or
# a component GROUP name.
#
@@ -354,7 +354,28 @@
#set by Debian policy
#
https://www.debian.org/doc/debian-policy/ch-files.html#s-permissions-owners
#
-
+# .. variable:: CPACK_DEBIAN_PACKAGE_SOURCE
+# CPACK_DEBIAN__PACKAGE_SOURCE
+#
+# Sets the `Source` field of the binary Debian package.
+# When the binary package name is not the same as the source package name
+# in particular when several components/binaries are generated from one
source)
+# the source from which the binary has been generated should be indicated with
+# the field `Source`.
+#
+# * Mandatory : NO
+# * Default :
+#
+#- An empty string for non-component based installations
+#- :variable:`CPACK_DEBIAN_PACKAGE_SOURCE` for component-based
+# installations.
+#
+# See
https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Source
+#
+# .. note::
+#
+#This value is not interpreted, it is then possible to pass an optional
+#revision number for the referenced source package as well.
#=
# Copyright 2007-2009 Kitware, Inc.
@@ -554,6 +575,16 @@ function(cpack_deb_prepare_package_vars)
)
endif()
+ # Source: (optional)
+ # in case several packages are constructed from a unique source
+ # (multipackaging), the the source may be indicated as well.
+ # The source might contain a version if the generated package
+ # version is different from the source version
+ if(NOT