diff options
-rw-r--r-- | CMakeLists.txt | 27 | ||||
-rw-r--r-- | README.md | 12 | ||||
-rw-r--r-- | docker/.gitignore | 3 | ||||
-rw-r--r-- | docker/build-srpm.Dockerfile | 22 | ||||
-rw-r--r-- | docker/build-srpm.Dockerfile.in | 22 | ||||
-rw-r--r-- | rpm/.gitignore | 3 | ||||
-rw-r--r-- | rpm/README.md | 17 | ||||
-rw-r--r-- | rpm/mscp.spec.in | 42 |
8 files changed, 140 insertions, 8 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index a2f9533..bd6301d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -262,3 +262,30 @@ 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}) + + +### rpmbuild-related definitions + +# generate files for rpmbuild +configure_file( + ${mscp_SOURCE_DIR}/rpm/mscp.spec.in + ${mscp_SOURCE_DIR}/rpm/mscp.spec + @ONLY) +configure_file( + ${mscp_SOURCE_DIR}/docker/build-srpm.Dockerfile.in + ${mscp_SOURCE_DIR}/docker/build-srpm.Dockerfile + @ONLY) + +# Custom targets 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 + COMMENT "Build mscp src.rpm inside a container" + WORKING_DIRECTORY ${mscp_SOURCE_DIR} + BYPRODUCTS ${CMAKE_BINARY_DIR}/${SRPMFILE} + COMMAND + docker build -t ${RPMBUILDCONTAINER} -f docker/build-srpm.Dockerfile . + COMMAND + docker run --rm -v ${CMAKE_BINARY_DIR}:/out ${RPMBUILDCONTAINER} + cp /root/rpmbuild/SRPMS/${SRPMFILE} /out/) + @@ -50,17 +50,13 @@ sudo add-apt-repository ppa:upaa/mscp sudo apt-get install mscp ``` -- Rocky 8.8 +- RHEL-based distributions ```console -yum install https://github.com/upa/mscp/releases/latest/download/mscp_rocky-8.8-x86_64.rpm +sudo dnf copr enable upaaa/mscp +sudo dnf install mscp ``` -- Alma 8.8 -```console -yum install https://github.com/upa/mscp/releases/latest/download/mscp_almalinux-8.8-x86_64.rpm -``` - -- Linux with single binary `mscp` (x86_64 only, and not optimal performance) +- Single binary `mscp` for x86_64 (not optimal performance) ```console wget https://github.com/upa/mscp/releases/latest/download/mscp.linux.x86.static -O /usr/local/bin/mscp chmod 755 /usr/local/bin/mscp diff --git a/docker/.gitignore b/docker/.gitignore new file mode 100644 index 0000000..f7083c9 --- /dev/null +++ b/docker/.gitignore @@ -0,0 +1,3 @@ + +# generated by cmake +rpmbuild.Dockerfile diff --git a/docker/build-srpm.Dockerfile b/docker/build-srpm.Dockerfile new file mode 100644 index 0000000..b614fc1 --- /dev/null +++ b/docker/build-srpm.Dockerfile @@ -0,0 +1,22 @@ +FROM rockylinux:9 + +# install pytest, sshd for test, and rpm-build +RUN set -ex && yum -y install rpm-build rpmdevtools + +ARG mscpdir="/mscp-0.1.3" +ARG mscptgz="mscp-0.1.3.tar.gz" + +COPY . ${mscpdir} + +# install build dependency +RUN ${mscpdir}/scripts/install-build-deps.sh + +# prepare rpmbuild +RUN rpmdev-setuptree \ + && rm -rf ${mscpdir}/build \ + && tar zcvf /${mscptgz} --exclude-vcs ${mscpdir} \ + && cp /${mscptgz} ~/rpmbuild/SOURCES/ \ + && cp ${mscpdir}/rpm/mscp.spec ~/rpmbuild/SPECS/ + +# build rpm and src.rpm +RUN rpmbuild -ba ~/rpmbuild/SPECS/mscp.spec diff --git a/docker/build-srpm.Dockerfile.in b/docker/build-srpm.Dockerfile.in new file mode 100644 index 0000000..f7a8cf0 --- /dev/null +++ b/docker/build-srpm.Dockerfile.in @@ -0,0 +1,22 @@ +FROM rockylinux:9 + +# install pytest, sshd for test, and rpm-build +RUN set -ex && yum -y install rpm-build rpmdevtools + +ARG mscpdir="/mscp-@MSCP_VERSION@" +ARG mscptgz="mscp-@MSCP_VERSION@.tar.gz" + +COPY . ${mscpdir} + +# install build dependency +RUN ${mscpdir}/scripts/install-build-deps.sh + +# prepare rpmbuild +RUN rpmdev-setuptree \ + && rm -rf ${mscpdir}/build \ + && tar zcvf /${mscptgz} --exclude-vcs ${mscpdir} \ + && cp /${mscptgz} ~/rpmbuild/SOURCES/ \ + && cp ${mscpdir}/rpm/mscp.spec ~/rpmbuild/SPECS/ + +# build rpm and src.rpm +RUN rpmbuild -ba ~/rpmbuild/SPECS/mscp.spec diff --git a/rpm/.gitignore b/rpm/.gitignore new file mode 100644 index 0000000..c1dc70f --- /dev/null +++ b/rpm/.gitignore @@ -0,0 +1,3 @@ + +# generated by cmake +mscp.spec diff --git a/rpm/README.md b/rpm/README.md new file mode 100644 index 0000000..d24bb64 --- /dev/null +++ b/rpm/README.md @@ -0,0 +1,17 @@ + +## Build mscp as src.rpm for publishing at COPR + +### How to build + +```shell-session +cd mscp +mkdir build && cd build + +cmake .. make build-srpm +``` + +`make build-srpm` builds mscp src.rpm inside a docker container. + +After that, there is `mscp-0.1.3-1.el9.src.rpm` under the `build` +directory. The next step for publishing is to upload the src.rpm to +[coprs/upaaa/mscp](https://copr.fedorainfracloud.org/coprs/upaaa/mscp/build/6983569/). diff --git a/rpm/mscp.spec.in b/rpm/mscp.spec.in new file mode 100644 index 0000000..40d0d8e --- /dev/null +++ b/rpm/mscp.spec.in @@ -0,0 +1,42 @@ +Name: mscp +Version: @MSCP_VERSION@ +Release: 1%{?dist} +Summary: mscp, fast file transfer over multiple SSH connections + +Group: Applications/Internet +License: GPLv3 +URL: https://github.com/upa/mscp +Source0: %{name}-%{version}.tar.gz + +BuildRequires: gcc make cmake zlib-devel openssl-devel +Requires: glibc crypto-policies krb5-libs openssl-libs libcom_err + +%description +mscp transfers files over multiple SSH connections. Multiple threads +and connections in mscp transfer (1) multiple files simultaneously +and (2) a large file in parallel. It would shorten the waiting time +for transferring a lot of/large files over networks. + + +%global debug_package %{nil} + +%prep +%setup -q + + +%build +cmake -S . -B build -DINSTALL_EXECUTABLE_ONLY=ON +make -C build %{?_smp_mflags} + + +%install +make -C build install DESTDIR=%{buildroot} + +%files +/usr/local/bin/mscp +/usr/local/share/man/man1/mscp.1 + + +%changelog +* Sat Feb 03 2024 Ryo nakamura <upa@haeena.net> - 0.1.3-0 +- Initial release for rpm packaging |