suricata
suricata copied to clipboard
python: remove use of distutils - v4
Don't use distutils to install Python code, instead just use make.
Distutils is being deprecated and setuptools insists on working within the scope of the system and not within our prefix, not allowing 2 versions of Suricata-Update to be installed in different prefixes, among various other issues.
As we have little to gain from using setuptools, and its less work to maintain a Makefile than fight setuptools, just use make to install our Python code.
Requires a modification to Suricata-Update: https://github.com/OISF/suricata-update/pull/315
Recommended to backport to 6.0.x, but not 5.0.x.
Issue: https://redmine.openinfosecfoundation.org/issues/5313
suricata-update-pr: 315
Previous PR: https://github.com/OISF/suricata/pull/7698 Changes from last PR:
- Rewrite the
#!
based on the path Python was found at during ./configure. This used to be done by distutils for us. - github-ci: install and test that suricatasc and suricata-update can run without python path issues
- github-ci: add almalinux:9 build
Codecov Report
Merging #7704 (e8ce23f) into master (f3d3274) will increase coverage by
0.09%
. The diff coverage isn/a
.
@@ Coverage Diff @@
## master #7704 +/- ##
==========================================
+ Coverage 75.88% 75.98% +0.09%
==========================================
Files 659 659
Lines 185668 185669 +1
==========================================
+ Hits 140893 141076 +183
+ Misses 44775 44593 -182
Flag | Coverage Δ | |
---|---|---|
fuzzcorpus | 60.67% <ø> (+0.07%) |
:arrow_up: |
suricata-verify | 52.55% <ø> (-0.04%) |
:arrow_down: |
unittests | 60.71% <ø> (+<0.01%) |
:arrow_up: |
Flags with carried forward coverage won't be shown. Click here to find out more.
This fixes things on FreeBSD, but now all my rpm based runners are unhappy, as well as Debian and Ubuntu.
Making install in suricata-update
make[1]: Entering directory '/builds/inliniac/suricata-ci/suricata/suricata-update'
make[2]: Entering directory '/builds/inliniac/suricata-ci/suricata/suricata-update'
install -d -m 0755 "/usr/local/lib/suricata/python/suricata/update/commands"
install -d -m 0755 "/usr/local/lib/suricata/python/suricata/update/compat/argparse"
install -d -m 0755 "/usr/local/lib/suricata/python/suricata/update/configs"
install -d -m 0755 "/usr/local/lib/suricata/python/suricata/update/data"
for lib in suricata/__init__.py suricata/update/commands/__init__.py suricata/update/commands/addsource.py suricata/update/commands/checkversions.py suricata/update/commands/disablesource.py suricata/update/commands/enablesource.py suricata/update/commands/listsources.py suricata/update/commands/removesource.py suricata/update/commands/updatesources.py suricata/update/compat/__init__.py suricata/update/compat/ordereddict.py suricata/update/compat/argparse/__init__.py suricata/update/compat/argparse/argparse.py suricata/update/configs/__init__.py suricata/update/config.py suricata/update/data/__init__.py suricata/update/data/index.py suricata/update/data/update.py suricata/update/__init__.py suricata/update/engine.py suricata/update/exceptions.py suricata/update/extract.py suricata/update/loghandler.py suricata/update/main.py suricata/update/maps.py suricata/update/matchers.py suricata/update/net.py suricata/update/notes.py suricata/update/osinfo.py suricata/update/parsers.py suricata/update/rule.py suricata/update/sources.py suricata/update/util.py suricata/update/version.py; do \
install ./$lib "/usr/local/lib/suricata/python/$lib"; \
done
for bin in suricata-update; do \
cat "./bin/$bin" | \
sed -e "1 s,.*,#"'!'" /usr/bin/python3," > "/usr/local/bin/$bin"; \
chmod 0755 "/usr/local/bin/$bin"; \
done
make[2]: Nothing to be done for 'install-data-am'.
make[2]: Leaving directory '/builds/inliniac/suricata-ci/suricata/suricata-update'
make[1]: Leaving directory '/builds/inliniac/suricata-ci/suricata/suricata-update'
make[1]: Entering directory '/builds/inliniac/suricata-ci/suricata'
make[2]: Entering directory '/builds/inliniac/suricata-ci/suricata'
make[2]: Nothing to be done for 'install-exec-am'.
Run 'make install-conf' if you want to install initial configuration files. Or 'make install-full' to install configuration and rules
make[2]: Leaving directory '/builds/inliniac/suricata-ci/suricata'
make[1]: Leaving directory '/builds/inliniac/suricata-ci/suricata'
$ ../test-suricata-update.sh
+ '[' '!' -d suricata-update ']'
+ export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/bin
+ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/bin
+ export LD_LIBRARY_PATH=:/usr/local/lib
+ LD_LIBRARY_PATH=:/usr/local/lib
+ suricata-update -V
Traceback (most recent call last):
File "/usr/local/bin/suricata-update", line 32, in <module>
from suricata.update import main
ModuleNotFoundError: No module named 'suricata'
Uploading artifacts for failed job
argh forgot to test with the SU pr, rerunning
Seems good now, sorry for the noise.
Merged in #7713, thanks!