summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/release.yml14
-rw-r--r--CMakeLists.txt84
-rw-r--r--Dockerfile/.gitignore (renamed from docker/.gitignore)0
-rw-r--r--Dockerfile/README.md19
-rw-r--r--Dockerfile/almalinux-9.3.Dockerfile (renamed from docker/almalinux-8.8.Dockerfile)13
-rw-r--r--Dockerfile/alpine-3.19.Dockerfile (renamed from docker/alpine-3.17.Dockerfile)12
-rw-r--r--Dockerfile/build-deb.Dockerfile (renamed from docker/build-deb.Dockerfile)0
-rw-r--r--Dockerfile/build-srpm.Dockerfile (renamed from docker/build-srpm.Dockerfile)0
-rw-r--r--Dockerfile/build-srpm.Dockerfile.in (renamed from docker/build-srpm.Dockerfile.in)0
-rw-r--r--Dockerfile/rocky-8.9.Dockerfile29
-rw-r--r--Dockerfile/rocky-9.3.Dockerfile (renamed from docker/rocky-8.8.Dockerfile)7
-rw-r--r--Dockerfile/ubuntu-20.04.Dockerfile (renamed from docker/ubuntu-20.04.Dockerfile)5
-rw-r--r--Dockerfile/ubuntu-22.04.Dockerfile (renamed from docker/ubuntu-22.04.Dockerfile)6
-rw-r--r--docker/README.md37
-rwxr-xr-xscripts/print-install-deps.sh23
15 files changed, 93 insertions, 156 deletions
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 83af6fe..fbde9d8 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -33,22 +33,14 @@ jobs:
- name: Test
run: make -C ${{github.workspace}}/build docker-test-all
- - name: Retrieve packages from containers
- run: make -C ${{github.workspace}}/build docker-pkg-all
-
- - name: Copy mscp single binary built inside Alpine
- run: cp ${{github.workspace}}/build/mscp_alpine-3.17-x86_64.static ${{github.workspace}}/build/mscp.linux.x86.static
+ - name: Build single binary mscp
+ run: make -C ${{github.workspace}}/build build-single-binary
- name: Release
uses: softprops/action-gh-release@v1
with:
files: |
- ${{github.workspace}}/build/mscp_ubuntu-20.04-x86_64.deb
- ${{github.workspace}}/build/mscp_ubuntu-22.04-x86_64.deb
- ${{github.workspace}}/build/mscp_rocky-8.8-x86_64.rpm
- ${{github.workspace}}/build/mscp_almalinux-8.8-x86_64.rpm
- ${{github.workspace}}/build/mscp_alpine-3.17-x86_64.static
- ${{github.workspace}}/build/mscp.linux.x86.static
+ ${{github.workspace}}/build/mscp.linux.x86_64.static
source-release:
runs-on: ubuntu-latest
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 84b555b..3823291 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -141,51 +141,13 @@ enable_testing()
-# CPACK Rules
-#set(CPACK_SET_DESTDIR true)
-set(CPACK_PACKAGE_NAME ${PROJECT_NAME})
-set(CPACK_PACKAGE_CONTACT "Ryo Nakamura <upa@haeena.net>")
-set(CPACK_PACKAGE_DESCRIPTION
- "mscp, copy files over multiple ssh connections")
-
-execute_process(COMMAND uname -m
- OUTPUT_VARIABLE ARCH OUTPUT_STRIP_TRAILING_WHITESPACE)
-
-if(CMAKE_HOST_SYSTEM_NAME STREQUAL Linux)
- execute_process(COMMAND
- bash "-c" "cat /etc/os-release|grep '^ID='|cut -d '=' -f 2|tr -d '\"'"
- OUTPUT_VARIABLE DIST_NAME OUTPUT_STRIP_TRAILING_WHITESPACE)
- execute_process(COMMAND
- bash "-c" "cat /etc/os-release|grep '^VERSION_ID='|cut -d '=' -f 2|tr -d '\"'"
- OUTPUT_VARIABLE DIST_VER OUTPUT_STRIP_TRAILING_WHITESPACE)
- execute_process(COMMAND
- bash "-c" "${mscp_SOURCE_DIR}/scripts/print-install-deps.sh ${DIST_NAME}-${DIST_VER}"
- OUTPUT_VARIABLE DIST_DEP OUTPUT_STRIP_TRAILING_WHITESPACE)
-
- set(PACKAGE_FILE_NAME
- ${PROJECT_NAME}_${DIST_NAME}-${DIST_VER}-${ARCH})
-
- set(CPACK_DEBIAN_FILE_NAME ${PACKAGE_FILE_NAME}.deb)
- set(CPACK_DEBIAN_PACKAGE_DEPENDS ${DIST_DEP})
- set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://github.com/upa/mscp")
-
- set(CPACK_RPM_FILE_NAME ${PACKAGE_FILE_NAME}.rpm)
- set(CPACK_RPM_PACKAGE_REQUIRES ${DIST_DEP})
- set(CPACK_RPM_PACKAGE_HOMEPAGE "https://github.com/upa/mscp")
- set(CPACK_RPM_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION})
- set(CPACK_RPM_PACKAGE_LICENSE "GPLv3")
-endif() # on linux
-
-include(CPack)
-
-
# Custom targets to build and test mscp in docker containers.
# foreach(IN ZIP_LISTS) (cmake >= 3.17) can shorten the following lists.
# However, ubuntu 20.04 has cmake 3.16.3. So this is a roundabout trick.
-list(APPEND DIST_NAMES ubuntu ubuntu rocky almalinux alpine)
-list(APPEND DIST_VERS 20.04 22.04 8.8 8.8 3.17)
-list(APPEND DIST_PKGS deb deb rpm rpm static)
+list(APPEND DIST_NAMES ubuntu ubuntu rocky rocky almalinux alpine)
+list(APPEND DIST_VERS 20.04 22.04 8.9 9.3 9.3 3.19)
+list(APPEND DIST_PKGS deb deb rpm rpm rpm static)
list(LENGTH DIST_NAMES _DIST_LISTLEN)
math(EXPR DIST_LISTLEN "${_DIST_LISTLEN} - 1")
@@ -204,13 +166,13 @@ foreach(x RANGE ${DIST_LISTLEN})
COMMENT "Build mscp in ${DOCKER_IMAGE} container"
WORKING_DIRECTORY ${mscp_SOURCE_DIR}
COMMAND
- docker build -t ${DOCKER_IMAGE} -f docker/${DOCKER_INDEX}.Dockerfile .)
+ docker build -t ${DOCKER_IMAGE} -f Dockerfile/${DOCKER_INDEX}.Dockerfile .)
add_custom_target(docker-build-${DOCKER_INDEX}-no-cache
COMMENT "Build mscp in ${DOCKER_IMAGE} container"
WORKING_DIRECTORY ${mscp_SOURCE_DIR}
COMMAND
- docker build --no-cache -t ${DOCKER_IMAGE} -f docker/${DOCKER_INDEX}.Dockerfile .)
+ docker build --no-cache -t ${DOCKER_IMAGE} -f Dockerfile/${DOCKER_INDEX}.Dockerfile .)
add_custom_target(docker-test-${DOCKER_INDEX}
COMMENT "Test mscp in ${DOCKER_IMAGE} container"
@@ -219,26 +181,17 @@ foreach(x RANGE ${DIST_LISTLEN})
docker run --init --rm --sysctl net.ipv6.conf.all.disable_ipv6=0
${DOCKER_IMAGE} /mscp/scripts/test-in-container.sh)
- add_custom_target(docker-pkg-${DOCKER_INDEX}
- COMMENT "Retrieve mscp package from ${DOCKER_IMAGE} container"
- WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
- COMMAND
- docker run --rm -v ${CMAKE_BINARY_DIR}:/out ${DOCKER_IMAGE}
- cp /mscp/build/${PKG_FILE_NAME} /out/)
-
list(APPEND DOCKER_BUILDS docker-build-${DOCKER_INDEX})
list(APPEND DOCKER_BUILDS_NO_CACHE docker-build-${DOCKER_INDEX}-no-cache)
list(APPEND DOCKER_TESTS docker-test-${DOCKER_INDEX})
- list(APPEND DOCKER_PKGS docker-pkg-${DOCKER_INDEX})
endforeach()
add_custom_target(docker-build-all DEPENDS ${DOCKER_BUILDS})
add_custom_target(docker-build-all-no-cache DEPENDS ${DOCKER_BUILDS_NO_CACHE})
add_custom_target(docker-test-all DEPENDS ${DOCKER_TESTS})
-add_custom_target(docker-pkg-all DEPENDS ${DOCKER_PKGS})
-### debuild-related fefinitions
+### debuild-related definitions
set(DEBBUILDCONTAINER mscp-build-deb)
add_custom_target(build-deb
@@ -246,7 +199,7 @@ add_custom_target(build-deb
WORKING_DIRECTORY ${mscp_SOURCE_DIR}
BYPRODUCTS ${CMAKE_BINARY_DIR}/debbuild
COMMAND
- docker build -t ${DEBBUILDCONTAINER} -f docker/build-deb.Dockerfile .
+ docker build -t ${DEBBUILDCONTAINER} -f Dockerfile/build-deb.Dockerfile .
COMMAND
docker run --rm -v ${CMAKE_BINARY_DIR}:/out ${DEBBUILDCONTAINER}
cp -r /debbuild /out/)
@@ -260,11 +213,11 @@ configure_file(
${mscp_SOURCE_DIR}/rpm/mscp.spec
@ONLY)
configure_file(
- ${mscp_SOURCE_DIR}/docker/build-srpm.Dockerfile.in
- ${mscp_SOURCE_DIR}/docker/build-srpm.Dockerfile
+ ${mscp_SOURCE_DIR}/Dockerfile/build-srpm.Dockerfile.in
+ ${mscp_SOURCE_DIR}/Dockerfile/build-srpm.Dockerfile
@ONLY)
-# Custom targets to build mscp as a src.rpm in docker.
+# Custom target to build mscp as a src.rpm in docker.
set(RPMBUILDCONTAINER mscp-build-srpm)
set(SRPMFILE mscp-${MSCP_VERSION}-1.el9.src.rpm)
add_custom_target(build-srpm
@@ -272,9 +225,24 @@ add_custom_target(build-srpm
WORKING_DIRECTORY ${mscp_SOURCE_DIR}
BYPRODUCTS ${CMAKE_BINARY_DIR}/${SRPMFILE}
COMMAND
- docker build -t ${RPMBUILDCONTAINER} -f docker/build-srpm.Dockerfile .
+ docker build -t ${RPMBUILDCONTAINER} -f Dockerfile/build-srpm.Dockerfile .
COMMAND
docker run --rm -v ${CMAKE_BINARY_DIR}:/out ${RPMBUILDCONTAINER}
cp /root/rpmbuild/SRPMS/${SRPMFILE} /out/)
+### single-binary-build-related definitions
+
+# Custom target to get single binary mscp
+set(SINGLEBINARYFILE mscp.linux.${CMAKE_SYSTEM_PROCESSOR}.static)
+add_custom_target(build-single-binary
+ COMMENT "Build mscp as a single binary in alpine conatiner"
+ WORKING_DIRECTORY ${mscp_SOURCE_DIR}
+ BYPRODUCTS ${CMAKE_BINARY_DIR}/${SINGLEBINARYFILE}
+ DEPENDS docker-build-alpine-3.19
+ COMMAND
+ docker run --rm -v ${CMAKE_BINARY_DIR}:/out mscp-alpine:3.19
+ cp /mscp/build/mscp /out/${SINGLEBINARYFILE})
+
+add_custom_target(build-pkg-all
+ DEPENDS build-deb build-srpm build-single-binary)
diff --git a/docker/.gitignore b/Dockerfile/.gitignore
index f7083c9..f7083c9 100644
--- a/docker/.gitignore
+++ b/Dockerfile/.gitignore
diff --git a/Dockerfile/README.md b/Dockerfile/README.md
new file mode 100644
index 0000000..e901664
--- /dev/null
+++ b/Dockerfile/README.md
@@ -0,0 +1,19 @@
+
+Dockerfiles for building and testing mscp.
+
+Build container:
+
+```
+docker build -t mscp-DIST:VER -f docker/DIST-VER.Dockerfile .
+```
+
+Run test:
+
+```
+docker run --init --rm mscp-DST:VER /mscp/scripts/test-in-container.sh
+```
+
+`cmake` provides custom targets to build and test mscp in the
+containers. See `make docker-*` targets. `make docker-build-all`
+builds all container images and `make docker-test-all` runs the test
+in all container images. \ No newline at end of file
diff --git a/docker/almalinux-8.8.Dockerfile b/Dockerfile/almalinux-9.3.Dockerfile
index 5ff41ed..516fbd2 100644
--- a/docker/almalinux-8.8.Dockerfile
+++ b/Dockerfile/almalinux-9.3.Dockerfile
@@ -1,9 +1,7 @@
-FROM almalinux:8.8
+FROM almalinux:9.3
# install pytest, sshd for test, and rpm-build
-RUN set -ex && \
- rpm --import https://repo.almalinux.org/almalinux/RPM-GPG-KEY-AlmaLinux && \
- yum -y install \
+RUN set -ex && yum -y install \
python3 python3-pip python3-devel openssh openssh-server openssh-clients rpm-build
RUN python3 -m pip install pytest
@@ -15,7 +13,6 @@ RUN mkdir /var/run/sshd \
&& ssh-keygen -f /root/.ssh/id_rsa -N "" \
&& mv /root/.ssh/id_rsa.pub /root/.ssh/authorized_keys
-
ARG mscpdir="/mscp"
COPY . ${mscpdir}
@@ -28,7 +25,5 @@ RUN cd ${mscpdir} \
&& rm -rf build \
&& cmake -B build \
&& cd ${mscpdir}/build \
- && make \
- && cpack -G RPM CPackConfig.cmake \
- && rpm -iv *.rpm
-
+ && make -j 2 \
+ && make install
diff --git a/docker/alpine-3.17.Dockerfile b/Dockerfile/alpine-3.19.Dockerfile
index b79510f..a19957b 100644
--- a/docker/alpine-3.17.Dockerfile
+++ b/Dockerfile/alpine-3.19.Dockerfile
@@ -1,12 +1,12 @@
-FROM alpine:3.17
+FROM alpine:3.19
# Build mscp with conan to create single binary mscp
RUN apk add --no-cache \
gcc make cmake python3 py3-pip perl linux-headers libc-dev \
- openssh bash python3-dev g++
+ openssh bash python3-dev py3-pytest g++
-RUN pip3 install conan pytest
+RUN pip3 install --break-system-packages conan
# preparation for sshd
RUN ssh-keygen -A
@@ -30,8 +30,6 @@ RUN cd ${mscpdir} \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake \
-DBUILD_CONAN=ON -DBUILD_STATIC=ON \
- && make \
- && cp mscp /usr/bin/ \
- && cp mscp /mscp/build/mscp_alpine-3.17-x86_64.static
-# copy mscp to PKG FILE NAME because this build doesn't use CPACK
+ && make -j 2 \
+ && make install
diff --git a/docker/build-deb.Dockerfile b/Dockerfile/build-deb.Dockerfile
index e3e6381..e3e6381 100644
--- a/docker/build-deb.Dockerfile
+++ b/Dockerfile/build-deb.Dockerfile
diff --git a/docker/build-srpm.Dockerfile b/Dockerfile/build-srpm.Dockerfile
index b614fc1..b614fc1 100644
--- a/docker/build-srpm.Dockerfile
+++ b/Dockerfile/build-srpm.Dockerfile
diff --git a/docker/build-srpm.Dockerfile.in b/Dockerfile/build-srpm.Dockerfile.in
index f7a8cf0..f7a8cf0 100644
--- a/docker/build-srpm.Dockerfile.in
+++ b/Dockerfile/build-srpm.Dockerfile.in
diff --git a/Dockerfile/rocky-8.9.Dockerfile b/Dockerfile/rocky-8.9.Dockerfile
new file mode 100644
index 0000000..cb2de9f
--- /dev/null
+++ b/Dockerfile/rocky-8.9.Dockerfile
@@ -0,0 +1,29 @@
+FROM rockylinux:8.9
+
+# install pytest, sshd for test, and rpm-build
+RUN set -ex && yum -y install \
+ python3 python3-pip python3-devel openssh openssh-server openssh-clients rpm-build
+
+RUN python3 -m pip install pytest
+
+
+# preparation for sshd
+RUN mkdir /var/run/sshd \
+ && ssh-keygen -A \
+ && ssh-keygen -f /root/.ssh/id_rsa -N "" \
+ && mv /root/.ssh/id_rsa.pub /root/.ssh/authorized_keys
+
+ARG mscpdir="/mscp"
+
+COPY . ${mscpdir}
+
+# install build dependency
+RUN ${mscpdir}/scripts/install-build-deps.sh
+
+# build
+RUN cd ${mscpdir} \
+ && rm -rf build \
+ && cmake -B build \
+ && cd ${mscpdir}/build \
+ && make -j 2 \
+ && make install
diff --git a/docker/rocky-8.8.Dockerfile b/Dockerfile/rocky-9.3.Dockerfile
index 6140905..84f6b11 100644
--- a/docker/rocky-8.8.Dockerfile
+++ b/Dockerfile/rocky-9.3.Dockerfile
@@ -1,4 +1,4 @@
-FROM rockylinux:8.8
+FROM rockylinux:9.3
# install pytest, sshd for test, and rpm-build
RUN set -ex && yum -y install \
@@ -25,7 +25,6 @@ RUN cd ${mscpdir} \
&& rm -rf build \
&& cmake -B build \
&& cd ${mscpdir}/build \
- && make \
- && cpack -G RPM CPackConfig.cmake \
- && rpm -iv *.rpm
+ && make -j 2 \
+ && make install
diff --git a/docker/ubuntu-20.04.Dockerfile b/Dockerfile/ubuntu-20.04.Dockerfile
index c1da765..a2dda99 100644
--- a/docker/ubuntu-20.04.Dockerfile
+++ b/Dockerfile/ubuntu-20.04.Dockerfile
@@ -30,7 +30,6 @@ RUN cd ${mscpdir} \
&& rm -rf build \
&& cmake -B build \
&& cd ${mscpdir}/build \
- && make \
- && cpack -G DEB CPackConfig.cmake \
- && dpkg -i *.deb
+ && make -j 2 \
+ && make install
diff --git a/docker/ubuntu-22.04.Dockerfile b/Dockerfile/ubuntu-22.04.Dockerfile
index 377cfff..1a8fb12 100644
--- a/docker/ubuntu-22.04.Dockerfile
+++ b/Dockerfile/ubuntu-22.04.Dockerfile
@@ -29,7 +29,5 @@ RUN cd ${mscpdir} \
&& rm -rf build \
&& cmake -B build \
&& cd ${mscpdir}/build \
- && make \
- && cpack -G DEB CPackConfig.cmake \
- && dpkg -i *.deb
-
+ && make -j 2 \
+ && make install
diff --git a/docker/README.md b/docker/README.md
deleted file mode 100644
index 8e3dbe9..0000000
--- a/docker/README.md
+++ /dev/null
@@ -1,37 +0,0 @@
-
-Build docker containers.
-
-```console
-cd ..
-
-docker build -t mscp-ubuntu:20.04 -f docker/ubuntu-20.04.Dockerfile .
-
-docker build -t mscp-ubuntu:22.04 -f docker/ubuntu-22.04.Dockerfile .
-
-docker build -t mscp-rocky:8.8 -f docker/rocky-8.Dockerfile .
-```
-
-Test `mscp` in the containers.
-
-```console
-docker run --init --rm mscp-ubuntu:20.04 /mscp/scripts/test-in-container.sh
-
-docker run --init --rm mscp-ubuntu:22.04 /mscp/scripts/test-in-container.sh
-
-docker run --init --rm mscp-rocky:8.9 /mscp/scripts/test-in-container.sh
-```
-
-Retrieve deb/rpm packages.
-
-```console
-docker run --rm -v (pwd):/out mscp-ubuntu:20.04 \
- cp /mscp/build/mscp_ubuntu-20.04-x86_64.deb /out/
-
-docker run --rm -v (pwd):/out mscp-ubuntu:22.04 \
- cp /mscp/build/mscp_ubuntu-22.04-x86_64.deb /out/
-
-docker run --rm -v (pwd):/out mscp-rocky:8.8 \
- cp /mscp/build/mscp_rocky-8.8-x86_64.rpm /out/
-```
-
-I don't know whether these are good way. \ No newline at end of file
diff --git a/scripts/print-install-deps.sh b/scripts/print-install-deps.sh
deleted file mode 100755
index 6ec70fc..0000000
--- a/scripts/print-install-deps.sh
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/bash -e
-#
-# Print install dpenedencies on Linux. CMake runs this script to obtain deps for CPACK.
-# mscp dependes on packages on which libssh depends.
-
-source /etc/os-release
-
-release=$1
-
-case $release in
- ubuntu-20.04*)
- echo "libc6 (>= 2.27), libgssapi-krb5-2 (>= 1.17), libssl1.1 (>= 1.1.1), zlib1g (>= 1:1.1.4)"
- ;;
- ubuntu-22.04*)
- echo "libc6 (>= 2.33), libgssapi-krb5-2 (>= 1.17), libssl3 (>= 3.0.0~~alpha1), zlib1g (>= 1:1.1.4)"
- ;;
- centos* | rhel* | rocky* | almalinux*)
- echo "glibc crypto-policies krb5-libs openssl-libs libcom_err"
- ;;
- *)
- echo "$(basename $0): unsupported install dependency: $release"
- exit 1
-esac