From 3d00025d758d14910814c35a20db716f23b4772f Mon Sep 17 00:00:00 2001 From: Lukasz Kostyra Date: Thu, 20 Mar 2014 10:10:41 +0100 Subject: [PATCH] Install scripts using CMakeLists. Correct script names. [Issue#] N/A [Bug] N/A [Cause] Colorizing scripts were installed using .spec file. Script names were not conveniently named [Solution] Install scripts using CMake commands. Rename scripts. [Verification] Build, install, run sc_all_tests.py. Result shouldn't change. Change-Id: Ie6926dbe76a0346f557ddbf6274ca13fa1ae9039 --- CMakeLists.txt | 5 +++++ packaging/security-containers.spec | 21 +++++--------------- src/CMakeLists.txt | 3 ++- src/scripts/CMakeLists.txt | 23 ++++++++++++++++++++++ src/scripts/{sc_tests_all.py => sc_all_tests.py} | 4 ++-- .../{sc_test_launch.py => sc_launch_test.py} | 0 6 files changed, 37 insertions(+), 19 deletions(-) create mode 100644 src/scripts/CMakeLists.txt rename src/scripts/{sc_tests_all.py => sc_all_tests.py} (68%) rename src/scripts/{sc_test_launch.py => sc_launch_test.py} (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index e50ece2..a2b27f6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,6 +55,11 @@ ADD_DEFINITIONS(-DPROGRAM_VERSION="${VERSION}") ## Subdirectories ############################################################## SET(CLIENT_FOLDER ${PROJECT_SOURCE_DIR}/src/client) SET(SERVER_FOLDER ${PROJECT_SOURCE_DIR}/src/server) + +IF(NOT DEFINED SCRIPT_INSTALL_DIR) + SET(SCRIPT_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/sbin) +ENDIF(NOT DEFINED SCRIPT_INSTALL_DIR) + ADD_SUBDIRECTORY(src) diff --git a/packaging/security-containers.spec b/packaging/security-containers.spec index f385282..858a26a 100644 --- a/packaging/security-containers.spec +++ b/packaging/security-containers.spec @@ -1,5 +1,4 @@ -%define script_dir %{_libdir}/python/site-packages/sc_test_scripts/ -%define script_src_dir src/scripts +%define script_dir %{_sbindir} Name: security-containers Version: 0.1.0 @@ -38,22 +37,14 @@ between them. A process from inside a container can request a switch of context %endif %cmake . -DVERSION=%{version} \ - -DCMAKE_BUILD_TYPE=%{build_type} + -DCMAKE_BUILD_TYPE=%{build_type} \ + -DSCRIPT_INSTALL_DIR=%{script_dir} make -k %{?jobs:-j%jobs} %install %make_install mkdir -p %{buildroot}/etc/security-containers/config/libvirt-config/ -install -d %{buildroot}/%{_bindir} -install -d %{buildroot}/%{script_dir} -install -m 755 %{script_src_dir}/sc_tests_all.py %{buildroot}/%{script_dir} -install -m 755 %{script_src_dir}/sc_test_launch.py %{buildroot}/%{script_dir} -install -m 755 %{script_src_dir}/sc_test_parser.py %{buildroot}/%{script_dir} - -ln -sf %{script_dir}/sc_tests_all.py %{buildroot}/%{_bindir}/sc_tests_all -ln -sf %{script_dir}/sc_test_launch.py %{buildroot}/%{_bindir}/sc_test_launch - %clean rm -rf %{buildroot} @@ -105,10 +96,8 @@ Unit tests for both: server and client. %files unit-tests %defattr(644,root,root,644) %attr(755,root,root) %{_bindir}/security-containers-server-unit-tests -%attr(755,root,root) %{script_dir}/sc_tests_all.py -%attr(755,root,root) %{script_dir}/sc_test_launch.py +%attr(755,root,root) %{script_dir}/sc_all_tests.py +%attr(755,root,root) %{script_dir}/sc_launch_test.py %{script_dir}/sc_test_parser.py -%{_bindir}/sc_tests_all -%{_bindir}/sc_test_launch %config %attr(644,root,root) /etc/security-containers/config/tests/ut-scs-container-manager/test-daemon.conf %config %attr(644,root,root) /etc/security-containers/config/tests/ut-scs-container-manager/libvirt-config/*.xml diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 719d8b8..8a1f570 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -18,4 +18,5 @@ # ADD_SUBDIRECTORY(client) -ADD_SUBDIRECTORY(server) \ No newline at end of file +ADD_SUBDIRECTORY(server) +ADD_SUBDIRECTORY(scripts) diff --git a/src/scripts/CMakeLists.txt b/src/scripts/CMakeLists.txt new file mode 100644 index 0000000..248b106 --- /dev/null +++ b/src/scripts/CMakeLists.txt @@ -0,0 +1,23 @@ +# Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# +# @file CMakeLists.txt +# @author Lukasz Kostyra (l.kostyra@samsung.com) +# + +MESSAGE(STATUS "Installing scripts to " ${SCRIPT_INSTALL_DIR}) +FILE(GLOB_RECURSE scripts *.py) + +INSTALL(PROGRAMS ${scripts} DESTINATION ${SCRIPT_INSTALL_DIR}) diff --git a/src/scripts/sc_tests_all.py b/src/scripts/sc_all_tests.py similarity index 68% rename from src/scripts/sc_tests_all.py rename to src/scripts/sc_all_tests.py index bf52dad..99c67c9 100755 --- a/src/scripts/sc_tests_all.py +++ b/src/scripts/sc_all_tests.py @@ -1,10 +1,10 @@ #!/usr/bin/env python -import sc_test_launch +import sc_launch_test import sys # insert other test binaries to this array _testCmdTable = ["security-containers-server-unit-tests"] for test in _testCmdTable: - sc_test_launch.launchTest([test] + sys.argv[1:]) + sc_launch_test.launchTest([test] + sys.argv[1:]) diff --git a/src/scripts/sc_test_launch.py b/src/scripts/sc_launch_test.py similarity index 100% rename from src/scripts/sc_test_launch.py rename to src/scripts/sc_launch_test.py -- 2.7.4