mirror of
https://github.com/upa/mscp.git
synced 2026-06-11 11:13:09 +08:00
build source rpm inside a container
A new build target `build-srpm` builds mscp src.rpm inside a docker container. The src.rpm can be published at COPR.
This commit is contained in:
@@ -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-build-all-no-cache DEPENDS ${DOCKER_BUILDS_NO_CACHE})
|
||||||
add_custom_target(docker-test-all DEPENDS ${DOCKER_TESTS})
|
add_custom_target(docker-test-all DEPENDS ${DOCKER_TESTS})
|
||||||
add_custom_target(docker-pkg-all DEPENDS ${DOCKER_PKGS})
|
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/)
|
||||||
|
|
||||||
|
|||||||
12
README.md
12
README.md
@@ -50,17 +50,13 @@ sudo add-apt-repository ppa:upaa/mscp
|
|||||||
sudo apt-get install mscp
|
sudo apt-get install mscp
|
||||||
```
|
```
|
||||||
|
|
||||||
- Rocky 8.8
|
- RHEL-based distributions
|
||||||
```console
|
```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
|
- Single binary `mscp` for x86_64 (not optimal performance)
|
||||||
```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)
|
|
||||||
```console
|
```console
|
||||||
wget https://github.com/upa/mscp/releases/latest/download/mscp.linux.x86.static -O /usr/local/bin/mscp
|
wget https://github.com/upa/mscp/releases/latest/download/mscp.linux.x86.static -O /usr/local/bin/mscp
|
||||||
chmod 755 /usr/local/bin/mscp
|
chmod 755 /usr/local/bin/mscp
|
||||||
|
|||||||
3
docker/.gitignore
vendored
Normal file
3
docker/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
|
||||||
|
# generated by cmake
|
||||||
|
rpmbuild.Dockerfile
|
||||||
22
docker/build-srpm.Dockerfile
Normal file
22
docker/build-srpm.Dockerfile
Normal file
@@ -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
|
||||||
22
docker/build-srpm.Dockerfile.in
Normal file
22
docker/build-srpm.Dockerfile.in
Normal file
@@ -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
|
||||||
3
rpm/.gitignore
vendored
Normal file
3
rpm/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
|
||||||
|
# generated by cmake
|
||||||
|
mscp.spec
|
||||||
17
rpm/README.md
Normal file
17
rpm/README.md
Normal file
@@ -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/).
|
||||||
42
rpm/mscp.spec.in
Normal file
42
rpm/mscp.spec.in
Normal file
@@ -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
|
||||||
Reference in New Issue
Block a user