File devscripts.spec of Package devscripts

#
# spec file for package devscripts
#
# Copyright (c) 2013 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/
#


%{!?py_ver: %global py_ver %(echo `python -c "import sys; sys.stdout.write(sys.version[:3])"`)}
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}

Name:           devscripts
Version:        2.12.6
Release:        0
Summary:        Scripts to make the life of a Debian Package maintainer easier
License:        GPL-2.0+ and GPL-2.0 and GPL-3.0+ and GPL-3.0 and Artistic-2.0 and GPL-1.0+ or Artistic-1.0 and SUSE-Public-Domain and ISC
Group:          Development/Tools/Building
Source0:        http://ftp.de.debian.org/debian/pool/main/d/devscripts/devscripts_%{version}.tar.gz
# PATCH-FIX-UPSTREAM remove bash auto completion and fix docbook template directories path.
Patch0:         devscripts-2.11.7-buildfix.patch
# PATCH-FIX-UPSTREAM hg can't commit empty, fix it.
Patch1:         devscripts-2.11.7-debcommit-hg16.patch
# PATCH-FIX-UPSTREAM remove --utf8 since we only build En manpages.
Patch2:         devscripts-pod2man-no-utf8.patch
# PATCH-FIX-UPSTREAM remove unrecognized --install-layout=deb from scripts/setup.py and fix prefix
Patch3:         devscripts-2.11.7-remove-install-layout-deb.patch
# PATCH-FIX-OPENSUSE support old versions of File::Patch (SLE 11)
Patch4:         devscripts-old-File-Path.patch
# PATCH-FIX-UPSTREAM fix_pod_syntax.patch asterios.dramis@gmail.com -- Fix pod syntax (fixes build with perl 5.18)
Patch5:         fix_pod_syntax.patch
BuildRequires:  dpkg-devel >= 1.15.6
BuildRequires:  python-devel
# we are sorry to drop sles10 support, but no setuptools
BuildRequires:  python-setuptools
BuildRequires:  zlib-devel
Requires:       checkbashisms >= %{version}
Requires:       dpkg
Requires:       html2text
Requires:       perl
Provides:       deb:%{_bindir}/debchange
BuildRequires:  docbook-xsl-stylesheets
BuildRequires:  libxslt
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%if 0%{?suse_version}
BuildRequires:  sgmltool
BuildRequires:  texlive-latex
%define _xsl_stylesheet /usr/share/xml/docbook/stylesheet/nwalsh/current/manpages/docbook.xsl
%if 0%{?suse_version} < 1120
%define _libexecdir /usr/lib
%endif
%endif
%if 0%{?fedora_version}
BuildRequires:  tetex-latex
%define _xsl_stylesheet /usr/share/sgml/docbook/xsl-stylesheets/manpages/docbook.xsl
%endif
%if 0%{?rhel_version}
BuildRequires:  tetex-latex
%define _xsl_stylesheet /usr/share/sgml/docbook/xsl-stylesheets/manpages/docbook.xsl
%endif
%if 0%{?centos_version}
BuildRequires:  tetex-latex
%define _xsl_stylesheet /usr/share/sgml/docbook/xsl-stylesheets/manpages/docbook.xsl
%endif

%description
Collection of scripts for working on Debian packages.
Examples:
 - bts: a command-line tool for manipulating the Debian Bug
   Tracking System
 - dcontrol: remotely query package and source control files
   for all Debian distributions
 - debchange/dch: automagically add entries to
   debian/changelog files
 - debsign, debrsign: sign a .changes/.dsc pair without
   needing any of the rest of the package to be present;
   can sign the pair remotely or fetch the pair from a
   remote machine for signing
 - diff2patches: extract patches from a .diff.gz file
   placing them under debian/ or, if present, debian/patches
 - licensecheck: attempt to determine the license of source
   files
 - uscan: scan upstream sites for new releases of packages

%package -n checkbashisms
Summary:        Tool for checking /bin/sh scripts for possible bashisms 
License:        GPL-2.0+
Group:          Development/Tools/Building
Provides:       deb:/usr/bin/checkbashisms
Provides:       devscripts:/usr/bin/checkbashisms
Requires:       perl
%if 0%{?suse_version} && 0%{?suse_version} < 1120
#for the benefit of SLE
%else
BuildArch:      noarch
%endif

%description -n checkbashisms
checkbashisms performs basic checks on /bin/sh shell scripts for the possible
presence of bashisms.  It takes the names of the shell scripts on the command
line, and outputs warnings if possible bashisms are detected.

%prep
%setup -q

%patch0 -p1
%if 0%{?suse_version} && 0%{?suse_version} < 1130
%patch2 -p1
%patch4 -p1
%endif
%patch1 -p1
%patch3 -p1
%patch5 -p1

%build
make %{?_smp_mflags} XSL_STYLESHEET="%{_xsl_stylesheet}"

%install
%{__make} install DESTDIR=%{?buildroot} XSL_STYLESHEET="%{_xsl_stylesheet}"

install -d %{buildroot}%{_mandir}/man1/
install -d %{buildroot}%{_mandir}/man5/
install -m 644 scripts/*.1 %{buildroot}%{_mandir}/man1/
install -m 644 scripts/*.5 %{buildroot}%{_mandir}/man5/
while read target link; do
  if [ -d $(dirname "%{buildroot}$link") ]; then
    ln -sf $target %{buildroot}$link
  fi
done <debian/links
# fix docs
mkdir -pv %{buildroot}%{_docdir}
if [ %{_datadir}/doc != %{_docdir} ]; then
  mv %{buildroot}%{_datadir}/doc/devscripts %{buildroot}%{_docdir}
fi
chmod -x %{buildroot}%{_docdir}/devscripts/README
install -m644 debian/copyright %{buildroot}%{_docdir}/devscripts/copyright
install -m644 debian/changelog %{buildroot}%{_docdir}/devscripts/changelog

%files
%defattr(-,root,root)
%doc %{_docdir}/devscripts
%doc %{_mandir}/man*/*
%{_bindir}/*
%{python_sitelib}/devscripts/
%{python_sitelib}/devscripts-%{version}-py%{py_ver}.egg-info/
/usr/lib/devscripts
%{_datadir}/devscripts
%exclude %{_mandir}/man1/checkbashisms.1.gz
%exclude %{_bindir}/checkbashisms

%files -n checkbashisms
%defattr(-,root,root)
%doc %{_mandir}/man1/checkbashisms.1.gz
%{_bindir}/checkbashisms

%changelog