Accepting request 901385 from home:StevenK:branches:devel:openSUSE:Factory:rpmlint

- Update to require rpmlint >= 2.
  * Due to rpmlint now being a proper Python package, build a virtual
    environment, and copy all Python requirements into it.
  * Drop rpmlint-deps.txt as no longer required.
  * Lightly rewrite rpmlint.wrapper to support the new world order.
- Drop the config snippets, they are not required with rpmlint 2.
- Renumber Source numbers.
- Filter some more warnings in rpmlint-mini.rpmlintrc.

OBS-URL: https://build.opensuse.org/request/show/901385
OBS-URL: https://build.opensuse.org/package/show/devel:openSUSE:Factory:rpmlint/rpmlint-mini?expand=0&rev=138
This commit is contained in:
Dirk Mueller 2021-06-24 06:34:00 +00:00 committed by Git OBS Bridge
parent 6957be9cb2
commit 3f50ca1e44
12 changed files with 63 additions and 287 deletions

View File

@ -1,12 +0,0 @@
<services>
<service name="tar_scm" mode="disabled">
<param name="versionformat">master</param>
<param name="url">https://github.com/openSUSE/rpmlint-security-whitelistings</param>
<param name="scm">git</param>
<param name="changesgenerate">enable</param>
</service>
<service name="recompress" mode="disabled">
<param name="compression">xz</param>
<param name="file">*.tar</param>
</service>
</services>

View File

@ -1,4 +0,0 @@
<servicedata>
<service name="tar_scm">
<param name="url">https://github.com/openSUSE/rpmlint-security-whitelistings</param>
<param name="changesrevision">202314af16e2bec213d879ad12e68a01825c7a8b</param></service></servicedata>

View File

@ -1 +0,0 @@
setOption("AppDataChecker", ("appstream-util", "--nonet", "validate-relax"))

View File

@ -1,3 +0,0 @@
# vim: syntax=python
setOption("PolkitPrivsFiles", [ "/opt/testing/share/rpmlint/data/polkit-default-privs.standard" ])
setOption("PolkitRulesWhitelist", [ "/opt/testing/share/rpmlint/data/polkit-rules-whitelist.json" ])

View File

@ -1,155 +0,0 @@
abc.py
base64.py
bisect.py
_bootlocale.py
calendar.py
codecs.py
cp437.py
_collections_abc.py
collections/__init__.py
_compat_pickle.py
configparser.py
contextlib.py
copy.py
copyreg.py
datetime.py
dummy_threading.py
_dummy_thread.py
email/base64mime.py
email/charset.py
email/_encoded_words.py
email/encoders.py
email/errors.py
email/feedparser.py
email/header.py
email/__init__.py
email/iterators.py
email/message.py
email/_parseaddr.py
email/parser.py
email/_policybase.py
email/quoprimime.py
email/utils.py
encodings/aliases.py
encodings/ascii.py
encodings/__init__.py
encodings/latin_1.py
encodings/utf_8.py
enum.py
fnmatch.py
functools.py
__future__.py
genericpath.py
getopt.py
glob.py
hashlib.py
heapq.py
http/client.py
http/__init__.py
imp.py
importlib/__init__.py
importlib/machinery.py
importlib/util.py
io.py
json/decoder.py
json/scanner.py
json/encoder.py
json/__init__.py
json/tool.py
keyword.py
lib-dynload/array.cpython-3*-*-linux-gnu*.so
lib-dynload/_asyncio.cpython-3*-*-linux-gnu*.so
lib-dynload/audioop.cpython-3*-*-linux-gnu*.so
lib-dynload/binascii.cpython-3*-*-linux-gnu*.so
lib-dynload/_bisect.cpython-3*-*-linux-gnu*.so
lib-dynload/_blake2.cpython-3*-*-linux-gnu*.so
lib-dynload/cmath.cpython-3*-*-linux-gnu*.so
lib-dynload/_csv.cpython-3*-*-linux-gnu*.so
lib-dynload/_datetime.cpython-3*-*-linux-gnu*.so
lib-dynload/fcntl.cpython-3*-*-linux-gnu*.so
lib-dynload/grp.cpython-3*-*-linux-gnu*.so
lib-dynload/_heapq.cpython-3*-*-linux-gnu*.so
lib-dynload/_json.cpython-3*-*-linux-gnu*.so
lib-dynload/_lsprof.cpython-3*-*-linux-gnu*.so
lib-dynload/math.cpython-3*-*-linux-gnu*.so
lib-dynload/_md5.cpython-3*-*-linux-gnu*.so
lib-dynload/mmap.cpython-3*-*-linux-gnu*.so
lib-dynload/_multibytecodec.cpython-3*-*-linux-gnu*.so
lib-dynload/_multiprocessing.cpython-3*-*-linux-gnu*.so
lib-dynload/_opcode.cpython-3*-*-linux-gnu*.so
lib-dynload/ossaudiodev.cpython-3*-*-linux-gnu*.so
lib-dynload/parser.cpython-3*-*-linux-gnu*.so
lib-dynload/pyexpat.cpython-3*-*-linux-gnu*.so
lib-dynload/_posixsubprocess.cpython-3*-*-linux-gnu*.so
lib-dynload/_random.cpython-3*-*-linux-gnu*.so
lib-dynload/resource.cpython-3*-*-linux-gnu*.so
lib-dynload/select.cpython-3*-*-linux-gnu*.so
lib-dynload/_sha1.cpython-3*-*-linux-gnu*.so
lib-dynload/_sha256.cpython-3*-*-linux-gnu*.so
lib-dynload/_sha3.cpython-3*-*-linux-gnu*.so
lib-dynload/_sha512.cpython-3*-*-linux-gnu*.so
lib-dynload/_socket.cpython-3*-*-linux-gnu*.so
lib-dynload/spwd.cpython-3*-*-linux-gnu*.so
lib-dynload/_struct.cpython-3*-*-linux-gnu*.so
lib-dynload/syslog.cpython-3*-*-linux-gnu*.so
lib-dynload/termios.cpython-3*-*-linux-gnu*.so
lib-dynload/zlib.cpython-3*-*-linux-gnu*.so
linecache.py
locale.py
operator.py
os.py
pickle.py
posixpath.py
quopri.py
random.py
reprlib.py
re.py
selectors.py
shutil.py
signal.py
_sitebuiltins.py
site-packages/magic.py
site-packages/rpm/__init__.py
site-packages/rpm/_rpm*.so
site-packages/rpm/transaction.py
site.py
socket.py
sre_compile.py
sre_constants.py
sre_parse.py
stat.py
string.py
_strptime.py
struct.py
subprocess.py
_sysconfigdata_*_linux_*-linux-gnu*.py
sysconfig.py
tempfile.py
textwrap.py
threading.py
tokenize.py
token.py
traceback.py
types.py
urllib/error.py
urllib/__init__.py
urllib/parse.py
urllib/request.py
urllib/response.py
uu.py
warnings.py
weakref.py
_weakrefset.py
xml/dom/domreg.py
xml/dom/__init__.py
xml/dom/expatbuilder.py
xml/dom/minicompat.py
xml/dom/minidom.py
xml/dom/NodeFilter.py
xml/dom/xmlbuilder.py
xml/__init__.py
xml/parsers/expat.py
xml/parsers/__init__.py
xml/etree/ElementPath.py
xml/etree/ElementTree.py
zipfile.py

View File

@ -1,3 +1,15 @@
-------------------------------------------------------------------
Tue Jun 22 07:56:52 UTC 2021 - Steve Kowalik <steven.kowalik@suse.com>
- Update to require rpmlint >= 2.
* Due to rpmlint now being a proper Python package, build a virtual
environment, and copy all Python requirements into it.
* Drop rpmlint-deps.txt as no longer required.
* Lightly rewrite rpmlint.wrapper to support the new world order.
- Drop the config snippets, they are not required with rpmlint 2.
- Renumber Source numbers.
- Filter some more warnings in rpmlint-mini.rpmlintrc.
------------------------------------------------------------------- -------------------------------------------------------------------
Thu Mar 25 09:24:35 UTC 2021 - Matthias Gerstner <matthias.gerstner@suse.com> Thu Mar 25 09:24:35 UTC 2021 - Matthias Gerstner <matthias.gerstner@suse.com>

View File

@ -1,20 +0,0 @@
#!/usr/bin/python3
import os, glob, Pkg
configs = [ '/opt/testing/share/rpmlint/config' ]
if os.environ.get("RPMLINT_MINI_CONFIG", None):
configs += os.environ.get("RPMLINT_MINI_CONFIG", '').split(' ')
else:
configs += glob.glob("/home/abuild/rpmbuild/SOURCES/*rpmlintrc")
configs += glob.glob("/usr/src/packages/SOURCES/*rpmlintrc")
configs += glob.glob('/opt/testing/share/rpmlint/mini/*.config')
configs += glob.glob('/etc/rpmlint/factory-strict.config')
for f in configs:
try:
exec(compile(open(f).read(), f, 'exec'))
except IOError:
pass
except Exception as e:
Pkg.warn('(none): W: error loading %s, skipping: %s' % (f, e))

View File

@ -1,3 +1,6 @@
addFilter("wrong-script-interpreter")
addFilter("library-without-ldconfig") addFilter("library-without-ldconfig")
addFilter("python-bytecode-without-source") addFilter("python-bytecode-without-source")
addFilter("devel-file-in-non-devel-package") addFilter("files-duplicate")
addFilter("filelist-forbidden-opt")
addFilter("invalid-url")

View File

@ -17,31 +17,24 @@
Name: rpmlint-mini Name: rpmlint-mini
Version: 1.10 Version: 2.0
Release: 0 Release: 0
Summary: RPM file correctness checker Summary: RPM file correctness checker
License: GPL-2.0-or-later License: GPL-2.0-or-later
Group: System/Packages
URL: http://rpmlint.zarb.org/ URL: http://rpmlint.zarb.org/
Source: desktop-file-utils-0.24.tar.xz Source0: desktop-file-utils-0.24.tar.xz
Source2: rpmlint-security-whitelistings-master.tar.xz Source1: rpmlint.wrapper
Source100: rpmlint-deps.txt
Source101: rpmlint.wrapper
Source102: rpmlint-mini.config
Source103: polkit-default-privs.config
Source104: appdata_checker.config
Source105: whitelists.config
Source1000: rpmlint-mini.rpmlintrc
# need to fetch the file from there # need to fetch the file from there
BuildRequires: checkbashisms BuildRequires: checkbashisms
BuildRequires: dash BuildRequires: dash
BuildRequires: glib2-devel BuildRequires: glib2-devel
BuildRequires: glib2-devel-static BuildRequires: glib2-devel-static
BuildRequires: libedit-devel
BuildRequires: libtool BuildRequires: libtool
BuildRequires: pkgconfig BuildRequires: pkgconfig
BuildRequires: polkit-default-privs BuildRequires: polkit-default-privs
BuildRequires: polkit-whitelisting BuildRequires: polkit-whitelisting
BuildRequires: rpmlint BuildRequires: rpmlint >= 2
#!BuildIgnore: rpmlint-mini #!BuildIgnore: rpmlint-mini
Requires: cpio Requires: cpio
@ -52,11 +45,6 @@ source packages can be checked.
%prep %prep
%setup -q -n desktop-file-utils-0.24 %setup -q -n desktop-file-utils-0.24
[ -r COPYING ] [ -r COPYING ]
tar xf %{S:2}
# workaround rpmlintrc not being effective, because regular rpmlint is invoked
# instead of rpmlint-mini, see suse-build change here:
# https://github.com/openSUSE/obs-build/commit/1139134127373b058d3622bafb989c51e2ecc7b8
cp %{SOURCE1000} $HOME/.rpmlintrc
%build %build
%configure %configure
@ -65,78 +53,49 @@ make %{?_smp_mflags} desktop-file-validate V=1 DESKTOP_FILE_UTILS_LIBS="%{_libdi
popd popd
%install %install
# test if the rpmlint works at all # Check that rpmlint works at all
set +e set +e
%{_bindir}/rpmlint rpmlint %{_bindir}/rpmlint -i rpmlint
test $? -gt 0 -a $? -lt 60 && exit 1 test $? -gt 0 -a $? -lt 60 && exit 1
set -e set -e
# okay, lets put it together # Build a virtual env
mkdir -p %{buildroot}/opt/testing/share/rpmlint python3 -m venv %{buildroot}/opt/testing
install -m 755 -D src/desktop-file-validate %{buildroot}/opt/testing/bin/desktop-file-validate # We don't need pip, or activation
%{buildroot}/opt/testing/bin/pip uninstall -y pip
rm %{buildroot}/opt/testing/bin/activate*
# We need these available
cp -a src/desktop-file-validate %{buildroot}/opt/testing/bin
cp -a %{_bindir}/dash %{_bindir}/checkbashisms %{buildroot}/opt/testing/bin cp -a %{_bindir}/dash %{_bindir}/checkbashisms %{buildroot}/opt/testing/bin
mkdir -p %{buildroot}/opt/testing/%{_lib} cp -a %{_libdir}/libedit.so.0* %{buildroot}/opt/testing/lib
cp -a %{_libdir}/libedit.so.0* %{buildroot}/opt/testing/%{_lib} # Install config files
cp -a %{_datadir}/rpmlint/*.py %{buildroot}/opt/testing/share/rpmlint install -d -m 755 %{buildroot}/opt/testing/share
# install config files cp -a %{_sysconfdir}/xdg/rpmlint %{buildroot}/opt/testing/share
install -d -m 755 %{buildroot}/opt/testing/share/rpmlint/mini # Extra data
for i in %{_sysconfdir}/rpmlint/{pie,licenses}.config "%{SOURCE103}" "%{SOURCE104}" "%{SOURCE105}"; do
cp $i %{buildroot}/opt/testing/share/rpmlint/mini
done
install -m 644 -D %{_datadir}/rpmlint/config %{buildroot}/opt/testing/share/rpmlint/config
install -m 644 "%{SOURCE102}" %{buildroot}/opt/testing/share/rpmlint
# extra data
install -m 755 -d %{buildroot}/opt/testing/share/rpmlint/data install -m 755 -d %{buildroot}/opt/testing/share/rpmlint/data
install -m 644 %{_sysconfdir}/polkit-default-privs.standard %{buildroot}/opt/testing/share/rpmlint/data install -m 644 %{_sysconfdir}/polkit-default-privs.standard %{buildroot}/opt/testing/share/rpmlint/data
install -m 644 %{_sysconfdir}/polkit-rules-whitelist.json %{buildroot}/opt/testing/share/rpmlint/data install -m 644 %{_sysconfdir}/polkit-rules-whitelist.json %{buildroot}/opt/testing/share/rpmlint/data
install -m 644 rpmlint-security-whitelistings-master/*.json %{buildroot}/opt/testing/share/rpmlint/data # Python dependencies, along with the interpreter, and its library
# cp -a %{python_sitearch}/{rpm,zstd}* %{buildroot}/opt/testing/lib/python%{py3_ver}/site-packages
pushd %{_libdir}/python%{py3_ver}/ cp -a %{python_sitelib} %{buildroot}/opt/testing/lib/python%{py3_ver}
for f in $(<%{SOURCE100}); do cp -a %{_libdir}/libpython%{py3_ver}*.so.* %{buildroot}/opt/testing/lib
find -path "*/$f" -exec install -D {} %{buildroot}/opt/testing/%{_lib}/python%{py3_ver}/{} \; cp -a %{_bindir}/python3 %{buildroot}/opt/testing/bin
done cp -a %{_bindir}/python%{py3_ver} %{buildroot}/opt/testing/bin
# ErlangCheck dependencies that are not under %_libdir but under /usr/lib :-( pushd %{buildroot}/opt/testing/lib/python%{py3_ver}/
cp -a %{python3_sitelib}/{construct,pybeam,six.py} %{buildroot}/opt/testing/%{_lib}/python%{py3_ver}/site-packages for f in $(find -name \*.py | sort) ; do
install -D %{_bindir}/python3 %{buildroot}/opt/testing/bin/python3
cp -a %{_libdir}/libpython%{py3_ver}*.so.* %{buildroot}/opt/testing/%{_lib}
cp -a %{_bindir}/rpmlint %{buildroot}/opt/testing/share/rpmlint/rpmlint.py
pushd %{buildroot}/opt/testing/share/rpmlint
PYTHONOPTIMIZE=1 python3 -O -m compileall -b *.py
rm *.py
popd
pushd %{buildroot}/opt/testing/%{_lib}/python%{py3_ver}/
for f in `find -name \*.py | sort` ; do
PYTHONOPTIMIZE=1 python3 -O -m compileall -b $f PYTHONOPTIMIZE=1 python3 -O -m compileall -b $f
rm $f rm $f
done done
popd popd
find %{buildroot}/opt/testing/ -name __pycache__ -print -exec rm -Rf {} + find %{buildroot}/opt/testing/ -name __pycache__ -exec rm -rf {} +
# We need to force the shebang to be under /opt/testing
sed -e 's,/usr,/opt/testing,' %{_bindir}/rpmlint > %{buildroot}/opt/testing/bin/rpmlint.real
chmod a+x %{buildroot}/opt/testing/bin/rpmlint.real
rm -rf %{buildroot}/{usr,etc} rm -rf %{buildroot}/{usr,etc}
rm -f %{buildroot}/opt/testing/bin/rpmlint install -m 755 -D %{SOURCE1} %{buildroot}/opt/testing/bin/rpmlint
install -m 755 -D %{SOURCE101} %{buildroot}/opt/testing/bin/rpmlint # We don't want requirements of libraries, or the odd shebang
# hackatlon %define __requires_exclude (^lib.*|python3)$
%define my_requires %{_builddir}/%{?buildsubdir}/%{name}-requires # We don't want to provide any libraries, or Python modules we ship
cat << EOF > %{my_requires} %define __provides_exclude ^(lib|python)
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 > requires.list.new
mv requires.list.new requires.list
done < provides.list
cat requires.list
rm -f requires.list provides.list file.list
EOF
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
LD_LIBRARY_PATH=%{buildroot}/opt/testing/%{_lib}
PYTHONPATH=%{buildroot}/opt/testing/share/rpmlint
PYTHONHOME=%{buildroot}/opt/testing/
export PYTHONPATH LD_LIBRARY_PATH PYTHONHOME
%{buildroot}/opt/testing/bin/python3 -tt -u -O %{buildroot}/opt/testing/share/rpmlint/rpmlint.pyc /.build.binaries/*.rpm 2>&1 || exit 1
echo ".. ok"
%files %files
/opt/testing /opt/testing

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d854ee05f6c926c78e7a3afea307586a30d137c4a30e056663b9e797a771a138
size 6056

View File

@ -1,12 +1,14 @@
#!/bin/sh #!/bin/sh
if test -d /opt/testing/lib64; then
LD_LIBRARY_PATH=/opt/testing/lib64 LD_LIBRARY_PATH=/opt/testing/lib
else
LD_LIBRARY_PATH=/opt/testing/lib
fi
PATH="/opt/testing/bin:$PATH" PATH="/opt/testing/bin:$PATH"
rpmlintdir="/opt/testing/share/rpmlint" VIRTUAL_ENV=/opt/testing
PYTHONPATH="$rpmlintdir" XDG_CONFIG_HOME="/opt/testing/share"
LC_ALL=en_US.utf-8 LC_ALL=en_US.utf-8
export PYTHONPATH LD_LIBRARY_PATH LC_ALL export VIRTUAL_ENV LD_LIBRARY_PATH LC_ALL XDG_CONFIG_HOME
exec /opt/testing/bin/python3 -u -O "$rpmlintdir"/rpmlint.pyc -C "$rpmlintdir" -f "$rpmlintdir"/rpmlint-mini.config "$@" args=""
rpmlintrc=$(ls -1 /home/abuild/rpmbuild/SOURCES/*rpmlintrc 2>/dev/null)
if [ -n "$rpmlintrc" ]; then
args="-r $rpmlintrc"
fi
exec /opt/testing/bin/rpmlint.real $args $@

View File

@ -1,2 +0,0 @@
# vim: syntax=python
setOption("WhitelistDataDir", [ "/opt/testing/share/rpmlint/data" ])