File rpmlint.spec of Package rpmlint

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

#!BuildIgnore: rpmlint-mini

Name:           rpmlint
BuildRequires:  obs-service-format_spec_file
BuildRequires:  rpm-python
BuildRequires:  xz
Summary:        Rpm correctness checker
License:        GPL-2.0-or-later
Group:          System/Packages
Version:        1.5
Release:        0
Source1:        rpmlint-checks-master.tar.gz
Source2:        config
Source11:       pie.config
Source12:       licenses.config
Source99:       README.packaging.txt
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 (pull-request #2).
Requires:       python-pybeam
BuildArch:      noarch
# Read README.packaging.txt before making any changes to this
# package
Patch0:         rpmlint-suse.diff
Patch1:         suse-checks.diff
Patch2:         suse-version.diff
Patch3:         suse-url-check.diff
Patch5:         suse-python3-naming-policy.diff
Patch6:         suse-filesystem.diff
Patch7:         suse-pkg-config-check.diff
Patch8:         suse-binarieschecks.diff
Patch9:         no-doc-for-lib.diff
Patch10:        add-scoring-support.diff
Patch11:        suse-filter-exception.diff
Patch12:        usr-arch.diff
Patch13:        script-interpreter-only-for-exec-scripts.diff
Patch14:        sourced-dirs.diff
Patch15:        suse-filter-more-verbose.diff
Patch17:        docdata-examples.diff
Patch18:        0001-Python-3-compatibility-tweaks.patch
Patch19:        yast-provides.diff
Patch20:        xdg-paths-update.diff
Patch22:        better-wrong-script.diff
Patch23:        buildroot-doc.diff
Patch24:        sysv5-init-checks.diff
Patch26:        ignore-non-readable-in-etc.diff
Patch29:        rpmgroup-checks.diff
Patch30:        devel-provide-is-devel-package.diff
Patch31:        only-reg-files-are-scripts.diff
Patch33:        check-buildroot-during-install.diff
Patch34:        verify-buildrequires.diff
Patch35:        fix-versioned-prereq.diff
Patch37:        buildroot-in-scripts.diff
Patch39:        libtool-wrapper-check.diff
Patch41:        perl-versioned-rpath-deps.diff
Patch42:        suse-check-optional-dependencies.diff
Patch46:        locale-support.diff
# not is also in
Patch47:        noarch-lib64.diff
Patch49:        stricter-tags-check.diff
Patch50:        suse-no-run-ldconfig.diff
Patch51:        description-check.diff
# this is the wrong place here
Patch52:        suppress-for-perl-python.diff
Patch54:        locale-update.diff
Patch57:        suse-mono-deps-checks.diff
Patch58:        add-weak-dependencies.diff
Patch60:        selfconflicts-provide.diff
Patch62:        no-badness-return.diff
Patch65:        suse-shlib-devel-dependency.diff
Patch67:        suse-required-lsb-tags.diff
Patch68:        more-verbose-lsb-check.diff
Patch71:        suse-binary-info-compile-opts.diff
Patch72:        version-control-internal-file.diff
Patch73:        avoid-mismatched-libregex.diff
Patch74:        filename-non-utf8-exception.diff
Patch75:        stricter-interpreter-check.diff
Patch76:        confusing-invalid-spec-name.patch
Patch77:        rpmlint-pkg-quoting.diff
Patch78:        suse-g-ir-chech.diff
Patch80:        remove-expand-macros.diff
Patch81:        suse-whitelist-opensuse.diff
Patch84:        extend-suse-conffiles-check.diff
Patch85:        suse-changelog.patch
Patch87:        compressed-backup-regex.diff
# accepted upstream
Patch88:        suse-speccheck-utf8.diff
Patch89:        suse-python-abi-check.diff
# PATCH-FIX-OPENSUSE: - Don't complain about missing man-pages for rc-scripts
Patch91:        suse-manpages-for-rc-scripts.patch
# PATCH-FIX-UPSTREAM: - Fix setgroups error name
Patch92:        rpmlint-1.5-Fix-setgroups-error-name.diff
Patch93:        xdg-check-exception.diff
Patch94:        suse-ignore-specfile-errors.diff
Patch95:        invalid-filerequires.diff
Patch96:        rpmlint-decode-fix.diff
Patch97:        rpmlint-fix-unexpanded-macros-for-array-values.patch
# PATCH-FIX-UPSTREAM: - disallow /var/run and /var/lock
Patch98:        rpmlint-1.5-disallow-var-run-and-var-lock.diff
Patch99:        0001-Set-Python-3.4-magic-number-to-3310.patch
Patch100:       boo1027577-license_tag.patch


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

%setup -q -n rpmlint-%{version} -a1
%patch18 -p1
# needs rediff
### rediff!
%patch76 -p1
%patch91 -p1
%patch92 -p1
%patch93 -p1
%patch96 -p1
%patch97 -p1
%patch98 -p1
%patch99 -p1
%patch100 -p1
cp -p %{SOURCE2} .
# Only move top-level python files 
chmod 0755 rpmlint-checks-master/*.py
mv rpmlint-checks-master/*.py .

make %{?_smp_mflags}

# 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
%__install -m 644  licenses.config %{buildroot}/%{_sysconfdir}/rpmlint/


%config(noreplace) /etc/rpmlint/config
%config %{_sysconfdir}/rpmlint/pie.config
%config %{_sysconfdir}/rpmlint/licenses.config
%dir /etc/rpmlint