From 4f2d7949f03e1c198bc888f2d05f421d35c57e21 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Mon, 9 Oct 2017 18:53:29 +0100 Subject: reinit the tree, so we can have metadata --- dev-python/pyclamav/Manifest | 6 + .../files/pyclamav-0.4.1-clamav-0.95.patch | 126 +++++++++++++++++++++ dev-python/pyclamav/metadata.xml | 8 ++ dev-python/pyclamav/pyclamav-0.4.1-r2.ebuild | 34 ++++++ 4 files changed, 174 insertions(+) create mode 100644 dev-python/pyclamav/Manifest create mode 100644 dev-python/pyclamav/files/pyclamav-0.4.1-clamav-0.95.patch create mode 100644 dev-python/pyclamav/metadata.xml create mode 100644 dev-python/pyclamav/pyclamav-0.4.1-r2.ebuild (limited to 'dev-python/pyclamav') diff --git a/dev-python/pyclamav/Manifest b/dev-python/pyclamav/Manifest new file mode 100644 index 000000000000..eec7e2cf067b --- /dev/null +++ b/dev-python/pyclamav/Manifest @@ -0,0 +1,6 @@ +AUX pyclamav-0.4.1-clamav-0.95.patch 4111 SHA256 53d5d29923b2f398ec0d13d82393af99bda2142e3fcf00548741bc854931de1d SHA512 4425ef9edf86c1391d41d925b381bfe068c1db9791a82b942e36f96eb1828ceb170e41877443084d17d45bb365c988f72afa9173d3c701a681ddd953d9a9f474 WHIRLPOOL a3a1fc9aae2474c55671f5feecf9c379a9c4263c9cb2350750c764f6e2bcd832bf138b53d7a9b95d62542972d531076739bc4d062a3d71d91e4e035641deafb0 +DIST pyclamav-0.4.1.tar.gz 12789 SHA256 27f0ea9771a9c5d8f974761df829a85344a19cf47a4b23a3f69836de2717b81c SHA512 ea06ba4706d2a1a98f265f308a72461224d09c44498f2809d31d7576958ecb53038cc3b98ba65e7841bf5082ecf094c2eea6cf7156074461378e98260d42b54f WHIRLPOOL fa9ef9e930e3c886acf2e5e8bc6586bede1e786320d1db03f92e8d4e94f72604adf3879e186b117f324034d9b5011e71168a6bdbff59565c3b3cf163f765ef86 +EBUILD pyclamav-0.4.1-r2.ebuild 759 SHA256 38191179b1446c20f3b78ac695a96b24af18f8caaece7dc1caa98f0ffb9036e0 SHA512 a30199859c7f5a4fb3ba498a9335dbb7cb15ff9b6645737fbeca5fbd8ba1b3d0b024573961fe7684ff308f1aae900058759a46a50324cbc7f86749c10236def8 WHIRLPOOL 1a51f3ddd042468690bfbb702d8debfedf12de1c7b66c21098855360440cad1d8998208efcefe0ee463da7a780f32ab96a9ca7c54af6fdcb1c3c171f32f9aaf3 +MISC ChangeLog 3276 SHA256 9ec55edf41a6803ffb9f457f1ea0f36baaa3a70c7ac0a7b9a182068345fdb52e SHA512 236e16b49956be17831e52b89ee812ce4cc771850c8026242d8376b8767b2020af77dde82476460bb33a2510f5ae422d9e2b3024f379235e593d168366e87dbc WHIRLPOOL 3c93e0602330905e5ad60f9941ff77ea4a4274b3e1ae6b85a42c226576080e2359ccb8b95a9b05184d5d9d4317253a08a8ca21458301c23ff4562c365657c42e +MISC ChangeLog-2015 3622 SHA256 0bcdefdc026f68a7bd1d104d43716194ecadd54480fdb2738bfa90da823a0357 SHA512 6bcb4e194f0c47f7742c162d4e5c12bfebc06ada13246aeb30abe5fca245729a4735b9039c16fa1fe8cbdada64c390b1413acb301e287dd4d8b6dad4d2570615 WHIRLPOOL 2b6801816b8d3365be124b9bddde5759b4bb5c956bc079e8e879338e630505671b9e3d89261fccf3c4129b7790250509dc52525616d0ae75c691c698e18b2178 +MISC metadata.xml 240 SHA256 07a76e79a43ffd9aa15de0e4ae548ea85aa5bd165c4602630c3519e60f113ee6 SHA512 9c23321eaa853f851bf00195ea64ac2ba093e516f9b57855ee5aa58fbb1988130c9f0c17c2a9ce9fae4ee033e0a28a70c868e0f5acdfa1dd316ab533c5279d59 WHIRLPOOL e3e059953c7c36bd942545f4e2a0e94ba938a17fe2bd04df81b137c185e64a213152c11918922563509e4767e601b41105f80c5983a87ee4d6be7704bcf7cf54 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 @@ + + + + + python@gentoo.org + Python + + 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..132b162b653a --- /dev/null +++ b/dev-python/pyclamav/pyclamav-0.4.1-r2.ebuild @@ -0,0 +1,34 @@ +# Copyright 1999-2015 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="http://xael.org/norman/python/pyclamav/ https://pypi.python.org/pypi/pyclamav" +SRC_URI="http://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}" +} -- cgit v1.2.3