Skip to content

Commit 371021d

Browse files
committed
packaging: Fix DEB package definition to handle ABI version changes
1 parent 9691afa commit 371021d

10 files changed

+51
-33
lines changed

packaging/deb-in/CMakeLists.txt

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -108,18 +108,36 @@ ENDIF()
108108
# by debuild to make the packages
109109
SET (DEB_ROOT ${CMAKE_SOURCE_DIR}/packaging/deb-in)
110110
FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/debian)
111-
FILE(GLOB_RECURSE SOURCEFILES RELATIVE "${DEB_ROOT}" "${DEB_ROOT}/*")
112-
# Skip the copyright file from the "other" product type
113-
LIST(REMOVE_ITEM SOURCEFILES "copyright.${DEB_REMOVEPATTERN}")
114-
LIST(REMOVE_ITEM SOURCEFILES "CMakeLists.txt")
115-
FOREACH (SOURCEFILE ${SOURCEFILES})
116-
STRING(REGEX REPLACE "-packagesource-" "${DEB_PRODUCTNAME}-"
117-
TMPFILE ${SOURCEFILE})
118-
# Strip away the input file endings from the destination filenames
119-
STRING(REGEX REPLACE ".in$" "" DESTFILE ${TMPFILE})
120-
CONFIGURE_FILE("${DEB_ROOT}/${SOURCEFILE}"
121-
"${CMAKE_BINARY_DIR}/debian/${DESTFILE}" @ONLY)
122-
ENDFOREACH()
111+
112+
foreach(CF changelog control rules compat)
113+
set(src "${DEB_ROOT}/${CF}")
114+
set(dst "${CMAKE_BINARY_DIR}/debian/${CF}")
115+
# message(STATUS "Preparing: ${dst}")
116+
if(EXISTS "${src}")
117+
configure_file("${src}" "${dst}" COPYONLY)
118+
elseif(EXISTS "${src}.in")
119+
configure_file("${src}.in" "${dst}" @ONLY)
120+
else()
121+
message(SEND_ERROR "Control file not found: ${CF}")
122+
endif()
123+
endforeach()
124+
125+
set(pkg_xdevapi "libmysqlcppconnx${ABI_VERSION_MAJOR}")
126+
set(pkg_jdbc "libmysqlcppconn${JDBC_ABI_VERSION_MAJOR}")
127+
set(pkg_devel "libmysqlcppconn-dev")
128+
129+
foreach(pkg xdevapi jdbc devel)
130+
foreach(ext .install .lintian-overrides -dbgsym.install .postinst)
131+
set(PACKAGE_BASE_NAME "${pkg_${pkg}}")
132+
set(src "${DEB_ROOT}/${pkg}${ext}.in")
133+
set(dst "${CMAKE_BINARY_DIR}/debian/${PACKAGE_BASE_NAME}${ext}")
134+
if(EXISTS "${src}")
135+
# message(STATUS "Preparing: ${dst}, from: ${src}")
136+
configure_file("${src}" "${dst}" @ONLY)
137+
endif()
138+
endforeach()
139+
endforeach()
140+
123141
EXECUTE_PROCESS(
124142
COMMAND chmod +x ${CMAKE_BINARY_DIR}/debian/rules
125143
)

packaging/deb-in/libmysqlcppconn-dev.install.in renamed to packaging/deb-in/devel.install.in

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ usr/include/jdbc/*.h usr/include/mysql-cppconn/jdbc
3737
usr/include/jdbc/cppconn/*.h usr/include/mysql-cppconn/jdbc/cppconn
3838

3939
# Build info
40-
/usr/INFO_SRC /usr/share/doc/libmysqlcppconn-dev
41-
/usr/INFO_BIN /usr/share/doc/libmysqlcppconn-dev
40+
/usr/INFO_SRC /usr/share/doc/@PACKAGE_BASE_NAME@
41+
/usr/INFO_BIN /usr/share/doc/@PACKAGE_BASE_NAME@
4242

4343
# Legal
44-
usr/LICENSE.txt /usr/share/doc/libmysqlcppconn-dev
45-
usr/README.txt /usr/share/doc/libmysqlcppconn-dev
44+
usr/LICENSE.txt /usr/share/doc/@PACKAGE_BASE_NAME@
45+
usr/README.txt /usr/share/doc/@PACKAGE_BASE_NAME@

packaging/deb-in/libmysqlcppconnx2-dbgsym.install.in renamed to packaging/deb-in/jdbc-dbgsym.install.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@
2222
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2323

2424
# Legal
25-
usr/LICENSE.txt /usr/share/doc/libmysqlcppconnx2-dbgsym
26-
usr/README.txt /usr/share/doc/libmysqlcppconnx2-dbgsym
25+
usr/LICENSE.txt /usr/share/doc/@PACKAGE_BASE_NAME@-dbgsym
26+
usr/README.txt /usr/share/doc/@PACKAGE_BASE_NAME@-dbgsym

packaging/deb-in/libmysqlcppconn9.install.in renamed to packaging/deb-in/jdbc.install.in

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@
2121
# along with this program; if not, write to the Free Software Foundation, Inc.,
2222
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2323

24-
usr/lib/*/libmysqlcppconn.so.9*
24+
usr/lib/*/libmysqlcppconn.so.@JDBC_ABI_VERSION_MAJOR@*
2525

2626
# Build info
27-
/usr/INFO_SRC /usr/share/doc/libmysqlcppconn9
28-
/usr/INFO_BIN /usr/share/doc/libmysqlcppconn9
27+
/usr/INFO_SRC /usr/share/doc/@PACKAGE_BASE_NAME@
28+
/usr/INFO_BIN /usr/share/doc/@PACKAGE_BASE_NAME@
2929

3030
# Legal
31-
usr/LICENSE.txt /usr/share/doc/libmysqlcppconn9
32-
usr/README.txt /usr/share/doc/libmysqlcppconn9
31+
usr/LICENSE.txt /usr/share/doc/@PACKAGE_BASE_NAME@
32+
usr/README.txt /usr/share/doc/@PACKAGE_BASE_NAME@

packaging/deb-in/libmysqlcppconn9.lintian-overrides.in renamed to packaging/deb-in/jdbc.lintian-overrides.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2323

2424
# Additional license file is needed so overriding this warning
25-
libmysqlcppconn9: extra-license-file
25+
@PACKAGE_BASE_NAME@: extra-license-file
2626

2727
# Due to static linking this cannot be avoided and hence being overridden
28-
libmysqlcppconn9: embedded-library
28+
@PACKAGE_BASE_NAME@: embedded-library

packaging/deb-in/libmysqlcppconn9-dbgsym.install.in renamed to packaging/deb-in/xdevapi-dbgsym.install.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@
2222
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2323

2424
# Legal
25-
usr/LICENSE.txt /usr/share/doc/libmysqlcppconn9-dbgsym
26-
usr/README.txt /usr/share/doc/libmysqlcppconn9-dbgsym
25+
usr/LICENSE.txt /usr/share/doc/@PACKAGE_BASE_NAME@-dbgsym
26+
usr/README.txt /usr/share/doc/@PACKAGE_BASE_NAME@-dbgsym

packaging/deb-in/libmysqlcppconnx2.install.in renamed to packaging/deb-in/xdevapi.install.in

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@
2121
# along with this program; if not, write to the Free Software Foundation, Inc.,
2222
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2323

24-
usr/lib/*/libmysqlcppconnx.so.2*
24+
usr/lib/*/libmysqlcppconnx.so.@ABI_VERSION_MAJOR@*
2525

2626
# Build info
27-
/usr/INFO_SRC /usr/share/doc/libmysqlcppconnx2
28-
/usr/INFO_BIN /usr/share/doc/libmysqlcppconnx2
27+
/usr/INFO_SRC /usr/share/doc/@PACKAGE_BASE_NAME@
28+
/usr/INFO_BIN /usr/share/doc/@PACKAGE_BASE_NAME@
2929

3030
# Legal
31-
usr/LICENSE.txt /usr/share/doc/libmysqlcppconnx2
32-
usr/README.txt /usr/share/doc/libmysqlcppconnx2
31+
usr/LICENSE.txt /usr/share/doc/@PACKAGE_BASE_NAME@
32+
usr/README.txt /usr/share/doc/@PACKAGE_BASE_NAME@

packaging/deb-in/libmysqlcppconnx2.lintian-overrides.in renamed to packaging/deb-in/xdevapi.lintian-overrides.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@
2222
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2323

2424
# Additional license file is needed so overriding this warning
25-
libmysqlcppconnx2: extra-license-file
25+
@PACKAGE_BASE_NAME@: extra-license-file

0 commit comments

Comments
 (0)