File subscription-tools.spec of Package subscription-tools.8088

#
# spec file for package subscription-tools
#
# Copyright (c) 2018 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:           subscription-tools
Version:        1.1.6
Release:        0
Summary:        Tools for testing compliance and registration status
License:        GPL-2.0
Group:          System/Base
Url:            http://www.suse.com
Source:         %{name}-%{version}.tar.bz2
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Requires:       gpg2
Requires:       hwinfo
Requires:       perl = %{perl_version}
Requires:       perl-Config-IniFiles
Requires:       perl-URI
Requires:       perl-XML-Simple
Requires:       perl-gettext
Requires:       rpm
Requires:       util-linux
Requires:       perl(Date::Parse)
Requires:       perl(JSON)
%if 0%{?suse_version} >=1210
BuildRequires:  pkgconfig(systemd)
%{?systemd_requires}
%endif
BuildRequires:  perl
# required to run the tests
BuildRequires:  gpg2
BuildRequires:  hwinfo
BuildRequires:  jing
BuildRequires:  perl-Config-IniFiles
BuildRequires:  perl-URI
BuildRequires:  perl-XML-Simple
BuildRequires:  perl-gettext
BuildRequires:  util-linux
BuildRequires:  perl(Date::Parse)
BuildRequires:  perl(JSON)
BuildArch:      noarch

%description
This package containst tools for testing compliance and registration
status.

%prep
%setup -q

%build
mkdir man
cd bin
for prog in *; do
    progfile=`echo "$prog" | sed 's/\(.*\)\.pod/\1/'`
    if pod2man --center=" " --release="%{version}-%{release}" --date="$(date)" $prog > $prog.$$$$ ; then
        perl -p -e 's/.if n .na/.\\\".if n .na/;' $prog.$$$$ > ../man/$progfile.1;
    fi
    rm -f $prog.$$$$
done
cd -

%install
make DESTDIR=$RPM_BUILD_ROOT BINDIR=%{_bindir} INITD=%_initrddir SYSTEMD=%{_unitdir} install
mkdir -p $RPM_BUILD_ROOT%{_mandir}/man1
cd man
for manp in *.1; do
    install -m 644 $manp $RPM_BUILD_ROOT%{_mandir}/man1/$manp
done
cd -

%find_lang %{name}

%check
make test

%clean
rm -rf $RPM_BUILD_ROOT

%if 0%{?suse_version} >= 1210
%pre
%service_add_pre compliance.service
%endif

%post
%if 0%{?suse_version} < 1210
if ! grep -q "<interactive>.*boot.compliance" /etc/insserv.conf ; then
   sed -i -e "s@^\(<interactive>.*$\)@\1 boot.compliance@" /etc/insserv.conf
fi
%{insserv_force_if_yast boot.compliance}
%else
%service_add_post compliance.service
%endif

%if 0%{?suse_version} >= 1210
%preun
%service_del_preun compliance.service
%endif

%postun
%if 0%{?suse_version} >= 1210
%service_del_postun compliance.service
%else
%{insserv_cleanup}
%endif

%files -f %{name}.lang
%defattr(-, root, root)
%doc COPYING README
%doc %attr(644, root, root) %{_mandir}/man1/*
%dir %{_datadir}/YaST2
%dir %{_datadir}/YaST2/modules
%{perl_vendorlib}/SUSE
%{_datadir}/YaST2/modules/YaPI
%{_bindir}/*
%_initrddir/boot.compliance
%if 0%{?suse_version} >= 1210
%{_unitdir}/compliance.service
%endif

%changelog
openSUSE Build Service is sponsored by