diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2018-07-14 21:03:06 +0100 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2018-07-14 21:03:06 +0100 |
commit | 8376ef56580626e9c0f796d5b85b53a0a1c7d5f5 (patch) | |
tree | 7681bbd4e8b05407772df40a4bf04cbbc8afc3fa /dev-python/pyclamav | |
parent | 30a9caf154332f12ca60756e1b75d2f0e3e1822d (diff) |
gentoo resync : 14.07.2018
Diffstat (limited to 'dev-python/pyclamav')
-rw-r--r-- | dev-python/pyclamav/Manifest | 4 | ||||
-rw-r--r-- | dev-python/pyclamav/files/pyclamav-0.4.1-clamav-0.95.patch | 126 | ||||
-rw-r--r-- | dev-python/pyclamav/metadata.xml | 8 | ||||
-rw-r--r-- | dev-python/pyclamav/pyclamav-0.4.1-r2.ebuild | 35 |
4 files changed, 173 insertions, 0 deletions
diff --git a/dev-python/pyclamav/Manifest b/dev-python/pyclamav/Manifest new file mode 100644 index 000000000000..27512287b1d5 --- /dev/null +++ b/dev-python/pyclamav/Manifest @@ -0,0 +1,4 @@ +AUX pyclamav-0.4.1-clamav-0.95.patch 4111 BLAKE2B fcb09c4ce1e239bbe24da17e15ef0acb0f590c32431c9c6e26cf66043f63141d8674fb3cd9447787e9b15278a2cd9ccb3317d506cfaf6ec44ab44ede6785ea9e SHA512 4425ef9edf86c1391d41d925b381bfe068c1db9791a82b942e36f96eb1828ceb170e41877443084d17d45bb365c988f72afa9173d3c701a681ddd953d9a9f474 +DIST pyclamav-0.4.1.tar.gz 12789 BLAKE2B f0ca4d357c73fb1064425596c6f7daa7ec4075c5b53a5b279dd7aeaefeb099252d5e977b041557c39bbd517f38d9eb9643dca0a7fa46810d63f790d6311b6f68 SHA512 ea06ba4706d2a1a98f265f308a72461224d09c44498f2809d31d7576958ecb53038cc3b98ba65e7841bf5082ecf094c2eea6cf7156074461378e98260d42b54f +EBUILD pyclamav-0.4.1-r2.ebuild 759 BLAKE2B d5bea6a85f3382d89526a5184ddc8769ac0d620f471aacecf73159a52c2f43d014b5feed68e8a0b4fcf94b0a8b10c2be6bb5a8bd2b58302ee56c3883e34be80f SHA512 073eba18daf55b8de7c4fcfa94141f8cad4147eb5321b1fb7d18af0bd163ca4c47eb5e9ee01e22c4af7fcb30a3974cd53b23f5fade34109282f3004e4b517aa7 +MISC metadata.xml 240 BLAKE2B 41e6a4d9da33dab2decc5ff419924f382a8f64d27a81fdb97576db8c6cf125be95911747946ec8be1b453f56617fef1084f5947f84b50a8db419d46df2ae8a0f SHA512 9c23321eaa853f851bf00195ea64ac2ba093e516f9b57855ee5aa58fbb1988130c9f0c17c2a9ce9fae4ee033e0a28a70c868e0f5acdfa1dd316ab533c5279d59 diff --git a/dev-python/pyclamav/files/pyclamav-0.4.1-clamav-0.95.patch b/dev-python/pyclamav/files/pyclamav-0.4.1-clamav-0.95.patch new file mode 100644 index 000000000000..1cf77e1925e7 --- /dev/null +++ b/dev-python/pyclamav/files/pyclamav-0.4.1-clamav-0.95.patch @@ -0,0 +1,126 @@ + +--- python-clamav-0.4.1.orig/pyclamav.c ++++ python-clamav-0.4.1/pyclamav.c +@@ -33,25 +33,6 @@ + + /* ********************************************************* */ + +-/* To be able to compile with +- releases 0.75 of libclamav +- +- Where cl_free was cl_freetrie +- and cl_build was cl_buildtrie +- CL_SCAN_STDOPT did not exist +-*/ +-#ifndef CL_SCAN_STDOPT +-#define CL_SCAN_STDOPT CL_RAW | CL_ARCHIVE | CL_MAIL | CL_DISABLERAR | CL_OLE2 | CL_ENCRYPTED +-void cl_free(struct cl_node *rootnode) { +- cl_freetrie(rootnode); +- return; +-} +- +-int cl_build(struct cl_node *rootnode) { +- return cl_buildtrie(rootnode); +-} +-#endif +- + /* For python prior to 2.3 */ + #ifndef PyMODINIT_FUNC + #define PyMODINIT_FUNC void +@@ -68,11 +49,9 @@ + unsigned int signumber = 0; + + /* Structures for clamav */ +-struct cl_node *root = NULL; +-struct cl_limits limits; ++struct cl_engine *engine = NULL; + struct cl_stat dbstat; + +- + /* + * If the virus database has been changed, then + * free the current tree and reload the new one +@@ -85,22 +64,22 @@ + /* If yes : reload DB */ + if (cl_statchkdir(&dbstat) == 1) + { +- /* free the tree */ +- cl_free(root); ++ /* free the engine */ ++ cl_engine_free(engine); + signumber=0; +- root=NULL; ++ engine=NULL; + + /* Load DB */ +- if((ret = cl_load(cl_retdbdir(), &root, &signumber, CL_DB_STDOPT))) { ++ if((ret = cl_load(cl_retdbdir(), engine, &signumber, CL_DB_STDOPT)) != CL_SUCCESS) { + /* Raise exception with error message */ + PyErr_SetString(PyclamavError, cl_strerror(ret)); + return -2; + } + +- /* build the final tree */ +- if((ret = cl_build(root))) { +- /* free the partial tree */ +- cl_free(root); ++ /* prepare the engine */ ++ if((ret = cl_engine_compile(engine))) { ++ /* free the engine */ ++ cl_engine_free(engine); + /* Raise exception with error message */ + PyErr_SetString(PyclamavError, cl_strerror(ret)); + return -2; +@@ -231,7 +210,7 @@ + return NULL; + } + +- ret = cl_scanfile(file_to_scan, &virname, &size, root, &limits, CL_SCAN_STDOPT); ++ ret = cl_scanfile(file_to_scan, &virname, &size, engine, CL_SCAN_STDOPT); + + /* Test return code */ + switch (ret) { +@@ -278,17 +257,21 @@ + /* Set documentation string for the module */ + PyDict_SetItemString(dict, "__doc__", PyString_FromString("pyclamav :\n\n This is a python binding to the C libclamav library\n (from the Clamav project - http://www.clamav.net).\n It can be used to easily allow a Python script to scan\n a file or a buffer against known viruses.\n\nAuthor : Alexandre Norman [norman@xael.org]\n\nFunctions :\n - scanfile(string filename) : Scan a file for virus.\n - get_numsig() : Return the number of known signatures.\n - get_version() : Return the version of Clamav.\n - version() : Return the version of pyclamav.\n")); + ++ /* initialize libclamav */ ++ cl_init(CL_INIT_DEFAULT); ++ engine = cl_engine_new(); + +- if((ret = cl_load(cl_retdbdir(), &root, &signumber, CL_DB_STDOPT))) { ++ if((ret = cl_load(cl_retdbdir(), engine, &signumber, CL_DB_STDOPT))) { + /* Raise exception with error message */ + PyErr_SetString(PyclamavError, cl_strerror(ret)); ++ cl_engine_free(engine); + return; + } + +- /* build the final tree */ +- if((ret = cl_build(root))) { +- /* free the partial tree */ +- cl_free(root); ++ /* prepare the engine */ ++ if((ret = cl_engine_compile(engine)) != CL_SUCCESS) { ++ /* free up the engine resources */ ++ cl_engine_free(engine); + /* Raise exception with error message */ + PyErr_SetString(PyclamavError, cl_strerror(ret)); + return; +@@ -299,15 +282,6 @@ + memset(&dbstat, 0, sizeof(struct cl_stat)); + cl_statinidir(cl_retdbdir(), &dbstat); + +- +- +- /* set up archive limits */ +- memset(&limits, 0, sizeof(struct cl_limits)); +- limits.maxfiles = 1000; /* max files */ +- limits.maxfilesize = 10 * 1048576; /* maximal archived file size == 10 Mb */ +- limits.maxreclevel = 5; /* maximal recursion level */ +- limits.archivememlim = 0; /* disable memory limit for bzip2 scanner */ +- + return ; + } + + diff --git a/dev-python/pyclamav/metadata.xml b/dev-python/pyclamav/metadata.xml new file mode 100644 index 000000000000..7f4f33c6dbc9 --- /dev/null +++ b/dev-python/pyclamav/metadata.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="project"> + <email>python@gentoo.org</email> + <name>Python</name> + </maintainer> +</pkgmetadata> diff --git a/dev-python/pyclamav/pyclamav-0.4.1-r2.ebuild b/dev-python/pyclamav/pyclamav-0.4.1-r2.ebuild new file mode 100644 index 000000000000..ffdcef0bbb10 --- /dev/null +++ b/dev-python/pyclamav/pyclamav-0.4.1-r2.ebuild @@ -0,0 +1,35 @@ +# Copyright 1999-2018 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=5 + +PYTHON_COMPAT=( python2_7 ) + +inherit distutils-r1 + +DESCRIPTION="Python binding for libclamav" +HOMEPAGE="https://xael.org/norman/python/pyclamav/ + https://pypi.org/project/pyclamav/" +SRC_URI="https://xael.org/norman/python/${PN}/${P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="amd64 ~ia64 ~ppc x86" +IUSE="" + +DEPEND=">=app-antivirus/clamav-0.90" +RDEPEND="${DEPEND}" + +PATCHES=( "${FILESDIR}"/${P}-clamav-0.95.patch ) +DOCS=( README.txt example.py ) + +src_install() { + distutils-r1_src_install + + insinto /usr/share/doc/${PF} + doins example.py +} + +pkg_postinst() { + elog "an example called example.py has been installed into /usr/share/doc/${PF}" +} |