File rpmlint.spec of Package rpmlint

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


#!BuildIgnore: rpmlint-mini

Name:           rpmlint
BuildRequires:  obs-service-format_spec_file
BuildRequires:  rpm-python
BuildRequires:  xz
Summary:        Rpm correctness checker
License:        GPL-2.0+
Group:          System/Packages
Version:        1.6
Release:        0
Source0:        https://downloads.sourceforge.net/project/rpmlint/rpmlint-%{version}.tar.xz
Source1:        rpmlint-checks-master.tar.gz
Source2:        config
Source3:        config.in
Source11:       pie.config
Source12:       licenses.config
Source98:       update_git.sh
Source99:       README.packaging.txt
Source100:      syntax-validator.py
Url:            https://sourceforge.net/projects/rpmlint/
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Requires:       /usr/bin/readelf
Requires:       bash
Requires:       checkbashisms
Requires:       cpio
Requires:       dash
Requires:       desktop-file-utils
Requires:       file
Requires:       findutils
Requires:       python-magic
Requires:       rpm-python
# Requirement for ErlangCheck.py (pull-request #2).
Requires:       python-pybeam
#
# Read README.packaging.txt before making any changes to this
# package
#
# PATCHLIST BEGIN
Patch00:        rpmlint-suse.diff
Patch01:        suse-checks.diff
Patch02:        suse-version.diff
Patch03:        suse-url-check.diff
Patch04:        suse-python3-naming-policy.diff
Patch05:        suse-filesystem.diff
Patch06:        suse-pkg-config-check.diff
Patch07:        suse-binarieschecks.diff
Patch08:        no-doc-for-lib.diff
Patch09:        suse-filter-exception.diff
Patch10:        usr-arch.diff
Patch11:        script-interpreter-only-for-exec-sc.diff
Patch12:        sourced-dirs.diff
Patch13:        suse-filter-more-verbose.diff
Patch14:        docdata-examples.diff
Patch15:        yast-provides.diff
Patch16:        xdg-paths-update.diff
Patch17:        better-wrong-script.diff
Patch18:        buildroot-doc.diff
Patch19:        rpmgroup-checks.diff
Patch20:        devel-provide-is-devel-package.diff
Patch21:        only-reg-files-are-scripts.diff
Patch22:        buildroot-in-scripts.diff
Patch23:        libtool-wrapper-check.diff
Patch24:        suse-check-optional-dependencies.diff
Patch25:        noarch-lib64.diff
Patch26:        suse-no-run-ldconfig.diff
Patch27:        description-check.diff
Patch28:        add-weak-dependencies.diff
Patch29:        selfconflicts-provide.diff
Patch30:        no-badness-return.diff
Patch31:        suse-shlib-devel-dependency.diff
Patch32:        version-control-internal-file.diff
Patch33:        avoid-mismatched-libregex.diff
Patch34:        filename-non-utf8-exception.diff
Patch35:        stricter-interpreter-check.diff
Patch36:        confusing-invalid-spec-name.diff
Patch37:        rpmlint-pkg-quoting.diff
Patch38:        suse-g-ir-chech.diff
Patch39:        remove-expand-macros.diff
Patch40:        suse-whitelist-opensuse.diff
Patch41:        extend-suse-conffiles-check.diff
Patch42:        compressed-backup-regex.diff
Patch43:        suse-speccheck-utf8.diff
Patch44:        suse-python-abi-check.diff
Patch45:        suse-manpages-for-rc-scripts.diff
Patch46:        suse-ignore-specfile-errors.diff
Patch47:        invalid-filerequires.diff
Patch48:        suse-sysv-init-checks.diff
Patch49:        check-for-self-provides.diff
Patch50:        save-content-to-an-array.diff
Patch51:        add-check-for-tmpfiles-created-at-r.diff
Patch52:        fix-ghost-file-handling.diff
Patch53:        remove-files-attr-not-set-check.diff
Patch54:        move-ghost-file-check-to-TmpFilesCh.diff
# PATCHLIST END
# BuildArch must at the and. is a bug: https://bugzilla.suse.com/show_bug.cgi?id=926766
BuildArch:      noarch

%py_requires

%description
Rpmlint is a tool to check common errors on rpm packages. Binary and
source packages can be checked.

%prep
%autosetup -n rpmlint-%{version} -a1 -p1

cp -p %{SOURCE2} .
# Only move top-level python files 
chmod 0755 rpmlint-checks-master/*.py
mv rpmlint-checks-master/*.py .

%build
make %{?_smp_mflags}

%install
make install DESTDIR=$RPM_BUILD_ROOT
# the provided bash-completion does not work and only prints bash errors
rm -rf  $RPM_BUILD_ROOT/etc/bash_completion.d
mv $RPM_BUILD_ROOT/etc/rpmlint/config $RPM_BUILD_ROOT/usr/share/rpmlint/config
head -n 8 $RPM_BUILD_ROOT/usr/share/rpmlint/config > $RPM_BUILD_ROOT/etc/rpmlint/config
# make sure that the package is sane
python -tt %{SOURCE100} $RPM_BUILD_ROOT/usr/share/rpmlint/*.py $RPM_BUILD_ROOT/usr/share/rpmlint/config
%__install -m 644 %{SOURCE11} %{buildroot}/%{_sysconfdir}/rpmlint/

cp %{SOURCE12} licenses.config
# note there is a tab character behind the -d, so don't copy&paste lightly
cut '-d	' -f1 /usr/lib/obs/service/format_spec_file.files/licenses_changes.txt | tail -n +2 | sort -u | while read l; do
  sed -i -e "s/\(#VALIDLICENSES\)/\1\n	'$l',/" licenses.config
done
%__install -m 644  licenses.config %{buildroot}/%{_sysconfdir}/rpmlint/

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root,0755)
%doc COPYING ChangeLog INSTALL README*
%{_prefix}/bin/*
%{_prefix}/share/rpmlint
%config(noreplace) /etc/rpmlint/config
%config %{_sysconfdir}/rpmlint/pie.config
%config %{_sysconfdir}/rpmlint/licenses.config
%dir /etc/rpmlint
/usr/share/man/man1/rpmlint.1.gz
/usr/share/man/man1/rpmdiff.1.gz

%changelog
openSUSE Build Service is sponsored by