File deb.spec of Package deb

#
# spec file for package deb (Version 1.15.0)
#
# Copyright (c) 2009 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/
#

# norootforbuild

%define debhelper_ver 7.3.12

Name:           deb
BuildRequires:  gcc-c++ ncurses-devel texlive-latex update-alternatives zlib-devel
BuildRequires:  libselinux-devel
BuildRequires:  fdupes
Url:            http://www.debian.org
License:        GPL v2 or later
Group:          System/Packages
PreReq:         /bin/touch
Provides:       dpkg dpkg-dev debhelper dselect dpkg-doc
Requires:       perl = %{perl_version}
Requires:       cpio patch make html2text update-alternatives
AutoReqProv:    on
Version:        1.15.0
Release:        13
Summary:        Tools for Debian Packages
Source:         dpkg_%{version}.tar.bz2
Source1:        debhelper_%{debhelper_ver}.tar.bz2
Patch0:         debhelper-no-localized-manpages.diff
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
This package contains tools for working with Debian packages. It makes
it possible to create and extract Debian packages. If Alien is
installed, the packages can be converted to RPMs.

This package contains the following Debian packages: dpkg, dselect,
dpkg-doc, dpkg-dev, and debhelper.



Authors:
--------
    Klee Dienes <klee@mit.edu>
    Joey Hess <joeyh@master.debian.org>

%lang_package
%prep
%setup -q -n dpkg-%{version} -b 1
cd ..
%patch0
cd -
# update arch table
sed -n '/linux-gnu/ s/linux-gnu/suse-linux/p' debian/archtable > debian/archtable.tmp
cat debian/archtable.tmp >> debian/archtable
rm debian/archtable.tmp

%build
%{?suse_update_config:%{suse_update_config -f}}
export CFLAGS="$RPM_OPT_FLAGS"
export SELINUX_LIBS="-lselinux"
%configure\
	--with-selinux \
	--localstatedir=%{_localstatedir}/lib\
	--libdir=%{_prefix}/lib
# configure somehow does not detect architecture correctly in OBS (bnc#469337), so 
# let's do an awful hack and fix it in config.h
%ifarch x86_64
sed -i 's/^#define ARCHITECTURE ""/#define ARCHITECTURE "amd64"/' config.h
%endif
%ifarch %ix86
sed -i 's/^#define ARCHITECTURE ""/#define ARCHITECTURE "i386"/' config.h
%endif
%ifarch ppc powerpc
sed -i 's/^#define ARCHITECTURE ""/#define ARCHITECTURE "powerpc"/' config.h
%endif
%ifarch ppc64 powerpc64
sed -i 's/^#define ARCHITECTURE ""/#define ARCHITECTURE "ppc64"/' config.h
%endif
make %{?jobs:-j%jobs}
# This makes debhelper man pages
cd ../debhelper
make VERSION='%{debhelper_ver}'

%install
##
# dpkg stuff
##
%makeinstall
# locales
%{find_lang} dpkg
%{find_lang} dselect
%{find_lang} dpkg-dev
cat dpkg.lang dselect.lang dpkg-dev.lang > %{name}.lang
# docs
install -d -m 755 $RPM_BUILD_ROOT/%{_docdir}/deb/dpkg
install -m 644 ABOUT-NLS $RPM_BUILD_ROOT/%{_docdir}/deb/dpkg
install -m 644 AUTHORS $RPM_BUILD_ROOT/%{_docdir}/deb/dpkg
install -m 644 COPYING $RPM_BUILD_ROOT/%{_docdir}/deb/dpkg
install -m 644 doc/triggers.txt $RPM_BUILD_ROOT/%{_docdir}/deb/dpkg
install -m 644 INSTALL $RPM_BUILD_ROOT/%{_docdir}/deb/dpkg
install -m 644 NEWS $RPM_BUILD_ROOT/%{_docdir}/deb/dpkg
install -m 644 README* $RPM_BUILD_ROOT/%{_docdir}/deb/dpkg
install -m 644 THANKS $RPM_BUILD_ROOT/%{_docdir}/deb/dpkg
install -m 644 TODO $RPM_BUILD_ROOT/%{_docdir}/deb/dpkg
install -m 644 debian/changelog $RPM_BUILD_ROOT/%{_docdir}/deb/dpkg
##
# debhelper stuff
##
cd ../debhelper
# autoscripts
install -d -m 755 $RPM_BUILD_ROOT%{_datadir}/debhelper/autoscripts
install -m 644 autoscripts/* $RPM_BUILD_ROOT%{_datadir}/debhelper/autoscripts
# perl modules:
install -d -m 755 $RPM_BUILD_ROOT%{perl_vendorlib}/Debian/Debhelper
install -d -m 755 $RPM_BUILD_ROOT%{perl_vendorlib}/Debian/Debhelper/Sequence
install -m 644 Debian/Debhelper/Sequence/*.pm $RPM_BUILD_ROOT%{perl_vendorlib}/Debian/Debhelper/Sequence
install -m 644 Debian/Debhelper/*.pm $RPM_BUILD_ROOT%{perl_vendorlib}/Debian/Debhelper
# docs:
install -d -m 755 $RPM_BUILD_ROOT%{_docdir}/deb/debhelper/examples
install -m 644 examples/* $RPM_BUILD_ROOT%{_docdir}/deb/debhelper/examples
install -m 644 doc/* $RPM_BUILD_ROOT%{_docdir}/deb/debhelper
install -m 644 debian/{changelog,copyright} $RPM_BUILD_ROOT%{_docdir}/deb/debhelper
# man pages:
install -d -m 755 $RPM_BUILD_ROOT%{_mandir}/man1
install -d -m 755 $RPM_BUILD_ROOT%{_mandir}/man7
install -m 644 *.1 $RPM_BUILD_ROOT%{_mandir}/man1
install -m 644 debhelper.7 $RPM_BUILD_ROOT%{_mandir}/man7
# binaries:
install -d -m 755 $RPM_BUILD_ROOT%{_bindir}
install -m 755 dh_*[^1-9] $RPM_BUILD_ROOT%{_bindir}
##
# remove update-alternatives stuff (included in separate package)
##
rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/alternatives
rm -rf $RPM_BUILD_ROOT%{_localstatedir}/lib/dpkg/alternatives
rm -rf $RPM_BUILD_ROOT%{_bindir}/update-alternatives
rm -rf $RPM_BUILD_ROOT%{_sbindir}/update-alternatives
rm -rf $RPM_BUILD_ROOT%{_mandir}/man8/update-alternatives.8
rm -rf $RPM_BUILD_ROOT%{_mandir}/*/man8/update-alternatives.8
##
# remove duplicate files
##
%fdupes %buildroot

%clean
rm -rf $RPM_BUILD_ROOT

%post
cd %{_localstatedir}/lib/dpkg
for f in diversions statoverride status ; do
    [ ! -f $f ] && touch $f
done
exit 0

%files lang -f %{name}.lang

%files
%defattr(-,root,root)
%doc %{_docdir}/deb
%doc %{_mandir}/fr
%doc %{_mandir}/ja
%doc %{_mandir}/sv
%doc %{_mandir}/es
%doc %{_mandir}/pt_BR
%doc %{_mandir}/ru
%doc %{_mandir}/de
%doc %{_mandir}/pl
%doc %{_mandir}/hu
%doc %{_mandir}/man*/*
%dir %{_sysconfdir}/dpkg
%config(noreplace) %{_sysconfdir}/dpkg/*
%{_bindir}/*
%{_sbindir}/*
%{_prefix}/lib/dpkg
%{_datadir}/dpkg
%{_localstatedir}/lib/dpkg
%{_datadir}/debhelper
%{perl_vendorlib}/Debian
%{perl_vendorlib}/Dpkg
%{perl_vendorlib}/Dpkg.pm

%changelog
openSUSE Build Service is sponsored by