Create DA RPM
authoragrigora <alina.grigoras@cern.ch>
Mon, 1 Dec 2014 17:51:48 +0000 (18:51 +0100)
committeragrigora <alina.grigoras@cern.ch>
Mon, 15 Dec 2014 12:52:03 +0000 (13:52 +0100)
CMakeLists.txt
PMD/DA/CMakeLists.txt
PMD/DA/PMDGAINda.cxx
PMD/DA/PMDPEDESTALda.cxx
cmake/CMakeALICE.cmake
cmake/CheckGitVersion.cmake
cmake/da.spec.in [new file with mode: 0644]

index 4d82ec9..899f4f6 100644 (file)
@@ -22,7 +22,17 @@ cmake_minimum_required(VERSION 2.8.11 FATAL_ERROR)
 project(AliRoot CXX C)
 
 # Path to additonal modules
-set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
+set(CMAKE_MODULE_PATH "${AliRoot_SOURCE_DIR}/cmake")
+
+# AliRoot version extracted from Git repository
+# Sets 4 git variables
+#  - GIT_REFSPEC - complete name of the current reference
+#  - ALIROOT_BRANCH - name of the branch or tag extracted from the current reference
+#  - GIT_SHA1 - current hash in the long format
+#  - GIT_SHORT_SHA1 - current hash in the short format
+#  - ALIROOT_VERSION = ALIROOT_BRANCH
+#  - ALIROOT_REVISION = GIT_SHORT_SHA1
+include(CheckGitVersion)
 
 #       - CLANG_MAJOR.CLANG_MINOR or
 #       - GCC_MAJOR.GCC_MINOR.GCC_PATCH
@@ -150,14 +160,6 @@ find_package(FASTJET)
 # ZEROMQ
 find_package(ZeroMQ)
 
-# AliRoot version extracted from Git repository
-# Sets 4 git variables
-#  - GIT_REFSPEC - complete name of the current reference
-#  - ALIROOT_BRANCH - name of the branch or tag extracted from the current reference
-#  - GIT_SHA1 - current hash in the long format
-#  - GIT_SHORT_SHA1 - current hash in the short format
-include(CheckGitVersion)
-
 message(STATUS "CMake platform: ${CMAKE_SYSTEM}")
 message(STATUS "Build folder: ${AliRoot_BINARY_DIR}")
 message(STATUS "Source folder: ${AliRoot_SOURCE_DIR}")
index 9decdf6..5f0072c 100644 (file)
@@ -44,6 +44,8 @@ include_directories(${AMORE_INCLUDE_DIR})
 add_executable(PMDGAINda PMDGAINda.cxx) # 1
 add_executable(PMDPEDESTALda PMDPEDESTALda.cxx) # 2
 
+# Da information
+
 set(MODULE_COMPILE_FLAGS)
 set(MODULE_LINK_FLAGS)
 
@@ -61,4 +63,10 @@ set_target_properties(PMDPEDESTALda PROPERTIES COMPILE_FLAGS ${MODULE_COMPILE_FL
 set_target_properties(PMDPEDESTALda PROPERTIES LINK_FLAGS "${MODULE_LINK_FLAGS}")
 
 # Installation
-install(TARGETS PMDGAINda PMDPEDESTALda RUNTIME DESTINATION bin)
\ No newline at end of file
+install(TARGETS PMDGAINda RUNTIME DESTINATION bin COMPONENT PMDGAIN)
+install(TARGETS PMDPEDESTALda RUNTIME DESTINATION bin COMPONENT PMDPEDESTAL)
+
+if(DARPM)
+    createDArpm("PMD" "GAIN")
+    createDArpm("PMD" "PEDESTAL")
+endif(DARPM)
\ No newline at end of file
index 2a925b1..a89fa2a 100644 (file)
@@ -1,9 +1,9 @@
 /*
 PMD DA for online calibration
 
-contact: basanta@iitb.ac.in, Satyajit.Jena@cern.ch
+Contact: basanta@iitb.ac.in, Satyajit.Jena@cern.ch
 Link: https://twiki.cern.ch/twiki/bin/view/ALICE/DA
-Reference run:/afs/cern.ch/user/s/sjena/public/run83496.raw
+Reference Run:/afs/cern.ch/user/s/sjena/public/run83496.raw
 Run Type: PHYSICS
 DA Type: MON
 Number of events needed: 1 million for PB+PB, 200 milion for p+p
index 13f42d1..52e0170 100644 (file)
@@ -1,7 +1,7 @@
 /*
 PMD DA for online calibration
 
-contact: basanta@iitb.ac.in, Satyajit.Jena@cern.ch
+Contact: basanta@iitb.ac.in, Satyajit.Jena@cern.ch
 Link: https://twiki.cern.ch/twiki/bin/view/ALICE/DA
 Reference Run:/afs/cern.ch/user/s/sjena/public/run83496.raw
 Run Type: PEDESTAL
index 05f0a7a..27a6e39 100644 (file)
 
 # General purpose functions
 
+#########################
+# ROOT utilities
+#########################
+
 # Generation of the dictionaries
 # @DNAME  Dictionary name
 # @LDNAME LinkDef file name, ex: LinkDef.h
@@ -81,6 +85,10 @@ macro(generate_rootmap LIBNAME LIBDEPS LINKDEF)
     
 endmacro(generate_rootmap)
 
+#########################
+# Static utilities
+#########################
+
 # Generate the static dependecies from dynamic list
 # @ shared_list - list of shared libraries
 # @ static_list - the name of the variable that will contain the list of static libraries
@@ -94,4 +102,48 @@ macro(generate_static_dependencies shared_list static_list)
     set(${static_list} ${static_list_tmp})
     # set the scope to parent in order to be visible in the parent
     set(${static_list} PARENT_SCOPE)
-endmacro(generate_static_dependencies)
\ No newline at end of file
+endmacro(generate_static_dependencies)
+
+#########################
+# DA utilities
+#########################
+# Extract DA information to be inserted into the rpm
+function(getDAinfo _info _detector _daname info)
+    file(STRINGS "${_detector}${_daname}da.cxx" tmpinfo REGEX "${info}:")
+    string(REPLACE "${info}:\ " "" tmpinfo ${tmpinfo})
+    set(${_info} ${tmpinfo} PARENT_SCOPE)
+endfunction()
+
+# DA rpm creation
+macro(createDArpm DETECTOR ALGORITHM)
+    getDAinfo(contact "${DETECTOR}" "${ALGORITHM}" "Contact")
+    getDAinfo(link "${DETECTOR}" "${ALGORITHM}" "Link")
+    getDAinfo(refrun "${DETECTOR}" "${ALGORITHM}" "Reference Run")
+    getDAinfo(runtype "${DETECTOR}" "${ALGORITHM}" "Run Type")
+    getDAinfo(datype "${DETECTOR}" "${ALGORITHM}" "DA Type")
+    getDAinfo(evennr "${DETECTOR}" "${ALGORITHM}" "Number of events needed")
+    getDAinfo(ifiles "${DETECTOR}" "${ALGORITHM}" "Input Files")
+    getDAinfo(ofiles "${DETECTOR}" "${ALGORITHM}" "Output Files")
+    getDAinfo(trigger "${DETECTOR}" "${ALGORITHM}" "Trigger types used")
+    set(RPM_DESCRIPTION "contact: ${contact}
+Link:${link}
+Reference run:${refrun}
+Run Type:${runtype}
+DA Type:${datype}
+Number of events needed: ${evennr}
+Input Files:${ifiles}
+Output Files:${ofiles}
+Trigger types used:${trigger}")
+
+    set(DA_EXECUTABLE "${DETECTOR}${ALGORITHM}da")
+    set(DETECTOR ${DETECTOR})
+    set(ALGORITHM ${ALGORITHM})
+    configure_file("${AliRoot_SOURCE_DIR}/cmake/da.spec.in" "${CMAKE_CURRENT_BINARY_DIR}/${ALGORITHM}-da.spec" @ONLY)
+
+    add_custom_command(TARGET ${DETECTOR}${ALGORITHM}da POST_BUILD
+                       COMMAND mkdir ARGS -p da-${ALGORITHM}-rpm/opt/daqDA-${DETECTOR}-${ALGORITHM}/
+                       COMMAND cp ARGS ${DETECTOR}${ALGORITHM}da da-${ALGORITHM}-rpm/opt/daqDA-${DETECTOR}-${ALGORITHM}/
+                       COMMAND rpmbuild ARGS --verbose --define "_topdir ${CMAKE_CURRENT_BINARY_DIR}" --define "%buildroot ${CMAKE_CURRENT_BINARY_DIR}/da-${ALGORITHM}-rpm" -bb ${ALGORITHM}-da.spec
+                       WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} VERBATIM
+    )
+endmacro()
\ No newline at end of file
index 946d7bd..5fdc122 100644 (file)
@@ -62,6 +62,9 @@ if(EXISTS ${PROJECT_SOURCE_DIR}/.git/)
 
         set(ALIROOT_BRANCH ${SHORT_BRANCH})
         set(ALIROOT_VERSION ${SHORT_BRANCH})
+        
+        # Replace - with . for rpm creation
+        string(REPLACE "-" "." ALIROOT_VERSION_RPM ${ALIROOT_VERSION})
 
         message(STATUS "Aliroot branch/tag: \"${ALIROOT_VERSION}\" - Revision:  \"${GIT_SHORT_SHA1}\" ")
 
diff --git a/cmake/da.spec.in b/cmake/da.spec.in
new file mode 100644 (file)
index 0000000..6eaba25
--- /dev/null
@@ -0,0 +1,32 @@
+# RPM specfile for  Detector Algorithm
+Summary: @DETECTOR@ Detector Algorithm
+Name: daqDA-@DETECTOR@-@ALGORITHM@
+Version: @ALIROOT_VERSION_RPM@
+Release: @GIT_SHORT_SHA1@
+License: CERN Alice DAQ/Offine
+Group: Applications/Alice
+Prefix: /opt/%{name}
+BuildRoot: /@CMAKE_CURRENT_BINARY_DIR@/da-@ALGORITHM@-rpm
+
+# automatic dependencies
+AutoReqProv: yes
+
+# list here required RPM packages for compilation
+BuildRequires: date
+
+# list here required RPM packages for runtime
+Requires: date, daqDA-lib
+
+# You can specify other dependencies in the description tag below.
+
+# description of the package
+%description
+@RPM_DESCRIPTION@
+
+# Turning off the Fascist build policy
+%define _unpackaged_files_terminate_build 0
+
+# list of files to be installed
+%files
+%defattr (-,root,root)
+%{prefix}/@DA_EXECUTABLE@
\ No newline at end of file