Blob Blame Raw
# render_template(src, dest):
# Renders the source template (using %%expand macro) and copies it to the
# destination path.
# Arguments:
#   - src: path of the source template to render
#   - dest: path of the destination file
%define render_template()\
if [[ %# -ne 2 ]]; then\
    echo "Invalid number of arguments to %0 macro: %#"\
    exit 1\
cat << 'EOF' > %2\
%{expand:%(cat %1)}\

%global gittag 0.29.1

Name: bup
Version: %{gittag}
Release: 2%{?dist}
Summary: Very efficient backup system based on the git packfile format

# all of the code is licensed as GNU Lesser General Public License v2, except:
# - lib/bup/bupsplit.c: BSD License (two clause),
# - lib/bup/bupsplit.h: BSD License (two clause),
# - lib/bup/ BSD License (two clause),
# - definition of relpath() function in Python License
License: LGPLv2 and BSD and Python
Source2: bup-web.service

# Backport of upstream commit 292361d86d1cf0cc555681ae43371d66c8ebb366:
# test-rm: accommodate packed-refs creation by newer git
Patch0: 0001-test-rm-accommodate-packed-refs-creation-by-newer-gi.patch
# Backport of upstream commit 36476fee097cd8dd24c52ca1f460d7a4f45ea209:
# test-rm: fix regexes to handle newer *and* older git
Patch1: 0002-test-rm-fix-regexes-to-handle-newer-and-older-git.patch

BuildRequires: gcc
BuildRequires: python2-devel
BuildRequires: git-core
# Required for building documentation
BuildRequires: pandoc
# Required for preparing systemd service for 'bup web' command
BuildRequires: systemd
# Required for running tests
BuildRequires: par2cmdline
BuildRequires: perl(Getopt::Long)
BuildRequires: perl(Pod::Usage)
BuildRequires: perl(Time::HiRes)
%if 0%{?fedora} >= 28
BuildRequires: python2-pyxattr
BuildRequires: pyxattr
BuildRequires: pylibacl
BuildRequires: python2-tornado
BuildRequires: rsync

Requires: git-core
%if 0%{?fedora} >= 28
Requires: python2-pyxattr
Requires: pyxattr
Requires: pylibacl
# Only required for 'bup fuse' command
%if 0%{?fedora} >= 28
Requires: python2-fuse
Requires: fuse-python
# Only required for 'bup fsck' command
Requires: par2cmdline

Very efficient backup system based on the git packfile format, providing fast
incremental saves and global deduplication (among and within files, including
virtual machine images). Some of its features are:
* It uses a rolling checksum algorithm and hence it can backup huge files
* It uses packfile format from git, so one can access the stored data even if
  he doesn't like bup's user interface.
* It writes packfiles directly so it is fast even with huge amounts of data:
  it can track millions of files and keep track of hundreds or thousands of
  gigabytes of objects.
* Data is "automagically" shared between incremental backups without having to
  know which backup is based on which other one.
* One can make a backup directly to a remote bup server, without needing tons
  of temporary disk space on the computer being backed up. If the backup is
  interrupted halfway through, the next run will pick up where the previous
  backup left off.
* It can use "par2" redundancy to recover corrupted backups even if the disk
  has undetected bad sectors.
* Each incremental backup acts as if it's a full backup, it just takes less
  disk space.
* One can mount a bup repository as a FUSE filesystem and access the contents
  that way, or even export it over Samba.

# bup-web
%package web
License: LGPLv2
Summary: Web server for browsing through bup repositories
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: python2-tornado
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd

%description web
Provides the "bup web" command which runs a web server for browsing through
bup repositories.

%autosetup -S git

# Remove .git/ directory otherwise bup's make command fails with:
# error: detected release, but found ./.git
# Makefile:43: *** Version configuration failed.  Stop
rm -r .git/

# NOTE: We can't use %%configure since bup uses a non-standard configure script
# which is executed during the execution of the make command.
# To configure the build process, we need to pass variables to the make
# command.
%make_build CFLAGS="${CFLAGS:-%optflags}"

%render_template %{SOURCE1} %{_builddir}/%{buildsubdir}/%{basename:%SOURCE1}
%render_template %{SOURCE3} %{_builddir}/%{buildsubdir}/%{basename:%SOURCE3}

# NOTE: Since bup uses a non-standard configure script, which doesn't support
# specifying distro-specific paths of the variables defined below, we need to
# manually pass variables to the make command.
%make_install \
    PREFIX=%{_prefix} \
    MANDIR=%{_mandir} \
    DOCDIR=%{_pkgdocdir} \
    BINDIR=%{_bindir} \

# Fix hard-coded libdir location in bup's executable
sed -i 's|/lib/bup|/%{_lib}/bup|' %{buildroot}%{_bindir}/bup

# Install systemd unit file
mkdir -p %{buildroot}%{_userunitdir}
install -p -m 0644 %{SOURCE2} %{buildroot}%{_userunitdir}

# Install READMEs and Notable changes manually
# NOTE: This is necessary since mixing the %%doc with relative paths and
# installation of files directly into %%_pkgdocdir in the same source package
# is forbidden. For more details, see:
install -p -m 0644 %{buildroot}%{_pkgdocdir}
install -p -m 0644 README* %{buildroot}%{_pkgdocdir}
install -p -m 0644 note/*.md %{buildroot}%{_pkgdocdir}

# Run the built-in test suite containing 4200+ tests
%make_build test

%post web
%systemd_user_post bup-web.service

%preun web
%systemd_user_preun bup-web.service

%postun web
%systemd_user_postun_with_restart bup-web.service

%files web

%license LICENSE
%exclude %{_libdir}/%{name}/cmd/bup-web
%exclude %{_libdir}/%{name}/web/
%exclude %{_mandir}/man1/bup-web.1*
%exclude %{_pkgdocdir}/bup-web.html
%exclude %{_pkgdocdir}/

* Wed Aug 01 2018 Tadej Janež <> - 0.29.1-2
- Use older version of pyxattr (build) requirement on Fedora < 28

* Thu Jul 26 2018 Tadej Janež <> - 0.29.1-1
- Update to version 0.29.1
- Add patches that backport fixes for test-rm tests that make them work with
  older and newer versions of git
- Simplify SourceURL handling to only use the %%gittag macro (renamed from

* Sat Jul 21 2018 Tadej Janež <> - 0.29-9
- Add gcc to BuildRequires to account for

* Thu Jul 12 2018 Fedora Release Engineering <> - 0.29-8
- Rebuilt for

* Mon Mar 26 2018 Iryna Shcherbina <> - 0.29-7
- Update Python 2 dependency declarations to new packaging standards

* Wed Feb 07 2018 Fedora Release Engineering <> - 0.29-6
- Rebuilt for

* Mon Aug 21 2017 Tadej Janež <> - 0.29-5
- Explicitly require python2- prefixed Python packages when available
  (python2-fuse on Fedora 28+, python2-tornado)
- Drop work-around for broken %%systemd_user_post macro in Fedora < 24
- Add rsync BuildRequirement needed for running tests

* Wed Aug 02 2017 Fedora Release Engineering <> - 0.29-4
- Rebuilt for

* Wed Jul 26 2017 Fedora Release Engineering <> - 0.29-3
- Rebuilt for

* Fri Feb 10 2017 Fedora Release Engineering <> - 0.29-2
- Rebuilt for

* Tue Jan 10 2017 Tadej Janež <> 0.29-1
- Updated to 0.29 release.
- Replaced 'git' requirement with 'git-core' which provides just core git with
  minimal extra dependencies (e.g. doesn't require numerous Perl modules).
- Added missing Perl BuildRequirements masked by the full 'git' install:
  - perl(Getopt::Long)
  - perl(Pod::Usage)
- Updated spec file:
  - Use %%{basename: ...} when rendering README templates.

* Tue Dec 27 2016 Tadej Janež <> 0.28.1-1
- Updated to 0.28.1 release.
- Enabled 'par2' support in 'bup fsck'.
- Made tests run in parallel.
- Packaged HTML documentation.
- Dropped all patches.
- Updated and modernized spec file:
  - Use %%make_build macro.
  - Use %%make_install macro.
  - Simplify %%make_install part since bup now properly implements DESTDIR
    environment variable.
  - Stop mixing the %%doc with relative paths and installation of files
    directly into %%_pkgdocdir.
  - Use %%systemd_user_post macro on Fedora 24+.
  - Implement and use %%render_template macro to render READMEs containing
    RPM macros using %%expand macro.
  - Add additional BuildRequires needed by tests.
  - Follow the latest SourceURL packaging guidelines and reference git tag
    instead of commit revision in Source0 URL.
  - Drop special prerelease handling.

* Wed Feb 03 2016 Fedora Release Engineering <> - 0.27-2
- Rebuilt for

* Mon Dec 14 2015 Tadej Janež <> 0.27-1
- Initial release in Fedora 22+ and EPEL 7.
- Added a workaround for an %%autosetup bug on EPEL 7.

* Fri Dec 04 2015 Tadej Janež <> 0.27-0.4
- Made bup-web subpackage Requires on the base package arch-specific.

* Mon Nov 23 2015 Tadej Janež <> 0.27-0.3
- Split bup web server into a separate sub-package.
- Added systemd service for running the bup web server.
- Added a work-around for a bug in systemd's %%systemd_user_post macro.
- Added a README with Fedora-specific notes on using the bup-web package.
- Converted the main README with Fedora-specific notes to Markdown.

* Wed Oct 14 2015 Tadej Janež <> 0.27-0.2
- Added perl(Time::HiRes) to BuildRequires since it is required for running the
- Temporarily disable test_from_path_error() test that fails on Fedora Koji and
  COPR build systems.

* Sun May 17 2015 Tadej Janež <> 0.27-0.1
- Initial package.