From 5d9af7a77bdc6f3071fb8605aaa16554c15dd770 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20R=C4=99korajski?= Date: Sun, 17 Jan 2021 19:12:12 +0100 Subject: [PATCH] - fix running all tests --- fix-tests.patch | 16 ++++++++++++ libc-warnings.patch | 17 ++++++++++++ rpmlint.spec | 64 +++++++++++++++++++++++++++++---------------- 3 files changed, 75 insertions(+), 22 deletions(-) create mode 100644 fix-tests.patch create mode 100644 libc-warnings.patch diff --git a/fix-tests.patch b/fix-tests.patch new file mode 100644 index 0000000..339b00f --- /dev/null +++ b/fix-tests.patch @@ -0,0 +1,16 @@ +--- rpmlint-rpmlint-1.11/LSBCheck.py~ 2019-01-09 19:09:10.000000000 +0100 ++++ rpmlint-rpmlint-1.11/LSBCheck.py 2021-01-17 19:02:52.834763484 +0100 +@@ -33,11 +33,11 @@ + + version = pkg[rpm.RPMTAG_VERSION] + if version and not version_regex.search(version): +- printError(pkg, 'non-lsb-compliant-version', version) ++ printError(pkg, 'non-lsb-compliant-version', version) + + release = pkg[rpm.RPMTAG_RELEASE] + if release and not version_regex.search(release): +- printError(pkg, 'non-lsb-compliant-release', release) ++ printError(pkg, 'non-lsb-compliant-release', release) + + + # Create an object to enable the auto registration of the test diff --git a/libc-warnings.patch b/libc-warnings.patch new file mode 100644 index 0000000..2bb3fc8 --- /dev/null +++ b/libc-warnings.patch @@ -0,0 +1,17 @@ +diff -up rpmlint-rpmlint-1.11/BinariesCheck.py.libcwarn rpmlint-rpmlint-1.11/BinariesCheck.py +--- rpmlint-rpmlint-1.11/BinariesCheck.py.libcwarn 2020-06-16 10:51:01.531299081 -0400 ++++ rpmlint-rpmlint-1.11/BinariesCheck.py 2020-06-16 10:51:18.978910827 -0400 +@@ -557,11 +557,9 @@ class BinariesCheck(AbstractCheck.Abstra + + if not found_libc: + if is_shobj: +- printError(pkg, 'library-not-linked-against-libc', +- fname) ++ printWarning(pkg, 'library-not-linked-against-libc', fname) + else: +- printError(pkg, 'program-not-linked-against-libc', +- fname) ++ printWarning(pkg, 'program-not-linked-against-libc', fname) + + if bin_info.stack: + if bin_info.exec_stack: diff --git a/rpmlint.spec b/rpmlint.spec index 5476b0c..b8acd97 100644 --- a/rpmlint.spec +++ b/rpmlint.spec @@ -7,7 +7,7 @@ Summary: Tool for checking common errors in RPM packages Summary(pl.UTF-8): Narzędzie do sprawdzania pakietów RPM pod kątem częstych błędów Name: rpmlint Version: 1.11 -Release: 0.6 +Release: 0.7 License: GPL v2 Group: Development/Building Source0: https://github.com/rpm-software-management/rpmlint/archive/%{name}-%{version}.tar.gz @@ -23,20 +23,28 @@ Patch5: bash-completion.patch Patch6: revert-9f71923e.patch Patch7: rpm4.15.patch Patch8: python3.patch +Patch9: libc-warnings.patch +Patch10: fix-tests.patch URL: https://github.com/rpm-software-management/rpmlint %if %{with rpm4} BuildRequires: python3 BuildRequires: python3-modules -%{?with_tests:BuildRequires: python3-rpm >= 1:4.16} +%if %{with tests} +BuildRequires: python3-pytest +BuildRequires: python3-flake8 +BuildRequires: python3-rpm >= 1:4.16 +%endif %else BuildRequires: python >= 1:2.6 BuildRequires: python-modules -%{?with_tests:BuildRequires: python-rpm >= 5.4.10-12} +%if %{with tests} +BuildRequires: python-flake8 +BuildRequires: python-pytest +BuildRequires: python-rpm >= 5.4.10-12} +%endif %endif BuildRequires: rpm-pythonprov BuildRequires: rpmbuild(macros) >= 1.673 -# tests require rpmlint in installed packages database -%{?with_tests:BuildRequires: rpmlint} Requires: /bin/bash Requires: /lib/cpp Requires: binutils @@ -97,27 +105,17 @@ Bashowe uzupełnianie parametrów dla polecenia rpmlint. %patch4 -p1 %patch6 -p1 %endif +%patch9 -p1 +%patch10 -p1 cp -p config config.example cp -p %{SOURCE3} config -mv %{name} %{name}.py -%{__sed} -i -e 's,python ./rpmlint,./rpmlint.py,' test.sh - touch __init__.py - %if %{with rpm4} -%{__sed} -i -e '1s,/usr/bin/python,%{__python3},' rpmdiff rpmlint.py -cat <<'EOF' > %{name} -#!/bin/sh -exec %{__python3} -tt -u -O %{py3_sitescriptdir}/%{name}/rpmlint.py "$@" -EOF +%{__sed} -i -e '1s,/usr/bin/python,%{__python3},' rpmdiff rpmlint %else -%{__sed} -i -e '1s,/usr/bin/python,%{__python},' rpmdiff rpmlint.py -cat <<'EOF' > %{name} -#!/bin/sh -exec %{__python} -tt -u -O %{py_sitescriptdir}/%{name}/rpmlint.pyc "$@" -EOF +%{__sed} -i -e '1s,/usr/bin/python,%{__python},' rpmdiff rpmlint %endif %build @@ -138,7 +136,16 @@ test -s GROUPS COMPILE_PYC=1 %if %{with tests} -%{__make} check +%{__make} check \ +%if %{with rpm4} + PYTHON=%{__python3} \ + PYTEST=py.test-3 \ + FLAKE8=flake8-3 \ +%else + PYTHON=%{__python} \ + PYTEST=py.test \ + FLAKE8=flake8 \ +%endif %endif %install @@ -157,10 +164,23 @@ rm -rf $RPM_BUILD_ROOT BINDIR=%{_bindir} \ DESTDIR=$RPM_BUILD_ROOT -#install -p %{name} $RPM_BUILD_ROOT%{_bindir}/%{name} +%if %{with rpm4} +%{__mv} $RPM_BUILD_ROOT%{_bindir}/rpmlint $RPM_BUILD_ROOT%{py3_sitescriptdir}/%{name}/rpmlint.py +cat <<'EOF' > $RPM_BUILD_ROOT%{_bindir}/rpmlint +#!/bin/sh +exec %{__python3} -tt -u -O %{py3_sitescriptdir}/%{name}/rpmlint.py "$@" +EOF +%else +%{__mv} $RPM_BUILD_ROOT%{_bindir}/rpmlint $RPM_BUILD_ROOT%{py_sitescriptdir}/%{name}/rpmlint.py +cat <<'EOF' > $RPM_BUILD_ROOT%{_bindir}/rpmlint +#!/bin/sh +exec %{__python} -tt -u -O %{py_sitescriptdir}/%{name}/rpmlint.pyc "$@" +EOF +%endif + install -d $RPM_BUILD_ROOT%{_datadir}/%{name} -%{!?with_rpm4:cp -p GROUPS $RPM_BUILD_ROOT%{_datadir}/%{name}} cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_datadir}/%{name}/config +%{!?with_rpm4:cp -p GROUPS $RPM_BUILD_ROOT%{_datadir}/%{name}} %if %{without rpm4} %py_ocomp $RPM_BUILD_ROOT%{py_sitescriptdir} -- 2.44.0