Install scripts using CMakeLists. Correct script names.
authorLukasz Kostyra <l.kostyra@partner.samsung.com>
Thu, 20 Mar 2014 09:10:41 +0000 (10:10 +0100)
committerJan Olszak <j.olszak@samsung.com>
Mon, 19 May 2014 11:47:15 +0000 (13:47 +0200)
[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
packaging/security-containers.spec
src/CMakeLists.txt
src/scripts/CMakeLists.txt [new file with mode: 0644]
src/scripts/sc_all_tests.py [moved from src/scripts/sc_tests_all.py with 68% similarity]
src/scripts/sc_launch_test.py [moved from src/scripts/sc_test_launch.py with 100% similarity]

index e50ece2..a2b27f6 100644 (file)
@@ -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)
 
 
index f385282..858a26a 100644 (file)
@@ -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
index 719d8b8..8a1f570 100644 (file)
@@ -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 (file)
index 0000000..248b106
--- /dev/null
@@ -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})
similarity index 68%
rename from src/scripts/sc_tests_all.py
rename to src/scripts/sc_all_tests.py
index bf52dad..99c67c9 100755 (executable)
@@ -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:])