diff options
-rw-r--r-- | CMakeLists.txt | 36 | ||||
-rw-r--r-- | docker/alpine-3.17.Dockerfile | 2 | ||||
-rw-r--r-- | docker/centos-8.Dockerfile | 4 | ||||
-rw-r--r-- | docker/rocky-8.6.Dockerfile | 4 | ||||
-rw-r--r-- | docker/ubuntu-20.04.Dockerfile | 4 | ||||
-rw-r--r-- | docker/ubuntu-22.04.Dockerfile | 4 | ||||
-rw-r--r-- | test/test_e2e.py | 1 | ||||
-rw-r--r-- | test/util.py | 3 |
8 files changed, 25 insertions, 33 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index b156411..4a344a0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,6 +32,7 @@ if (BUILD_STATIC) endif() + # add libssh static library set(CMAKE_POLICY_DEFAULT_CMP0077 NEW) set(WITH_SERVER OFF) @@ -47,26 +48,30 @@ add_subdirectory(libssh EXCLUDE_FROM_ALL) - - - +# setup mscp compile options set(MSCP_COMPILE_OPTS -iquote ${CMAKE_CURRENT_BINARY_DIR}/libssh/include) set(MSCP_BUILD_INCLUDE_DIRS ${mscp_SOURCE_DIR}/src ${CMAKE_CURRENT_BINARY_DIR}/libssh/include) - +set(MSCP_LINK_LIBS ssh-static) +if(BUILD_CONAN) + find_package(ZLIB REQUIRED) + find_package(OpenSSL REQUIRED) + list(APPEND MSCP_LINK_LIBS ZLIB::ZLIB) + list(APPEND MSCP_LINK_LIBS OpenSSL::Crypto) +endif() set(LIBMSCP_SRC src/mscp.c src/ssh.c src/path.c src/platform.c src/message.c) -# shared libmscp +# libmscp.so add_library(mscp-shared SHARED ${LIBMSCP_SRC}) target_include_directories(mscp-shared PUBLIC $<BUILD_INTERFACE:${mscp_SOURCE_DIR}/include> $<INSTALL_INTERFACE:include> PRIVATE ${MSCP_BUILD_INCLUDE_DIRS}) target_compile_options(mscp-shared PRIVATE ${MSCP_COMPILE_OPTS}) -target_link_libraries(mscp-shared PRIVATE ssh-static) +target_link_libraries(mscp-shared PRIVATE ${MSCP_LINK_LIBS}) set_target_properties(mscp-shared PROPERTIES OUTPUT_NAME mscp @@ -75,12 +80,12 @@ set_target_properties(mscp-shared install(TARGETS mscp-shared) -# static libmscp +# libmscp.a add_library(mscp-static STATIC ${LIBMSCP_SRC}) target_include_directories(mscp-static PRIVATE ${MSCP_BUILD_INCLUDE_DIRS} ${mscp_SOURCE_DIR}/include) target_compile_options(mscp-static PRIVATE ${MSCP_COMPILE_OPTS}) -target_link_libraries(mscp-static PRIVATE ssh-static) +target_link_libraries(mscp-static PRIVATE ${MSCP_LINK_LIBS}) set_target_properties(mscp-static PROPERTIES OUTPUT_NAME mscp) @@ -88,23 +93,12 @@ set_target_properties(mscp-static install(TARGETS mscp-static) - -set(MSCP_LINK_LIBS m pthread) -set(MSCP_LINK_DIRS "") -list(APPEND MSCP_LINK_LIBS ssh-static) - -if(BUILD_CONAN) - find_package(ZLIB REQUIRED) - find_package(OpenSSL REQUIRED) - list(APPEND MSCP_LINK_LIBS ZLIB::ZLIB) - list(APPEND MSCP_LINK_LIBS OpenSSL::Crypto) -endif() - # mscp executable +list(APPEND MSCP_LINK_LIBS m pthread) + add_executable(mscp src/main.c) target_include_directories(mscp PRIVATE ${MSCP_BUILD_INCLUDE_DIRS} ${mscp_SOURCE_DIR}/include) -target_link_directories(mscp PRIVATE ${MSCP_LINK_DIRS}) target_link_libraries(mscp mscp-static ${MSCP_LINK_LIBS}) if (BUILD_STATIC) target_link_options(mscp PRIVATE -static) diff --git a/docker/alpine-3.17.Dockerfile b/docker/alpine-3.17.Dockerfile index 56c7ba9..bf5679e 100644 --- a/docker/alpine-3.17.Dockerfile +++ b/docker/alpine-3.17.Dockerfile @@ -10,7 +10,7 @@ RUN apk add --no-cache \ gcc make cmake python3 py3-pip perl linux-headers libc-dev \ openssh bash python3-dev g++ -RUN pip3 install conan pytest numpy +RUN pip3 install conan pytest # Build mscp as a single binary RUN conan profile detect --force diff --git a/docker/centos-8.Dockerfile b/docker/centos-8.Dockerfile index 586b1e9..d9a4f20 100644 --- a/docker/centos-8.Dockerfile +++ b/docker/centos-8.Dockerfile @@ -9,11 +9,11 @@ RUN cd /etc/yum.repos.d/ RUN sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* RUN sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-* -# install numpy and pytest, sshd for test, and rpm-build +# install pytest, sshd for test, and rpm-build RUN set -ex && yum -y update && yum -y install \ python3 python3-pip openssh openssh-server openssh-clients rpm-build -RUN python3 -m pip install numpy pytest +RUN python3 -m pip install pytest # preparation for sshd diff --git a/docker/rocky-8.6.Dockerfile b/docker/rocky-8.6.Dockerfile index 323129c..abb2cf5 100644 --- a/docker/rocky-8.6.Dockerfile +++ b/docker/rocky-8.6.Dockerfile @@ -4,11 +4,11 @@ ARG mscpdir="/mscp" COPY . ${mscpdir} -# install numpy and pytest, sshd for test, and rpm-build +# install pytest, sshd for test, and rpm-build RUN set -ex && yum -y install \ python3 python3-pip openssh openssh-server openssh-clients rpm-build -RUN python3 -m pip install numpy pytest +RUN python3 -m pip install pytest # preparation for sshd diff --git a/docker/ubuntu-20.04.Dockerfile b/docker/ubuntu-20.04.Dockerfile index 0ca4148..e1dac03 100644 --- a/docker/ubuntu-20.04.Dockerfile +++ b/docker/ubuntu-20.04.Dockerfile @@ -8,11 +8,11 @@ COPY . ${mscpdir} RUN set -ex && apt-get update && apt-get install -y --no-install-recommends \ ca-certificates -# install numpy and pytest, and sshd for test +# install pytest, and sshd for test RUN apt-get install -y --no-install-recommends \ python3 python3-pip openssh-server -RUN python3 -m pip install numpy pytest +RUN python3 -m pip install pytest # preparation for sshd diff --git a/docker/ubuntu-22.04.Dockerfile b/docker/ubuntu-22.04.Dockerfile index c00f695..26ba009 100644 --- a/docker/ubuntu-22.04.Dockerfile +++ b/docker/ubuntu-22.04.Dockerfile @@ -8,11 +8,11 @@ COPY . ${mscpdir} RUN set -ex && apt-get update && apt-get install -y --no-install-recommends \ ca-certificates -# install numpy and pytest, and sshd for test +# install pytest, and sshd for test RUN apt-get install -y --no-install-recommends \ python3 python3-pip openssh-server -RUN python3 -m pip install numpy pytest +RUN python3 -m pip install pytest # preparation for sshd diff --git a/test/test_e2e.py b/test/test_e2e.py index 0add868..66c6f63 100644 --- a/test/test_e2e.py +++ b/test/test_e2e.py @@ -1,6 +1,5 @@ import pytest -import numpy import hashlib import os diff --git a/test/util.py b/test/util.py index 76ac49e..ef68ca9 100644 --- a/test/util.py +++ b/test/util.py @@ -1,6 +1,5 @@ import hashlib -import numpy import os @@ -39,7 +38,7 @@ class File(): def make_content_random(self): with open(self.path, "wb") as f: - f.write(numpy.random.bytes(self.size)) + f.write(os.urandom(self.size)) def cleanup(self): os.remove(self.path) |