Skip to content

Commit 2de33d0

Browse files
jonatluusystems-assistant[bot]
authored andcommitted
Enable Lintian Support rocm-systems
* draft testing fix for no copyright file and no changelog * test fix no-changelog no-copyright * changelog copyright fixt * remove utils.cmake * rocr lintian * lintian overrides, copyright, changelog install * fix lintian overrides install * comp_type static fix and remove debug logs * syntax error * update static build check * update file permissions to 0755 to fix error control-file-has-bad-permissions 0664 != 0755 * fix lintian errors in rdc and remove logs from roctracer * lintian error fix rocprofiler * fix lintian error * mmove lintian overrides install * lintian errors fix * move lintian overrides install * use changelog already provided by rdc * fix formatting use existing changelog if provided * fix formatting use changelog in rocprofiler * draft testing fix for no copyright file and no changelog * test fix no-changelog no-copyright * changelog copyright fixt * lintian overrides, copyright, changelog install * fix lintian overrides install * comp_type static fix and remove debug logs * fix lintian errors in rdc and remove logs from roctracer * lintian error fix rocprofiler * fix lintian error * mmove lintian overrides install * lintian errors fix * move lintian overrides install * use changelog already provided by rdc * fix formatting use existing changelog if provided * fix formatting use changelog in rocprofiler * remove overrides. Use existing changelog and copyright * resolve merge conflict * update license for hsa-rocr. Use NCSA license * install license * install license [rocm-systems] ROCm/rocm-systems#1578 (commit 6b8aae3)
1 parent 70d4bad commit 2de33d0

File tree

3 files changed

+121
-1
lines changed

3 files changed

+121
-1
lines changed

CMakeLists.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
#
2424
cmake_minimum_required(VERSION 3.15)
2525

26+
set( COMP_TYPE "runtime" )
27+
set( BUILD_ENABLE_LINTIAN_OVERRIDES ON CACHE BOOL "Enable/Disable Lintian Overrides" )
28+
set( BUILD_DEBIAN_PKGING_FLAG ON CACHE BOOL "Internal Status Flag to indicate Debian Packaging Build" )
2629
set(RDC "rdc" CACHE INTERNAL "")
2730
set(RDC_PACKAGE ${RDC} CACHE STRING "")
2831

@@ -164,9 +167,11 @@ set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} /usr/lib64 /usr/lib/x86_64-linux-gn
164167

165168
# configure packaging
166169
# cpack version is populated with CMAKE_PROJECT_VERSION implicitly
170+
set(PKG_MAINTAINER_NM "RDC Support")
171+
set(PKG_MAINTAINER_EMAIL "rdc.support@amd.com")
167172
set(CPACK_PACKAGE_NAME ${RDC_PACKAGE} CACHE INTERNAL "")
168173
set(CPACK_PACKAGE_VENDOR "Advanced Micro Devices, Inc." CACHE STRING "")
169-
set(CPACK_PACKAGE_CONTACT "RDC Support <rdc.support@amd.com>" CACHE STRING "")
174+
set(CPACK_PACKAGE_CONTACT "${PKG_MAINTAINER_NM} <${PKG_MAINTAINER_EMAIL}>")
170175
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Radeon Data Center Tools" CACHE STRING "")
171176
set(CPACK_PACKAGE_DESCRIPTION
172177
"This package contains the AMD ${CPACK_PACKAGE_DESCRIPTION_SUMMARY}."
@@ -560,6 +565,8 @@ set(CPACK_RPM_RUNTIME_POST_UNINSTALL_SCRIPT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/RP
560565
set(CPACK_DEBIAN_RUNTIME_PACKAGE_NAME "${CPACK_PACKAGE_NAME}")
561566
set(CPACK_RPM_RUNTIME_PACKAGE_NAME "${CPACK_PACKAGE_NAME}")
562567

568+
configure_pkg( ${RDC} ${COMP_TYPE} ${CPACK_PACKAGE_VERSION} ${PKG_MAINTAINER_NM} ${PKG_MAINTAINER_EMAIL} )
569+
563570
include(CPack)
564571

565572
# rdc package, no postfix

DEBIAN/copyright.in

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
2+
Upstream-Name: @DEB_PACKAGE_NAME@
3+
Upstream-Contact: @DEB_MAINTAINER_NAME@ <@DEB_MAINTAINER_EMAIL@>
4+
Source: https://github.com/ROCm/@DEB_PACKAGE_NAME@
5+
Files: *
6+
License: @DEB_LICENSE@
7+
Copyright: @DEB_COPYRIGHT_YEAR@ Advanced Micro Devices, Inc. All rights Reserved.
8+
9+
Permission is hereby granted, free of charge, to any person obtaining a copy
10+
of this software and associated documentation files (the "Software"), to deal
11+
in the Software without restriction, including without limitation the rights
12+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13+
copies of the Software, and to permit persons to whom the Software is
14+
furnished to do so, subject to the following conditions:
15+
16+
The above copyright notice and this permission notice shall be included in all
17+
copies or substantial portions of the Software.
18+
19+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25+
SOFTWARE.

cmake_modules/utils.cmake

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,3 +124,91 @@ function(num_change_since_prev_pkg VERSION_PREFIX)
124124
set(NUM_COMMITS "unknown" PARENT_SCOPE)
125125
endif()
126126
endfunction()
127+
128+
## Configure Copyright File for Debian Package
129+
function( configure_pkg PACKAGE_NAME_T COMPONENT_NAME_T PACKAGE_VERSION_T MAINTAINER_NM_T MAINTAINER_EMAIL_T)
130+
# Check If Debian Platform
131+
find_file (DEBIAN debian_version debconf.conf PATHS /etc)
132+
if(DEBIAN)
133+
set( BUILD_DEBIAN_PKGING_FLAG ON CACHE BOOL "Internal Status Flag to indicate Debian Packaging Build" FORCE )
134+
set_debian_pkg_cmake_flags( ${PACKAGE_NAME_T} ${PACKAGE_VERSION_T}
135+
${MAINTAINER_NM_T} ${MAINTAINER_EMAIL_T} )
136+
137+
# Create debian directory in build tree
138+
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/DEBIAN")
139+
140+
# Configure the copyright file
141+
configure_file(
142+
"${CMAKE_SOURCE_DIR}/DEBIAN/copyright.in"
143+
"${CMAKE_BINARY_DIR}/DEBIAN/copyright"
144+
@ONLY
145+
)
146+
147+
# Install copyright file
148+
install ( FILES "${CMAKE_BINARY_DIR}/DEBIAN/copyright"
149+
DESTINATION "${CMAKE_INSTALL_DOCDIR}"
150+
COMPONENT ${COMPONENT_NAME_T} )
151+
152+
# Configure the changelog file
153+
configure_file(
154+
"${CMAKE_SOURCE_DIR}/CHANGELOG.md"
155+
"${CMAKE_BINARY_DIR}/DEBIAN/CHANGELOG.md"
156+
@ONLY
157+
)
158+
159+
# Install Change Log
160+
find_program ( DEB_GZIP_EXEC gzip )
161+
if(EXISTS "${CMAKE_BINARY_DIR}/DEBIAN/CHANGELOG.md" )
162+
execute_process(
163+
COMMAND ${DEB_GZIP_EXEC} -f -n -9 "${CMAKE_BINARY_DIR}/DEBIAN/CHANGELOG.md"
164+
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/DEBIAN"
165+
RESULT_VARIABLE result
166+
OUTPUT_VARIABLE output
167+
ERROR_VARIABLE error
168+
)
169+
if(NOT ${result} EQUAL 0)
170+
message(FATAL_ERROR "Failed to compress: ${error}")
171+
endif()
172+
install ( FILES "${CMAKE_BINARY_DIR}/DEBIAN/${DEB_CHANGELOG_INSTALL_FILENM}"
173+
DESTINATION ${CMAKE_INSTALL_DOCDIR}
174+
COMPONENT ${COMPONENT_NAME_T})
175+
endif()
176+
177+
else()
178+
# License file
179+
install ( FILES ${LICENSE_FILE}
180+
DESTINATION ${CMAKE_INSTALL_DOCDIR} RENAME LICENSE.txt
181+
COMPONENT ${COMPONENT_NAME_T})
182+
endif()
183+
endfunction()
184+
185+
# Set variables for changelog and copyright
186+
# For Debian specific Packages
187+
function( set_debian_pkg_cmake_flags DEB_PACKAGE_NAME_T DEB_PACKAGE_VERSION_T DEB_MAINTAINER_NM_T DEB_MAINTAINER_EMAIL_T )
188+
# Setting configure flags
189+
set( DEB_PACKAGE_NAME "${DEB_PACKAGE_NAME_T}" CACHE STRING "Debian Package Name" )
190+
set( DEB_PACKAGE_VERSION "${DEB_PACKAGE_VERSION_T}" CACHE STRING "Debian Package Version String" )
191+
set( DEB_MAINTAINER_NAME "${DEB_MAINTAINER_NM_T}" CACHE STRING "Debian Package Maintainer Name" )
192+
set( DEB_MAINTAINER_EMAIL "${DEB_MAINTAINER_EMAIL_T}" CACHE STRING "Debian Package Maintainer Email" )
193+
set( DEB_COPYRIGHT_YEAR "2025" CACHE STRING "Debian Package Copyright Year" )
194+
set( DEB_LICENSE "MIT" CACHE STRING "Debian Package License Type" )
195+
set( DEB_CHANGELOG_INSTALL_FILENM "CHANGELOG.md.gz" CACHE STRING "Debian Package ChangeLog File Name" )
196+
197+
# Get TimeStamp
198+
find_program( DEB_DATE_TIMESTAMP_EXEC date )
199+
set ( DEB_TIMESTAMP_FORMAT_OPTION "-R" )
200+
execute_process (
201+
COMMAND ${DEB_DATE_TIMESTAMP_EXEC} ${DEB_TIMESTAMP_FORMAT_OPTION}
202+
OUTPUT_VARIABLE TIMESTAMP_T
203+
)
204+
set( DEB_TIMESTAMP "${TIMESTAMP_T}" CACHE STRING "Current Time Stamp for Copyright/Changelog" )
205+
206+
message(STATUS "DEB_PACKAGE_NAME : ${DEB_PACKAGE_NAME}" )
207+
message(STATUS "DEB_PACKAGE_VERSION : ${DEB_PACKAGE_VERSION}" )
208+
message(STATUS "DEB_MAINTAINER_NAME : ${DEB_MAINTAINER_NAME}" )
209+
message(STATUS "DEB_MAINTAINER_EMAIL : ${DEB_MAINTAINER_EMAIL}" )
210+
message(STATUS "DEB_COPYRIGHT_YEAR : ${DEB_COPYRIGHT_YEAR}" )
211+
message(STATUS "DEB_LICENSE : ${DEB_LICENSE}" )
212+
message(STATUS "DEB_TIMESTAMP : ${DEB_TIMESTAMP}" )
213+
message(STATUS "DEB_CHANGELOG_INSTALL_FILENM : ${DEB_CHANGELOG_INSTALL_FILENM}" )
214+
endfunction()

0 commit comments

Comments
 (0)