Name:           rsync
Version:        3.5.0
Release:        2
Summary:        Fast incremental file transfer utility
License:        GPL-3.0-or-later
URL:            https://rsync.samba.org/
Source0:        https://download.samba.org/pub/rsync/src/rsync-%{version}.tar.gz
Source1:        rsyncd.socket
Source2:        rsyncd.service
Source3:        rsyncd.conf
Source4:        rsyncd.sysconfig
Source5:        rsyncd@.service

BuildRequires:  git gcc systemd libacl-devel autoconf popt-devel
BuildRequires:  lz4-devel openssl-devel libzstd-devel zlib-devel xxhash-devel
BuildRequires:  python3-commonmark
Provides:       rsync-daemon = %{version}-%{release}
Obsoletes:      rsync-daemon < %{version}-%{release}
%{?systemd_requires}

%description
Rsync is an open source utility that provides fast incremental file transfer.
It uses the "rsync algorithm" which provides a very fast method for bringing
remote files into sync. It does this by sending just the differences in the
files across the link, without requiring that both sets of files are present
at one of the ends of the link beforehand.

%package help
Summary:        Fast incremental file transfer utility
Buildarch:      noarch
Provides:	rsync-doc = %{version}-%{release}

%description help
Rsync is an open source utility that provides fast incremental file transfer.
It uses the "rsync algorithm" which provides a very fast method for bringing
remote files into sync. It does this by sending just the differences in the
files across the link, without requiring that both sets of files are present
at one of the ends of the link beforehand.

%prep
%autosetup -n %{name}-%{version} -p1

%build
%if "%{?toolchain}" == "clang"
    CFLAGS="${CFLAGS:-%{?build_cflags}} -Wno-strict-prototypes"; export CFLAGS;
%endif
%configure \
  --without-included-popt \
  --without-included-zlib
%make_build

%check
%ifarch loongarch64
#protected_regular is enabled on loongarch64
#skip protected-regular test, Protected regular test requires root privileges
RSYNC_UNSHARED=1 make check
%else
make check
%endif

%install
%make_install

install -D -m644 %{SOURCE1} %{buildroot}/%{_unitdir}/rsyncd.socket
install -D -m644 %{SOURCE2} %{buildroot}/%{_unitdir}/rsyncd.service
install -D -m644 %{SOURCE3} %{buildroot}/%{_sysconfdir}/rsyncd.conf
install -D -m644 %{SOURCE4} %{buildroot}/%{_sysconfdir}/sysconfig/rsyncd
install -D -m644 %{SOURCE5} %{buildroot}/%{_unitdir}/rsyncd@.service

%preun
%systemd_preun rsyncd.service

%post
%systemd_post rsyncd.service

%postun
%systemd_postun_with_restart rsyncd.service

%files -n rsync
%doc tech_report.tex
%attr(0644,root,root) %doc support/*
%license COPYING
%config(noreplace) %{_sysconfdir}/*.conf
%config(noreplace) %{_sysconfdir}/sysconfig/rsyncd
%{_unitdir}/rsyncd*
%{_bindir}/rsync*

%files help
%{_mandir}/man1/%{name}.1*
%{_mandir}/man1/%{name}-ssl.1*
%{_mandir}/man5/rsyncd.conf.5*

%changelog
* Thu Aug 27 2026 Wenlong Zhang <zhangwenlong@loongson.cn> - 3.5.0-2
- skip protected-regular test on loongarch64

* Thu Aug 13 2026 Funda Wang <fundawang@yeah.net> - 3.5.0-1
- update to 3.5.0, fixes 33 security issues

* Mon Jun 08 2026 Funda Wang <fundawang@yeah.net> - 3.4.4-1
- update to 3.4.4

* Wed May 20 2026 Funda Wang <fundawang@yeah.net> - 3.4.3-1
- update to 3.4.3

* Tue Apr 28 2026 Funda Wang <fundawang@yeah.net> - 3.4.2-1
- update to 3.4.2

* Wed Apr 22 2026 hugel <2712504175@qq.com> - 3.4.1-3
- Fix CVE-2026-41035

* Thu Nov 20 2025 yanglongkang <yanglongkang@h-partners.com> - 3.4.1-2
- Fix CVE-2025-10158

* Thu Jan 16 2025 Funda Wang <fundawang@yeah.net> - 3.4.1-1
- update to 3.4.1

* Wed Jul 10 2024 warlcok <hunan@kylinos.cn> - 3.3.0-1
- Update version to 3.3.0

* Thu Feb 22 2024 Xiaoya Huang <huangxiaoya@iscas.ac.cn> - 3.2.7-3
- Type: enhancement
- CVE:
- SUG:NA
- DESC: support clang build

* Thu Jun 15 2023 zhoupengcheng <zhoupengcheng11@huawei.com> - 3.2.7-2
- Type:bugfix
- CVE:
- SUG:NA
- DESC:Restrict the doc permission in rsync to 644.

* Tue Jan 31 2023 wangjunqi <wangjunqi@kylinos.cn> - 3.2.7-1
- update version to 3.2.7

* Thu Aug 18 2022 fuanan <fuanan3@h-partners.com> - 3.2.5-1
- Update version to 3.2.5
- Fix CVE-2022-29154,CVE-2022-37434

* Fri Jun 18 2021 yangzhuangzhuang <yangzhuangzhuang1@huawei.com> - 3.2.3-2
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:Fix CVE-2020-14387

* Fri Jan 22 2021 yixiangzhike <zhangxingliang3@huawei.com> - 3.2.3-1
- Type:requirement
- ID:NA
- SUG:NA
- DESC:update to 3.2.3

* Tue Jul 28 2020 Liquor <lirui130@huawei.com> - 3.2.1-1
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:update to 3.2.1

* Fri Sep 27 2019 chengquan<chengquan3@huawei.com> - 3.1.3-6
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:fix spec rule in openeuler

* Mon Sep 09 2019 openEuler Buildteam <buildteam@openeuler.org> - 3.1.3-5
- Package init