File cpio.spec of Package cpio

# spec file for package cpio
# Copyright (c) 2021 SUSE LLC
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via

Name:           cpio
Version:        2.13
Release:        0
Summary:        A Backup and Archiving Utility
License:        GPL-3.0-only
Group:          Productivity/Archiving/Backup
Patch2:         cpio-use_new_ascii_format.patch
Patch4:         cpio-use_sbin_rmt.patch
#PATCH-FIX-UPSTREAM cpio-2.12 cpio-open_nonblock.patch bnc#94449,
# -- open device with O_NONBLOCK option
Patch5:         cpio-open_nonblock.patch
Patch15:        cpio-eof_tape_handling.patch
# make posibble to have device nodes with major number > 127
# Red Hat Bugzilla #450109
Patch17:        cpio-dev_number.patch
Patch18:        cpio-default_tape_dev.patch
#PATCH-FIX-UPSTREAM cpio-2.10-close_files_after_copy.patch
Patch20:        cpio-close_files_after_copy.patch
Patch21:        cpio-pattern-file-sigsegv.patch
Patch23:        paxutils-rtapelib_mtget.patch
# see
Patch24:        cpio-revert-CVE-2015-1197-fix.patch
Patch25:        cpio-fix_truncation_check.patch
# add --chain option for directly appending to output archives
Patch26:        0001-add-chain-option.patch
Patch27:        0002-add-chain-test-coverage.patch
# copy_file_range(2) support via new --reflink option
Patch28:        0003-add-copy_file_range-syscall-support.patch
Patch29:        0004-add-reflink-option.patch
Patch30:        0005-attempt-copy_file_range-if-explicitly-requested.patch
Patch31:        0006-ensure-uniform-post-trailer-zeros-length.patch
Patch32:        0007-add-reflink-test-coverage.patch
BuildRequires:  autoconf
BuildRequires:  automake
#Requires(post): %{xinstall_info_prereq}
#Requires(preun): %{xinstall_info_prereq}
Recommends:     %{name}-mt = %{version}
Recommends:     rmt

GNU cpio is a program to manage archives of files. Cpio copies files
into or out of a cpio or tar archive. An archive is a file that contains
other files plus information about them, such as their pathname, owner,
time stamps, and access permissions. The archive can be another file on
the disk, a magnetic tape, or a pipe.

%package mt
Summary:        Tape drive control utility
Group:          Productivity/Archiving/Backup
Requires:       %{name} = %{version}
Requires(post): update-alternatives
Requires(postun): update-alternatives
Provides:       mt

%description mt
This package includes the 'mt', a local tape drive control program.


%setup -q
%patch21 -p1
%patch23 -p1
%patch24 -p1
%patch25 -p1
%patch26 -p1
%patch27 -p1
%patch28 -p1
%patch29 -p1
%patch30 -p1
%patch31 -p1
%patch32 -p1

gettextize -f --no-changelog
autoreconf -fiv
export CFLAGS="%{optflags} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fcommon"
%configure \
  --with-rmt="%{_bindir}/rmt" \
  --enable-mt \
  --disable-silent-rules \
make %{?_smp_mflags}

mkdir -p %{buildroot}/{usr/bin,bin}
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
ln -sf %{_sysconfdir}/alternatives/mt %{buildroot}%{_bindir}/mt
ln -sf %{_sysconfdir}/alternatives/mt.1%{ext_man} %{buildroot}%{_mandir}/man1/mt.1%{ext_man}
%if !0%{?usrmerged}
ln -sf %{_bindir}/cpio %{buildroot}/bin

%find_lang %{name}

make %{?_smp_mflags} check

%post mt
%{_sbindir}/update-alternatives --force \
    --install %{_bindir}/mt mt %{_bindir}/gnumt 10 \
    --slave %{_mandir}/man1/mt.1%{ext_man} mt.1%{ext_man} %{_mandir}/man1/gnumt.1%{ext_man}

%install_info --info-dir=%{_infodir} %{_infodir}/%{name}.info%{ext_info}

%install_info_delete --info-dir=%{_infodir} %{_infodir}/%{name}.info%{ext_info}

%postun mt
if [ ! -f %{_bindir}/gnumt ] ; then
   "%{_sbindir}/update-alternatives" --remove mt %{_bindir}/gnumt

%license COPYING
%doc NEWS ChangeLog
%if !0%{?usrmerged}

%files mt
%ghost %{_bindir}/mt
%ghost %{_mandir}/man1/mt.1%{ext_man}
%ghost %{_sysconfdir}/alternatives/mt
%ghost %{_sysconfdir}/alternatives/mt.1%{ext_man}

%files lang -f %{name}.lang

openSUSE Build Service is sponsored by