File yup.spec of Package yup

#
# spec file for package yup
#
# Copyright (c) 2016 SUSE LINUX Products 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:           yup
%if 0%{suse_version} < 1010
BuildRequires:  libidn-devel
BuildRequires:  openssl-devel
%define     curl_name       curl
%define     curl_version    7.15.5
%else
BuildArch:      noarch
%endif

#Compat macro for new _fillupdir macro introduced in Nov 2017
%if ! %{defined _fillupdir}
  %define _fillupdir %{_localstatedir}/adm/fillup-templates
%endif

Version:        232
Release:        2.1
Summary:        "Yum Update Proxy" for SLE 10 Maintenance
License:        GPL-2.0+
Group:          System/YaST
Source0:        yup.sh
Source1:        yup.sysconfig
Source2:        yup.1.pod
Source3:        COPYING.GPL
Source4:        yup.permissions
Source5:        yup2zlm.sh
Source6:        yup2zlm.sysconfig
Source7:        Advanced_SLES10_Patching_0.2.pdf
Source8:        YUP-SLE10SP1-notes.pdf
Source9:        switch-enterprise-nu-mirror
%if 0%{suse_version} < 1010
Source10:       %{curl_name}-%{curl_version}.tar.bz2
Patch2:         %{curl_name}-%{curl_version}-lfs.patch
Patch3:         %{curl_name}-%{curl_version}-aliasing.patch
Patch4:         %{curl_name}-%{curl_version}-ipv6tests.patch
Patch5:         %{curl_name}-%{curl_version}-epsv-firewall.patch
Patch6:         %{curl_name}-%{curl_version}-CVE-2006-1061.patch
%endif
Source11:       yup12.pl
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  perl
Requires(pre):         %fillup_prereq
Requires:       curl
Requires:       perl(LWP)
Requires:       perl(XML::Bare)

%description 
This packages allows to configure an update-mirror for Novell
maintenance packages for SUSE Linux Enterprise 10.

Please make sure, that the number of systems to serve with the mirrored
packages is in compliance with the number of subscriptions you are
allowed to exercise according to your contract with Novell.



Authors:
--------
    Marcus Meissner
    Eberhard Moenkeberg
    Matthias Eckermann

%if 0%{suse_version} < 1010
%endif

%prep
%if 0%{suse_version} < 1010
%setup -T -c -n %{curl_name}-%{curl_version} -a 10
cd %{curl_name}-%{curl_version}
%patch2
##- %patch3
%patch4
%patch5
##- %patch6
%else
%setup -T -c
%endif

%build
pod2man --center=" " --release="%{version}-%{release}" --date="$(date)" %{S:2} > yup.$$$$;
perl -p -e 's/.if n .na/.\\\".if n .na/;' yup.$$$$ > yup.1;
rm -f yup.$$$$
%if 0%{suse_version} < 1010
cd %{curl_name}-%{curl_version}
autoreconf -fi
CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing" 	\
./configure			 		\
			--prefix=%{_prefix} 	\
			--program-suffix=-yup	\
			--enable-ipv6 		\
			--with-ssl 		\
			--enable-static		\
			--disable-shared	\
			--libdir=%{_libdir}
make %{?jobs:-j%jobs}
%endif

%install
if [ -n "$RPM_BUILD_ROOT" ] ; then
   [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
fi
%if 0%{suse_version} < 1010
cd %{curl_name}-%{curl_version}
make install DESTDIR=$RPM_BUILD_ROOT mandir=%{_mandir}
if [ -n "$RPM_BUILD_ROOT" ] ; then
	rm -rf $RPM_BUILD_ROOT/usr/src
	rm -rf $RPM_BUILD_ROOT/usr/%{_libdir}
	rm -rf $RPM_BUILD_ROOT/%{_libdir}
	rm -rf $RPM_BUILD_ROOT/usr/include
	rm -rf $RPM_BUILD_ROOT/usr/share/man
	rm -rf $RPM_BUILD_ROOT/usr/bin/curl-config-yup
	rm -rf $RPM_BUILD_ROOT/usr/share/curl/curl-ca-bundle.crt
fi
cd ..
%endif
mkdir -p	$RPM_BUILD_ROOT/usr/sbin		\
		$RPM_BUILD_ROOT/etc/permissions.d	\
		$RPM_BUILD_ROOT/usr/share/man/man1
mkdir -p %{buildroot}%{_fillupdir}
install %{S:0}	$RPM_BUILD_ROOT/usr/sbin/yup
install %{S:11}	$RPM_BUILD_ROOT/usr/sbin/yup12
cp -a %{S:7} .
cp -a %{S:8} .
cp -a %{S:9} .
install %{S:5}	$RPM_BUILD_ROOT/usr/sbin/yup2zlm
install %{S:6}	%{buildroot}%{_fillupdir}/sysconfig.yup2zlm
install %{S:1}	%{buildroot}%{_fillupdir}/sysconfig.yup
install -m 644 yup.1	$RPM_BUILD_ROOT/usr/share/man/man1/yup.1
%if 0%{suse_version} < 1010
sed -i -e "s,/usr/bin/curl,/usr/bin/curl-yup,g" $RPM_BUILD_ROOT/usr/sbin/yup
sed -i -e "s,/usr/bin/curl,/usr/bin/curl-yup,g" %{buildroot}%{_fillupdir}/sysconfig.yup
sed -i -e "s,/usr/bin/curl,/usr/bin/curl-yup,g" $RPM_BUILD_ROOT/usr/share/man/man1/yup.1
%endif
gzip -9 	$RPM_BUILD_ROOT/usr/share/man/man1/yup.1
cp -a %{S:3} .
#
rpm -qa --queryformat='%%{name}/%%{version}/%%{release}/%%{arch}\n'| sort | bzip2 -9 > USEDFORBUILD.bz2
#

%files
%defattr(-,root,root)
%attr(700, root, root) /usr/sbin/yup
%attr(700, root, root) /usr/sbin/yup12
%attr(700, root, root) /usr/sbin/yup2zlm
%attr(644, root, root) /usr/share/man/man1/yup.1.gz
%attr(600, root, root) %{_fillupdir}/sysconfig.yup
%doc COPYING.GPL
%if 0%{suse_version} < 1010
%doc %{curl_name}-%{curl_version}/{CHANGES,README,COPYING} 
%doc %{curl_name}-%{curl_version}/docs/{BUGS,CONTRIBUTE,FAQ,FEATURES,INTERNALS,MANUAL,RESOURCES,TODO,TheArtOfHttpScripting}
%{_prefix}/bin/curl-yup
%endif
%doc Advanced_SLES10_Patching_0.2.pdf YUP-SLE10SP1-notes.pdf switch-enterprise-nu-mirror
%attr(600, root, root) %{_fillupdir}/sysconfig.yup2zlm
%doc USEDFORBUILD.bz2

%post
%{fillup_only -n yup}
%{fillup_only -n yup2zlm}
chmod go-r /etc/sysconfig/yup*

%clean
if [ -n "$RPM_BUILD_ROOT" ] ; then
   [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
fi

%changelog
openSUSE Build Service is sponsored by