File rpmlint-mini.spec of Package rpmlint-mini

# spec file for package rpmlint-mini
# Copyright (c) 2011 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
# icecream 0

Name:           rpmlint-mini
BuildRequires:  glib2-devel
BuildRequires:  glib2-devel-static
BuildRequires:  pkg-config
BuildRequires:  python-magic
BuildRequires:  python-xml
BuildRequires:  rpm-python
BuildRequires:  rpmlint
# need to fetch the file from there
BuildRequires:  polkit-default-privs
BuildRequires:  checkbashisms
BuildRequires:  dash
BuildRequires:  libtool
Summary:        Rpm correctness checker
License:        GPL-2.0+
Group:          System/Packages
Version:        1.3
Release:        0
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Source:         desktop-file-utils-0.19.tar.bz2
Source100:      rpmlint-deps.txt
Source101:      rpmlint.wrapper
Source102:      rpmlint-mini.config
Source103:      polkit-default-privs.config

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

    Frederic Lepied <>
    Gwenole Beauchesne <>

%setup -q -n desktop-file-utils-0.19
[[ -r COPYING ]]

pushd src
make desktop-file-validate V=1 DESKTOP_FILE_UTILS_LIBS="%{_libdir}/libglib-2.0.a -lpthread -lrt"

# test if the rpmlint works at all
set +e
/usr/bin/rpmlint rpmlint
test $? -gt 0 -a $? -lt 60 && exit 1
set -e
# okay, lets put it together
mkdir -p $RPM_BUILD_ROOT/opt/testing/share/rpmlint
install -m 755 -D src/desktop-file-validate $RPM_BUILD_ROOT/opt/testing/bin/desktop-file-validate
cp -a /bin/dash /usr/bin/checkbashisms $RPM_BUILD_ROOT/opt/testing/bin
cp -a /usr/share/rpmlint/*.py $RPM_BUILD_ROOT/opt/testing/share/rpmlint
# install config files
install -d -m 755 $RPM_BUILD_ROOT/opt/testing/share/rpmlint/mini
for i in /etc/rpmlint/{rpmgroups,pie,licenses}.config "%{SOURCE103}"; do
  cp $i $RPM_BUILD_ROOT/opt/testing/share/rpmlint/mini
install -m 644 -D /usr/share/rpmlint/config $RPM_BUILD_ROOT/opt/testing/share/rpmlint/config
install -m 644 "%{SOURCE102}" $RPM_BUILD_ROOT/opt/testing/share/rpmlint
# extra data
install -m 755 -d $RPM_BUILD_ROOT/opt/testing/share/rpmlint/data
install -m 644 /etc/polkit-default-privs.standard $RPM_BUILD_ROOT/opt/testing/share/rpmlint/data
install -m 644 -D /usr/include/python%{py_ver}/pyconfig.h $RPM_BUILD_ROOT/opt/testing/include/python%{py_ver}/pyconfig.h
cd %{py_libdir}
for f in $(<%{SOURCE100}); do
  find -path "*/$f" -exec install -D {} $RPM_BUILD_ROOT/opt/testing/%{_lib}/python%{py_ver}/{} \;
install -m 644 /usr/lib/python%{py_ver}/site-packages/ $RPM_BUILD_ROOT/opt/testing/%{_lib}/python%{py_ver}/site-packages/
install -D /usr/bin/python $RPM_BUILD_ROOT/opt/testing/bin/python
cp -a %_libdir/* $RPM_BUILD_ROOT/opt/testing/%{_lib}
cp -a %_libdir/libpython%{py_ver}.so.* $RPM_BUILD_ROOT/opt/testing/%{_lib}
cp -a %_bindir/rpmlint $RPM_BUILD_ROOT/opt/testing/share/rpmlint/
pushd $RPM_BUILD_ROOT/opt/testing/share/rpmlint
PYTHONOPTIMIZE=1 python %py_libdir/ *.py
rm -f $RPM_BUILD_ROOT/opt/testing/share/rpmlint/*.py
rm -rf $RPM_BUILD_ROOT/{usr,etc}
rm -f $RPM_BUILD_ROOT/opt/testing/bin/rpmlint
install -m 755 -D %{SOURCE101} $RPM_BUILD_ROOT/opt/testing/bin/rpmlint
# hackatlon
%define my_requires %{_builddir}/%{?buildsubdir}/%{name}-requires
cat << EOF > %my_requires
cat - > file.list
%{__find_requires} < file.list > requires.list
%{__find_provides} < file.list > provides.list
while read i; do
    grep -F -v "\$i" requires.list >
    mv requires.list
done < provides.list
cat requires.list
rm -f requires.list provides.list file.list
chmod +x %my_requires
%define _use_internal_dependency_generator 0
%define __find_requires %my_requires
%define __find_provides %nil
# final run check to detect python dep changes
$RPM_BUILD_ROOT/opt/testing/bin/python -tt -u -O $RPM_BUILD_ROOT/opt/testing/share/rpmlint/rpmlint.pyo --help || exit 1
echo ".. ok"