File star.spec of Package star.16416

#
# spec file for package star
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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 http://bugs.opensuse.org/
#


Name:           star
Version:        1.5.3
Release:        0
Summary:        POSIX.1-2001-Compliant Tar Implementation
License:        CDDL-1.0
Group:          Productivity/Archiving/Backup
Url:            http://cdrecord.berlios.de/old/private/star.html
Source0:        http://sourceforge.net/projects/s-tar/files/%{name}-%{version}.tar.bz2
Source1:        README-FIRST
Source2:        tests.tar.bz2
# PATCH-FIX-SUSE: some default values for configuration/comilation
Patch0:         star-configuration.diff
# PATCH-FIX-SUSE: do not run FSYNC by default
Patch1:         star-no_fsync.diff
# PATCH-FIX-UPSTREAM: Implement selinux
Patch2:         star-selinux.patch
Patch3:         star-lock.diff
# PATCH-FIX-OPENSUSE-bnc#858660
Patch4:         bnc#858660_detect_gzip_failures.patch
# PATCH-FIX-UPSTRTEAM: Fix segfault when using selinux and no xattr
Patch5:         star-1.5.1-selinux-segfault.patch
# PATCH-FIX-UPSTREAM: Fix bufferoverflow
Patch6:         star-1.5.2-bufferoverflow.patch
# PATCH-FIX-SUSE: Use ssh by default
Patch7:         star-1.5.2-use-ssh-by-default.patch
# PATCH-FIX-UPSTREAM: Segfault on pax -X
Patch8:         star-1.5.3-pax-X-option.patch
# PATCH-FIX-UPSTREAM: Fix broken star.mk in 1.5.3 (included from all.mk)
Patch9:         star-1.5.3-star-mk.patch
# PATCH-FIX-UPSTREAM bnc#935569 kstreitova@suse.com -- tries to avoid mixed output when people call star 2>&1 | tee
Patch10:        star-1.5.3-mixed_output.patch
# PATCH-FIX-UPSTREAM bnc#1014065 kstreitova@suse.com -- xattrs are now set after chown() to preserve security.capability
Patch11:        star-1.5.3-xattr_security-capability.patch
Patch12:        star-1.5.3-backreferences_feature.patch
BuildRequires:  autoconf
BuildRequires:  e2fsprogs-devel
BuildRequires:  libacl-devel
BuildRequires:  libattr-devel
BuildRequires:  libselinux-devel
BuildRequires:  libtool
Recommends:     %{name}-rmt = %{version}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Star is a tar like archiver. TAR stands for Tape ARchiver. Star is the
fastest known implementation of a tar archiver.

Features:
- FIFO to keep the tape streaming.
- remote tape support.
- accurate sparse files (if the OS supports it).
- pattern matcher to archive and extract a subset of files.
- user tailorable interface for comparing tar archives against file trees.
- path names up to 1024 Bytes may be archived.
- stores and restores all 3 file times (even creation time). With
POSIX.1-2001 the times are in nanosecond granularity.

%package -n     spax
Summary:        Portable archive exchange
Group:          Productivity/Archiving/Backup
Requires:       %{name} = %{version}
Provides:       pax = 3.5
Obsoletes:      pax < 3.5

%description -n spax
The pax utility shall read and write archives, write lists of the members of
archive files and copy directory hierarchies as is defined in IEEE Std 1003.1.

%package        rmt
Summary:        Magnetic tape control and server
Group:          Productivity/Archiving/Backup
Requires(post): update-alternatives
Requires(postun): update-alternatives
Provides:       mt
Provides:       rmt

%description rmt
The rmt is a program used by programs like star and ufsdump
that like to access remote magnetic tape drives and files
through an interprocess communication connection. This package
contain also mt program for local or remote tape control.

%prep
%setup -q -T -b 2 -n tests -b 0 -n star-%{version}
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1

cp %{SOURCE1} .

for PLAT in aarch64 %{arm} ppc ppc64 ppc64le x86_64 s390 s390x; do
    for AFILE in gcc cc; do
            [ ! -e RULES/${PLAT}-linux-${AFILE}.rul ] \
            && ln -s i586-linux-${AFILE}.rul RULES/${PLAT}-linux-${AFILE}.rul
    done
done

# disable single "fat" binary
cp -a star/all.mk star/Makefile
# do not ship these
rm TARGETS/{25include,55star_sym}

%build
# x86 is special
%ifarch %{ix86}
FLAGS="`echo %{optflags} | sed -e 's/\-fomit-frame-pointer//g'`"
%else
FLAGS="%{optflags}"
%endif

# This is config/work-around for atypical build system.  Variables used are
# docummented makefiles.5.  GMAKE_NOWARN silences irritating warnings in
# GNU/Linux ecosystem.

%global make_flags GMAKE_NOWARN=true                                    \\\
    RUNPATH=                                                            \\\
    LDPATH=                                                             \\\
    PARCH=%{_target_cpu}                                                \\\
    K_ARCH=%{_target_cpu}                                               \\\
    INSTALL='sh $(SRCROOT)/conf/install-sh -c -m $(INSMODEINS)'         \\\
    COPTX="$FLAGS -DTRY_EXT2_FS"                                        \\\
    DEFCCOM=gcc MAKEPROG=gmake MANDIR=man
make %{?_smp_mflags} %{make_flags}

%install
make %{make_flags} INS_BASE=%{buildroot}%{_prefix} INS_RBASE=%{buildroot} install

# Install docu
install -D -m 644 %{SOURCE1} %{buildroot}%{_docdir}/%{name}-rmt
install -D -m 644 -t %{buildroot}%{_docdir}/star AN* CDDL* README Changelog

# Alternatives system for rmt & mt
install -d %{buildroot}%{_sysconfdir}/alternatives
ln -sf %{_sysconfdir}/alternatives/rmt %{buildroot}%{_bindir}/rmt
ln -sf %{_sysconfdir}/alternatives/rmt.1%{ext_man} %{buildroot}%{_mandir}/man1/rmt.1%{ext_man}
ln -sf %{_sysconfdir}/alternatives/mt %{buildroot}%{_bindir}/mt
ln -sf %{_sysconfdir}/alternatives/mt.1%{ext_man} %{buildroot}%{_mandir}/man1/mt.1%{ext_man}

%check
cd %{_builddir}/tests
export PATH=%{buildroot}%{_prefix}/bin:$PATH
# FAILS: 36 commands (30 passed, 6 failed)
make %{?_smp_mflags} || :

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

%postun rmt
if [ ! -f %{_bindir}/srmt ] ; then
   %{_sbindir}/update-alternatives --remove rmt %{_bindir}/srmt
   %{_sbindir}/update-alternatives --remove mt %{_bindir}/smt
fi

%files
%defattr(-, root, root)
%{_docdir}/%{name}
%config(noreplace) %{_sysconfdir}/default/star
%{_bindir}/star
%{_bindir}/tartest
%{_bindir}/ustar
%{_mandir}/man1/match.1%{ext_man}
%{_mandir}/man1/star.1%{ext_man}
%{_mandir}/man1/tartest.1%{ext_man}

%files -n spax
%defattr(-, root, root)
%{_mandir}/man1/spax.1%{ext_man}
%{_bindir}/pax
%{_bindir}/spax

%files rmt
%defattr(-, root, root)
%{_docdir}/%{name}-rmt
%config(noreplace) %{_sysconfdir}/default/rmt
%{_mandir}/man1/srmt.1%{ext_man}
%{_mandir}/man1/smt.1%{ext_man}
%{_bindir}/srmt
%{_bindir}/smt
%ghost %{_bindir}/rmt
%ghost %{_bindir}/mt
%ghost %{_mandir}/man1/rmt.1%{ext_man}
%ghost %{_mandir}/man1/mt.1%{ext_man}
%ghost %{_sysconfdir}/alternatives/rmt
%ghost %{_sysconfdir}/alternatives/mt
%ghost %{_sysconfdir}/alternatives/rmt.1%{ext_man}
%ghost %{_sysconfdir}/alternatives/mt.1%{ext_man}

%changelog
openSUSE Build Service is sponsored by