File deb.spec of Package deb.900

# spec file for package deb
# Copyright (c) 2012 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

%define debhelper_ver 7.4.17
%define devscripts_ver 2.10.62

Name:           deb
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  libselinux-devel
BuildRequires:  ncurses-devel
BuildRequires:  texlive-latex
BuildRequires:  update-alternatives
BuildRequires:  zlib-devel
PreReq:         /bin/touch
Provides:       debhelper
Provides:       devscripts
Provides:       dpkg
Provides:       dpkg-dev
Provides:       dpkg-doc
Provides:       dselect
Requires:       cpio
Requires:       html2text
Requires:       make
Requires:       patch
Requires:       perl = %{perl_version}
Requires:       update-alternatives
Release:        0
Summary:        Tools for Debian Packages
License:        GPL-2.0+
Group:          System/Packages
Source:         dpkg_%{version}.tar.bz2
Source1:        debhelper_%{debhelper_ver}.tar.bz2
Source2:        devscripts_%{devscripts_ver}.tar.bz2
Source3:        sensible-editor
Patch0:         debhelper-no-localized-manpages.diff
Patch1:         devscripts-buildfix.diff
Patch2:         debhelper-pod2man-no-utf8.patch
Patch3:         devscripts-debcommit-hg16.diff
Patch4:         annotate-output.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%if %suse_version < 1120
%define _libexecdir /usr/lib

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, debhelper, and devscripts.

%package devel
Summary:        Development files for dpkg
Group:          Development/Libraries/C and C++
Requires:       %{name} = %{version}

%description devel
Libraries and header files for dpkg.

%setup -q -n dpkg-%{version} -b 1 -b 2
pushd ..
%if %suse_version < 1130
pushd devscripts-%{devscripts_ver}
%patch1 -p1
%patch3 -p1
%patch4 -p1
# 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

%{?suse_update_config:%{suse_update_config -f}}
export SELINUX_LIBS="-lselinux"
	--with-selinux \
# 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
%ifarch %ix86
sed -i 's/^#define ARCHITECTURE ""/#define ARCHITECTURE "i386"/' config.h
%ifarch ppc powerpc
sed -i 's/^#define ARCHITECTURE ""/#define ARCHITECTURE "powerpc"/' config.h
%ifarch ppc64 powerpc64
sed -i 's/^#define ARCHITECTURE ""/#define ARCHITECTURE "ppc64"/' config.h
make %{?_smp_mflags}
# This makes debhelper man pages
cd ../debhelper
make %{?_smp_mflags} VERSION='%{debhelper_ver}'
# devscripts
# need dpkg-parsechangelog for devscripts
export PATH="$RPM_BUILD_DIR/dpkg-%{version}/scripts:$PATH"
export PERL5LIB="$RPM_BUILD_DIR/dpkg-%{version}/scripts"
cd ../devscripts-%{devscripts_ver}
make %{?_smp_mflags}

# dpkg stuff
# 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}
# devscripts
cd ../devscripts-%{devscripts_ver}
# extras
install -m 755 %{SOURCE3} $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


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

%files lang -f %{name}.lang

%doc %{_docdir}/deb
%doc %{_mandir}/man*/*
%dir %{_sysconfdir}/dpkg
%config(noreplace) %{_sysconfdir}/dpkg/*

%files devel

openSUSE Build Service is sponsored by