Commit c112f0fc authored by Eric Cano's avatar Eric Cano
Browse files

Merge branch 'castor'

Conflicts:
	.gitignore
parents a7cf049d c16bb966
nbproject/
/build/
\ No newline at end of file
/build/
# This file is part of the Castor project.
# See http://castor.web.cern.ch/castor
#
# Copyright (C) 2003 CERN
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
#
# @author Castor Dev team, castor-dev@cern.ch
#
################################################################################
# Project definition section - In source build forbidding
################################################################################
cmake_minimum_required (VERSION 2.6)
project(castor)
# Explicitly setting the C and C++ compiler flags for the RelWithDebInfo build
# in order to prevent the -O2 flag from being used.
#
# The CASTOR executables are not running short of CPU cycles. The extra
# effort required to debug released binaries compiled with the -O2 option is
# therefore not justified.
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-g")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g")
IF(NOT CMAKE_BUILD_TYPE STREQUAL "")
# If the user specifies -DCMAKE_BUILD_TYPE on the command line, take their definition and dump it in the cache
message(STATUS "Setting build type to ${CMAKE_BUILD_TYPE} as requested.")
SET(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "Choose the type of build.")
ELSE()
# log choosen default (RelWithDebInfo) and set it
message(STATUS "Setting build type to 'RelWithDebInfo' as none was specified.")
message (STATUS "Override with -DCMAKE_BUILD_TYPE:STRING=Debug")
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
# this command is not yet available in SLC6's cmake 2.6
# set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
ENDIF(NOT CMAKE_BUILD_TYPE STREQUAL "")
if ("${CMAKE_SOURCE_DIR}" MATCHES "${CMAKE_BINARY_DIR}")
message (SEND_ERROR "In source building not supported. Please run something like: \"mkdir ../build; ( src=`pwd`; cd ../build; cmake $src ); make -C ../build\"")
message (SEND_ERROR "Now that you reached that point you will unfortnately have to cleanup your source directory: \"rm -rf CMakeFiles/ CMakeCache.txt\". Sorry!")
return()
endif ("${CMAKE_SOURCE_DIR}" MATCHES "${CMAKE_BINARY_DIR}")
set(CMAKE_DISABLE_SOURCE_CHANGES ON)
set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
include(cmake/CASTORVersion.cmake)
# Generate the compilation variables, if needed
if (NOT DEFINED COMPILE_SERVER)
message (STATUS "Setting COMPILE_SERVER to the value of 1")
message (STATUS "Override with -DCOMPILE_SERVER:STRING=0")
set(COMPILE_SERVER 1)
else (NOT DEFINED COMPILE_SERVER)
message (STATUS "Already set: COMPILE_SERVER=${COMPILE_SERVER}")
endif (NOT DEFINED COMPILE_SERVER)
# Generate the compilation variables, if needed
if (NOT DEFINED SKIP_UNIT_TESTS)
message (STATUS "Setting SKIP_UNIT_TESTS to the value of 1")
message (STATUS "Override with -DSKIP_UNIT_TESTS:STRING=0")
set(SKIP_UNIT_TESTS 1)
else (NOT DEFINED SKIP_UNIT_TESTS)
message (STATUS "Already set: SKIP_UNIT_TESTS=${SKIP_UNIT_TESTS}")
endif (NOT DEFINED SKIP_UNIT_TESTS)
IF(DEFINED PackageOnly)
message (STATUS "Running CMake in package-only mode")
set(COMPILE_PACKAGING "1")
ELSE(DEFINED PackageOnly)
message (STATUS "Running in full configuration mode.")
message (STATUS "Override with -DPackageOnly:Bool=true")
# Generate the compilation variables, if needed
if (NOT DEFINED COMPILE_PACKAGING)
message (STATUS "Setting COMPILE_PACKAGING to the value of 1")
message (STATUS "Override with -DCOMPILE_PACKAGING:STRING=0")
set(COMPILE_PACKAGING 1)
else (NOT DEFINED COMPILE_PACKAGING)
message (STATUS "Already set: COMPILE_PACKAGING=${COMPILE_PACKAGING}")
endif (NOT DEFINED COMPILE_PACKAGING)
################################################################################
# Configure header file
################################################################################
configure_file(${CMAKE_SOURCE_DIR}/h/patchlevel.h.in
${CMAKE_BINARY_DIR}/h/patchlevel.h)
include(cmake/CASTORInstallationFunctions.cmake)
find_package (uuid REQUIRED)
find_package (python REQUIRED)
include_directories(${CMAKE_BINARY_DIR})
include_directories(${CMAKE_BINARY_DIR}/h)
include_directories(${CMAKE_SOURCE_DIR})
include_directories(${CMAKE_SOURCE_DIR}/h)
if (${COMPILE_SERVER} STREQUAL "1")
find_package (oracle REQUIRED)
function (CastorAddProC _name)
add_custom_command (
OUTPUT ${_name}.c DEPENDS ${_name}.pc
COMMAND
ORACLE_HOME=${ORACLE_HOME}
LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH}:${ORACLE_LIBDIR}
${ORACLE_BIN}/proc
iname=${CMAKE_CURRENT_SOURCE_DIR}/${_name}.pc
oname=${CMAKE_CURRENT_BINARY_DIR}/${_name}.c
${ORACLE_PROCINC}
include=${CMAKE_SOURCE_DIR}
include=${CMAKE_SOURCE_DIR}/h
threads=yes
char_map=string
parse=full
prefetch=1000)
# Append the oracle specific compilation flags and also use -Wno-error to
# override the default -Werror compilation rule in the case of source files
# produced by the Pro*C precompiler. Such files contain generated code that
# generates warnings.
set_property (SOURCE ${_name}.c
PROPERTY COMPILE_FLAGS "${ORACLE_CPPFLAGS} -Wno-error")
endfunction ()
endif (${COMPILE_SERVER} STREQUAL "1")
set (CMAKE_C_FLAGS "-fPIC -Wall -Wextra -Werror -Wno-unused-parameter")
if (APPLE)
set (CMAKE_SHARED_LINKER_FLAGS
"${CMAKE_SHARED_LINKER_FLAGS} -undefined dynamic_lookup")
else (APPLE)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread -Wl,--defsym,CastorVersion_v${CASTOR_VERSION}.${CASTOR_RELEASE}=0")
endif (APPLE)
#set (CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}")
set (CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -Wnon-virtual-dtor")
set_property (DIRECTORY PROPERTY COMPILE_DEFINITIONS _LARGEFILE64_SOURCE)
##############################################################################
# Rules to install the shared log and spool directories
##############################################################################
CastorInstallDir (/var/log/castor)
CastorInstallDir (/var/log/spool/castor)
##############################################################################
# Include the subdirectories of the project
##############################################################################
# Some directories have client components, and get included unconditionnaly
# inside them, we can filter further down what we need or not.
# The ones with only server components can already be filtered out for the
# clients builds here.
add_subdirectory (castor)
add_subdirectory (client/src/stager)
add_subdirectory (common)
add_subdirectory (dlf)
if (${COMPILE_SERVER} STREQUAL "1")
add_subdirectory (gridftp2)
add_subdirectory (ceph)
add_subdirectory (movers)
endif (${COMPILE_SERVER} STREQUAL "1")
add_subdirectory (h)
if (${COMPILE_SERVER} STREQUAL "1")
add_subdirectory (hsmtools)
add_subdirectory (monitoring)
endif (${COMPILE_SERVER} STREQUAL "1")
add_subdirectory (ns)
add_subdirectory (rfio)
add_subdirectory (rmc)
add_subdirectory (security)
add_subdirectory (shlib)
if (${COMPILE_SERVER} STREQUAL "1")
add_subdirectory (traffic-shaping)
endif (${COMPILE_SERVER} STREQUAL "1")
add_subdirectory (upv)
add_subdirectory (vdqm)
add_subdirectory (vmgr)
if (${COMPILE_SERVER} STREQUAL "1")
add_subdirectory (xrootd)
add_subdirectory (tape)
add_subdirectory (test)
endif (${COMPILE_SERVER} STREQUAL "1")
ENDIF(DEFINED PackageOnly)
################################################################################
# Packaging step (replacing the maketar)
# See http://www.vtk.org/Wiki/CMakeUserUseRPMTools
################################################################################
if (${COMPILE_PACKAGING} STREQUAL "1")
include(cmake/UseRPMToolsEnvironment.cmake)
set(CPACK_SOURCE_PACKAGE_FILE_NAME
"${PROJECT_NAME}-${CASTOR_VERSION}-${CASTOR_RELEASE}")
message (STATUS
"Setting package file name to: ${CPACK_SOURCE_PACKAGE_FILE_NAME}")
set(CPACK_SOURCE_IGNORE_FILES "/.git/")
include(CPack)
include(cmake/UseRPMTools.cmake)
if (RPMTools_FOUND)
message (STATUS "Generating spec file from debian package structure...")
execute_process (
COMMAND ./makespec.py
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_FILE ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.spec.in
OUTPUT_VARIABLE result)
if (NOT ${result} STREQUAL "")
string (REGEX REPLACE "\n$" "" result ${result})
message (STATUS "${result}")
endif (NOT ${result} STREQUAL "")
RPMTools_ADD_RPM_TARGETS(
${PROJECT_NAME} ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.spec.in)
endif (RPMTools_FOUND)
endif (${COMPILE_PACKAGING} STREQUAL "1")
#add_custom_target(test test/castorUnitTests
# COMMENT "Not running the unit tests" VERBATIM)
configure_file(test/castorThreadedUnitTests.supp test/castorThreadedUnitTests.supp COPYONLY)
add_custom_target(test test/castorUnitTests
#
COMMAND valgrind --track-fds=yes --leak-check=full --demangle=no --gen-suppressions=all --show-reachable=yes --error-exitcode=1 test/castorUnitTests
COMMAND test/castorThreadedUnitTests
COMMAND valgrind --track-fds=yes --leak-check=full --show-reachable=yes --error-exitcode=1 test/castorThreadedUnitTests
COMMAND valgrind --tool=helgrind -v --demangle=no --conflict-cache-size=30000000 --error-exitcode=1 test/castorThreadedUnitTests
COMMAND test/castorMultiprocessUnitTests
COMMAND valgrind --tool=helgrind --error-exitcode=1 test/castorMultiprocessUnitTests
DEPENDS test/castorUnitTests test/castorThreadedUnitTests test/castorMultiprocessUnitTests test/castorThreadedUnitTests.supp
COMMENT "Running unit tests" VERBATIM)
This diff is collapsed.
# Generic macros
#---------------
%define name castor
%define castorVersion @CASTOR_VERSION@
%define castorRelease @CASTOR_RELEASE@
# Partial compilations
#---------------------
%ifnarch x86_64
# server side is only supported on x86_64 / SLC6
%define compile_server 0
%else
%if "%{?dist}" == ".slc6" || "%{?dist}" == ".el6"
# rpmbuild --define "clientonly 1" ...
%if 0%{?clientonly:1} > 0
%define compile_server 0
%else
%define compile_server @COMPILE_SERVER@
%endif
%else
%define compile_server 0
%endif
%endif
# Neutral packaging (for srpm)
#-----------------------------
%if 0%{?neutralpackage:1} > 0
%define mydist %{nil}
%else
%define mydist %{?dist}
%endif
# Skipping unit tests (for developpers)
#--------------------------------------
%define skip_unit_tests @SKIP_UNIT_TESTS@
# General settings
#-----------------
Summary: Cern Advanced mass STORage
Name: %{name}
Version: %{castorVersion}
Release: %{castorRelease}%{mydist}
Source: %{name}-%{castorVersion}-%{castorRelease}.tar.gz
URL: http://cern.ch/castor
License: http://cern.ch/castor/DIST/CONDITIONS
Group: Application/Castor
BuildRoot: %{_builddir}/%{name}-%{version}-root
BuildRequires: cmake >= 2.6 redhat-rpm-config
# only build debug info if you're building the whole code
%if %compile_server
%else
%define debug_package %{nil}
%endif
%description
The CASTOR Project stands for CERN Advanced STORage Manager, and its goal is to handle LHC data in a fully distributed environment.
%prep
%setup -q -n %{name}-%{castorVersion}-%{castorRelease}
%build
%if 0%{?clientonly:1} > 0
# Suppress oracompile.py warnings in clientonly mode
export ORACOMPILE_OPTIONS="--quiet"
%endif
# define castor version (modified by maketar.sh to put the exact version)
MAJOR_CASTOR_VERSION=@MAJOR_CASTOR_VERSION@
MINOR_CASTOR_VERSION=@MINOR_CASTOR_VERSION@
export MAJOR_CASTOR_VERSION
export MINOR_CASTOR_VERSION
mkdir -p build
cd build
# The cmake step does the selection between client/server compilation or just client
MAJOR_CASTOR_VERSION=${MAJOR_CASTOR_VERSION} MINOR_CASTOR_VERSION=${MINOR_CASTOR_VERSION} cmake .. -DCOMPILE_PACKAGING:STRING=0 -DCOMPILE_SERVER:STRING=%{compile_server}
%{__make} -s %{_smp_mflags}
%install
# define castor version (modified by maketar.sh to put the exact version)
MAJOR_CASTOR_VERSION=@MAJOR_CASTOR_VERSION@
MINOR_CASTOR_VERSION=@MINOR_CASTOR_VERSION@
export MAJOR_CASTOR_VERSION
export MINOR_CASTOR_VERSION
%{__rm} -rf ${RPM_BUILD_ROOT}
cd build
%{__make} install DESTDIR=${RPM_BUILD_ROOT} EXPORTMAN=${RPM_BUILD_ROOT}/usr/share/man
%clean
%{__rm} -rf $RPM_BUILD_ROOT
%{__rm} -rf $RPM_BUILD_DIR/%{name}-%{version}
%check
%if 0%{compile_server} > 0
%if "%{skip_unit_tests}" == "0"
cd build
%{__make} test
%endif
%endif
# The following will be filled dynamically with the rule: makespec.py
/**** This file has been autogenerated by gencastor from Umbrello UML model ***/
/******************************************************************************
*
* This file is part of the Castor project.
* See http://castor.web.cern.ch/castor
*
* Copyright (C) 2003 CERN
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* @author Castor Dev team, castor-dev@cern.ch
*****************************************************************************/
// Include Files
#include "castor/BaseAddress.hpp"
#include "castor/Constants.hpp"
#include "castor/IObject.hpp"
#include "castor/ObjectSet.hpp"
#include "osdep.h"
#include <iostream>
#include <string>
//------------------------------------------------------------------------------
// Constructor
//------------------------------------------------------------------------------
castor::BaseAddress::BaseAddress() throw() :
m_objType(0),
m_cnvSvcName(""),
m_cnvSvcType(0),
m_target(0),
m_id(0) {
}
//------------------------------------------------------------------------------
// Destructor
//------------------------------------------------------------------------------
castor::BaseAddress::~BaseAddress() throw() {
}
//------------------------------------------------------------------------------
// print
//------------------------------------------------------------------------------
void castor::BaseAddress::print(std::ostream& stream,
std::string indent,
castor::ObjectSet& alreadyPrinted) const {
stream << indent << "[# BaseAddress #]" << std::endl;
if (alreadyPrinted.find(this) != alreadyPrinted.end()) {
// Circular dependency, this object was already printed
stream << indent << "Back pointer, see above" << std::endl;
return;
}
// Output of all members
stream << indent << "objType : " << m_objType << std::endl;
stream << indent << "cnvSvcName : " << m_cnvSvcName << std::endl;
stream << indent << "cnvSvcType : " << m_cnvSvcType << std::endl;
stream << indent << "target : " << m_target << std::endl;
stream << indent << "id : " << m_id << std::endl;
alreadyPrinted.insert(this);
}
//------------------------------------------------------------------------------
// print
//------------------------------------------------------------------------------
void castor::BaseAddress::print() const {
ObjectSet alreadyPrinted;
print(std::cout, "", alreadyPrinted);
}
//------------------------------------------------------------------------------
// TYPE
//------------------------------------------------------------------------------
int castor::BaseAddress::TYPE() {
return OBJ_BaseAddress;
}
//------------------------------------------------------------------------------
// type
//------------------------------------------------------------------------------
int castor::BaseAddress::type() const {
return TYPE();
}
//------------------------------------------------------------------------------
// clone
//------------------------------------------------------------------------------
castor::IObject* castor::BaseAddress::clone() {
return new BaseAddress(*this);
}
/**** This file has been autogenerated by gencastor from Umbrello UML model ***/
/******************************************************************************
*
* This file is part of the Castor project.
* See http://castor.web.cern.ch/castor
*
* Copyright (C) 2003 CERN
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* @author Castor Dev team, castor-dev@cern.ch
*****************************************************************************/
#pragma once
// Include Files
#include "castor/IAddress.hpp"
#include "osdep.h"
#include <iostream>
#include <string>
namespace castor {
// Forward declarations
class ObjectSet;
class IObject;
/**
* class BaseAddress
* The most basic address : only a type.
*/
class BaseAddress : public virtual IAddress {
public:
/**
* Empty Constructor
*/
BaseAddress() throw();
/**
* Empty Destructor
*/
virtual ~BaseAddress() throw();
/**
* Outputs this object in a human readable format
* @param stream The stream where to print this object
* @param indent The indentation to use
* @param alreadyPrinted The set of objects already printed.
* This is to avoid looping when printing circular dependencies
*/
virtual void print(std::ostream& stream,
std::string indent,
castor::ObjectSet& alreadyPrinted) const;
/**
* Outputs this object in a human readable format
*/
virtual void print() const;
/**
* Gets the type of this kind of objects
*/
static int TYPE();
/********************************************/
/* Implementation of IObject abstract class */
/********************************************/
/**
* Gets the type of the object
*/
virtual int type() const;
/**
* virtual method to clone any object
*/
virtual IObject* clone();
/*********************************/
/* End of IObject abstract class */
/*********************************/
/**
* Get the value of m_objType
* the object type of this address
* @return the value of m_objType
*/
unsigned int objType() const {
return m_objType;
}
/**
* Set the value of m_objType
* the object type of this address
* @param new_var the new value of m_objType
*/
void setObjType(unsigned int new_var) {
m_objType = new_var;
}
/**
* Get the value of m_cnvSvcName
* the name of the conversion service able to deal with this address
* @return the value of m_cnvSvcName
*/
std::string cnvSvcName() const {
return m_cnvSvcName;
}
/**
* Set the value of m_cnvSvcName
* the name of the conversion service able to deal with this address
* @param new_var the new value of m_cnvSvcName
*/
void setCnvSvcName(std::string new_var) {
m_cnvSvcName = new_var;
}
/**
* Get the value of m_cnvSvcType
* the type of the conversion service able to deal with this address
* @return the value of m_cnvSvcType
*/
unsigned int cnvSvcType() const {
return m_cnvSvcType;
}
/**
* Set the value of m_cnvSvcType
* the type of the conversion service able to deal with this address
* @param new_var the new value of m_cnvSvcType
*/
void setCnvSvcType(unsigned int new_var) {
m_cnvSvcType = new_var;
}
/**
* Get the value of m_target
* The id of the object this address points to, if any
* @return the value of m_target
*/
u_signed64 target() const {
return m_target;
}
/**
* Set the value of m_target
* The id of the object this address points to, if any