0560562
# render_template(src, dest):
0560562
# Renders the source template (using %%expand macro) and copies it to the
0560562
# destination path.
0560562
# Arguments:
0560562
#   - src: path of the source template to render
0560562
#   - dest: path of the destination file
0560562
%define render_template()\
0560562
if [[ %# -ne 2 ]]; then\
0560562
    echo "Invalid number of arguments to %0 macro: %#"\
0560562
    exit 1\
0560562
fi\
0560562
cat << 'EOF' > %2\
0560562
%{expand:%(cat %1)}\
0560562
EOF
0560562
a0101dd
%global commit0 c9da6185f8aa82069daf0ef0e438dc2d7c4f6ce8
a0101dd
%global gittag0 0.29
0560562
%global shortcommit0 %(c=%{commit0}; echo ${c:0:7})
0c2fcb9
0c2fcb9
Name: bup
0560562
Version: %{gittag0}
0560562
Release: 1%{?dist}
0c2fcb9
Summary: Very efficient backup system based on the git packfile format
0c2fcb9
0c2fcb9
# all of the code is licensed as GNU Lesser General Public License v2, except:
0c2fcb9
# - lib/bup/bupsplit.c: BSD License (two clause),
0c2fcb9
# - lib/bup/bupsplit.h: BSD License (two clause),
0c2fcb9
# - lib/bup/options.py: BSD License (two clause),
0c2fcb9
# - definition of relpath() function in wvtest.py: Python License
0c2fcb9
License: LGPLv2 and BSD and Python
0c2fcb9
URL: https://bup.github.io/
0560562
Source0: https://github.com/%{name}/%{name}/archive/%{gittag0}/%{name}-%{version}.tar.gz
322fb0e
Source1: README.Fedora.md
9e277d4
Source2: bup-web.service
322fb0e
Source3: README-bup-web.Fedora.md
0c2fcb9
0c2fcb9
BuildRequires: python2-devel
a0101dd
BuildRequires: git-core
0c2fcb9
# Required for building documentation
0c2fcb9
BuildRequires: pandoc
9e277d4
# Required for preparing systemd service for 'bup web' command
9e277d4
BuildRequires: systemd
5431361
# Required for running tests
0560562
BuildRequires: par2cmdline
a0101dd
BuildRequires: perl(Getopt::Long)
a0101dd
BuildRequires: perl(Pod::Usage)
5431361
BuildRequires: perl(Time::HiRes)
0560562
BuildRequires: pyxattr
0560562
BuildRequires: pylibacl
0560562
BuildRequires: python-tornado
0c2fcb9
a0101dd
Requires: git-core
0c2fcb9
Requires: pyxattr
0c2fcb9
Requires: pylibacl
0c2fcb9
# Only required for 'bup fuse' command
0c2fcb9
Requires: fuse-python
0560562
# Only required for 'bup fsck' command
0560562
Requires: par2cmdline
0c2fcb9
0c2fcb9
0c2fcb9
%description
0c2fcb9
Very efficient backup system based on the git packfile format, providing fast
0c2fcb9
incremental saves and global deduplication (among and within files, including
0c2fcb9
virtual machine images). Some of its features are:
0c2fcb9
* It uses a rolling checksum algorithm and hence it can backup huge files
0c2fcb9
  incrementally.
0c2fcb9
* It uses packfile format from git, so one can access the stored data even if
0c2fcb9
  he doesn't like bup's user interface.
0c2fcb9
* It writes packfiles directly so it is fast even with huge amounts of data:
0c2fcb9
  it can track millions of files and keep track of hundreds or thousands of
0c2fcb9
  gigabytes of objects.
0c2fcb9
* Data is "automagically" shared between incremental backups without having to
0c2fcb9
  know which backup is based on which other one.
0c2fcb9
* One can make a backup directly to a remote bup server, without needing tons
0c2fcb9
  of temporary disk space on the computer being backed up. If the backup is
0c2fcb9
  interrupted halfway through, the next run will pick up where the previous
0c2fcb9
  backup left off.
0c2fcb9
* It can use "par2" redundancy to recover corrupted backups even if the disk
0c2fcb9
  has undetected bad sectors.
0c2fcb9
* Each incremental backup acts as if it's a full backup, it just takes less
0c2fcb9
  disk space.
0c2fcb9
* One can mount a bup repository as a FUSE filesystem and access the contents
0c2fcb9
  that way, or even export it over Samba.
0c2fcb9
9e277d4
#
9e277d4
# bup-web
9e277d4
#
9e277d4
%package web
9e277d4
License: LGPLv2
9e277d4
Summary: Web server for browsing through bup repositories
9e277d4
URL: https://bup.github.io/
171ecf7
Requires: %{name}%{?_isa} = %{version}-%{release}
9e277d4
Requires: python-tornado
9e277d4
Requires(post): systemd
9e277d4
Requires(preun): systemd
9e277d4
Requires(postun): systemd
9e277d4
9e277d4
%description web
9e277d4
Provides the "bup web" command which runs a web server for browsing through
9e277d4
bup repositories.
9e277d4
0c2fcb9
0c2fcb9
%prep
0560562
%autosetup
0c2fcb9
0c2fcb9
0c2fcb9
%build
0560562
# NOTE: We can't use %%configure since bup uses a non-standard configure script
0560562
# which is executed during the execution of the make command.
0c2fcb9
# To configure the build process, we need to pass variables to the make
0c2fcb9
# command.
0560562
%make_build CFLAGS="${CFLAGS:-%optflags}"
0560562
a0101dd
%render_template %{SOURCE1} %{_builddir}/%{buildsubdir}/%{basename:%SOURCE1}
a0101dd
%render_template %{SOURCE3} %{_builddir}/%{buildsubdir}/%{basename:%SOURCE3}
0c2fcb9
0c2fcb9
0c2fcb9
%install
0560562
# NOTE: Since bup uses a non-standard configure script, which doesn't support
0560562
# specifying distro-specific paths of the variables defined below, we need to
0560562
# manually pass variables to the make command.
0560562
%make_install \
0560562
    PREFIX=%{_prefix} \
0560562
    MANDIR=%{_mandir} \
0560562
    DOCDIR=%{_pkgdocdir} \
0560562
    BINDIR=%{_bindir} \
0560562
    LIBDIR=%{_libdir}/%{name}
0c2fcb9
0c2fcb9
# Fix hard-coded libdir location in bup's executable
0c2fcb9
sed -i 's|/lib/bup|/%{_lib}/bup|' %{buildroot}%{_bindir}/bup
0c2fcb9
9e277d4
# Install systemd unit file
9e277d4
mkdir -p %{buildroot}%{_userunitdir}
9e277d4
install -p -m 0644 %{SOURCE2} %{buildroot}%{_userunitdir}
0c2fcb9
0560562
# Install READMEs and Notable changes manually
0560562
# NOTE: This is necessary since mixing the %%doc with relative paths and
0560562
# installation of files directly into %%_pkgdocdir in the same source package
0560562
# is forbidden. For more details, see:
0560562
# https://fedoraproject.org/wiki/Packaging:Guidelines#Documentation
0560562
install -p -m 0644 README.md %{buildroot}%{_pkgdocdir}
0560562
install -p -m 0644 README*.Fedora.md %{buildroot}%{_pkgdocdir}
0560562
install -p -m 0644 note/*.md %{buildroot}%{_pkgdocdir}
0560562
0560562
0c2fcb9
%check
0560562
# Run the built-in test suite containing 4200+ tests
0560562
%make_build test
0c2fcb9
0c2fcb9
9e277d4
%post web
0560562
%if 0%{?fedora} >= 24
0560562
%systemd_user_post bup-web.service
0560562
%else
0560562
# NOTE: %%systemd_user_post macro is broken in systemd < v229, hence we need
0560562
# this work-around.
558f8a4
%systemd_post \\--user \\--global bup-web.service
0560562
%endif
9e277d4
9e277d4
9e277d4
%preun web
9e277d4
%systemd_user_preun bup-web.service
9e277d4
9e277d4
9e277d4
%postun web
9e277d4
%systemd_user_postun_with_restart bup-web.service
9e277d4
9e277d4
9e277d4
%files web
9e277d4
%{_libdir}/%{name}/cmd/bup-web
9e277d4
%{_libdir}/%{name}/web/
9e277d4
%{_userunitdir}/bup-web.service
9e277d4
%{_mandir}/man1/bup-web.1*
0560562
%{_pkgdocdir}/bup-web.html
0560562
%{_pkgdocdir}/README-bup-web.Fedora.md
9e277d4
0c2fcb9
%files
0c2fcb9
%license LICENSE
0c2fcb9
%{_bindir}/%{name}
0c2fcb9
%{_libdir}/%{name}/
9e277d4
%exclude %{_libdir}/%{name}/cmd/bup-web
9e277d4
%exclude %{_libdir}/%{name}/web/
0c2fcb9
%{_mandir}/man1/%{name}.1*
0c2fcb9
%{_mandir}/man1/%{name}-*.1*
9e277d4
%exclude %{_mandir}/man1/bup-web.1*
0560562
%{_pkgdocdir}/
0560562
%exclude %{_pkgdocdir}/bup-web.html
0560562
%exclude %{_pkgdocdir}/README-bup-web.Fedora.md
0c2fcb9
0c2fcb9
0c2fcb9
%changelog
a0101dd
* Tue Jan 10 2017 Tadej Janež <tadej.j@nez.si> 0.29-1
a0101dd
- Updated to 0.29 release.
a0101dd
- Replaced 'git' requirement with 'git-core' which provides just core git with
a0101dd
  minimal extra dependencies (e.g. doesn't require numerous Perl modules).
a0101dd
- Added missing Perl BuildRequirements masked by the full 'git' install:
a0101dd
  - perl(Getopt::Long)
a0101dd
  - perl(Pod::Usage)
a0101dd
- Updated spec file:
a0101dd
  - Use %%{basename: ...} when rendering README templates.
a0101dd
0560562
* Tue Dec 27 2016 Tadej Janež <tadej.j@nez.si> 0.28.1-1
0560562
- Updated to 0.28.1 release.
0560562
- Enabled 'par2' support in 'bup fsck'.
0560562
- Made tests run in parallel.
0560562
- Packaged HTML documentation.
0560562
- Dropped all patches.
0560562
- Updated and modernized spec file:
0560562
  - Use %%make_build macro.
0560562
  - Use %%make_install macro.
0560562
  - Simplify %%make_install part since bup now properly implements DESTDIR
0560562
    environment variable.
0560562
  - Stop mixing the %%doc with relative paths and installation of files
0560562
    directly into %%_pkgdocdir.
0560562
  - Use %%systemd_user_post macro on Fedora 24+.
0560562
  - Implement and use %%render_template macro to render READMEs containing
0560562
    RPM macros using %%expand macro.
0560562
  - Add additional BuildRequires needed by tests.
0560562
  - Follow the latest SourceURL packaging guidelines and reference git tag
0560562
    instead of commit revision in Source0 URL.
0560562
  - Drop special prerelease handling.
0560562
1ce68f7
* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.27-2
1ce68f7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
1ce68f7
c1f8241
* Mon Dec 14 2015 Tadej Janež <tadej.j@nez.si> 0.27-1
c1f8241
- Initial release in Fedora 22+ and EPEL 7.
c1f8241
- Added a workaround for an %%autosetup bug on EPEL 7.
c1f8241
171ecf7
* Fri Dec 04 2015 Tadej Janež <tadej.j@nez.si> 0.27-0.4
171ecf7
- Made bup-web subpackage Requires on the base package arch-specific.
171ecf7
322fb0e
* Mon Nov 23 2015 Tadej Janež <tadej.j@nez.si> 0.27-0.3
9e277d4
- Split bup web server into a separate sub-package.
9e277d4
- Added systemd service for running the bup web server.
558f8a4
- Added a work-around for a bug in systemd's %%systemd_user_post macro.
322fb0e
- Added a README with Fedora-specific notes on using the bup-web package.
322fb0e
- Converted the main README with Fedora-specific notes to Markdown.
9e277d4
5858e7e
* Wed Oct 14 2015 Tadej Janež <tadej.j@nez.si> 0.27-0.2
5431361
- Added perl(Time::HiRes) to BuildRequires since it is required for running the
5431361
  tests.
5858e7e
- Temporarily disable test_from_path_error() test that fails on Fedora Koji and
5858e7e
  COPR build systems.
5431361
0c2fcb9
* Sun May 17 2015 Tadej Janež <tadej.j@nez.si> 0.27-0.1
0c2fcb9
- Initial package.