summaryrefslogtreecommitdiff
path: root/dev-python/pyclamav
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2015-08-08 13:49:04 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2015-08-08 17:38:18 -0700
commit56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch)
tree3f91093cdb475e565ae857f1c5a7fd339e2d781e /dev-python/pyclamav
downloadgentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.xz
proj/gentoo: Initial commit
This commit represents a new era for Gentoo: Storing the gentoo-x86 tree in Git, as converted from CVS. This commit is the start of the NEW history. Any historical data is intended to be grafted onto this point. Creation process: 1. Take final CVS checkout snapshot 2. Remove ALL ChangeLog* files 3. Transform all Manifests to thin 4. Remove empty Manifests 5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$ 5.1. Do not touch files with -kb/-ko keyword flags. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'dev-python/pyclamav')
-rw-r--r--dev-python/pyclamav/Manifest1
-rw-r--r--dev-python/pyclamav/files/pyclamav-0.4.1-clamav-0.95.patch126
-rw-r--r--dev-python/pyclamav/metadata.xml5
-rw-r--r--dev-python/pyclamav/pyclamav-0.4.1-r1.ebuild36
-rw-r--r--dev-python/pyclamav/pyclamav-0.4.1-r2.ebuild35
5 files changed, 203 insertions, 0 deletions
diff --git a/dev-python/pyclamav/Manifest b/dev-python/pyclamav/Manifest
new file mode 100644
index 00000000000..4e907a14c8c
--- /dev/null
+++ b/dev-python/pyclamav/Manifest
@@ -0,0 +1 @@
+DIST pyclamav-0.4.1.tar.gz 12789 SHA256 27f0ea9771a9c5d8f974761df829a85344a19cf47a4b23a3f69836de2717b81c SHA512 ea06ba4706d2a1a98f265f308a72461224d09c44498f2809d31d7576958ecb53038cc3b98ba65e7841bf5082ecf094c2eea6cf7156074461378e98260d42b54f WHIRLPOOL fa9ef9e930e3c886acf2e5e8bc6586bede1e786320d1db03f92e8d4e94f72604adf3879e186b117f324034d9b5011e71168a6bdbff59565c3b3cf163f765ef86
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 00000000000..1cf77e1925e
--- /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 00000000000..de483c53568
--- /dev/null
+++ b/dev-python/pyclamav/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>python</herd>
+</pkgmetadata>
diff --git a/dev-python/pyclamav/pyclamav-0.4.1-r1.ebuild b/dev-python/pyclamav/pyclamav-0.4.1-r1.ebuild
new file mode 100644
index 00000000000..f0588827f32
--- /dev/null
+++ b/dev-python/pyclamav/pyclamav-0.4.1-r1.ebuild
@@ -0,0 +1,36 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+PYTHON_DEPEND="2"
+SUPPORT_PYTHON_ABIS="1"
+RESTRICT_PYTHON_ABIS="3.* *-jython *-pypy-*"
+
+inherit distutils eutils
+
+DESCRIPTION="Python binding for libclamav"
+HOMEPAGE="http://xael.org/norman/python/pyclamav/ http://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}"
+
+src_prepare() {
+ distutils_src_prepare
+
+ # Patch from Debian to build w/ >=clamav-0.95
+ epatch "${FILESDIR}/${P}-clamav-0.95.patch"
+}
+
+src_install() {
+ distutils_src_install
+
+ insinto /usr/share/doc/${PF}
+ doins example.py
+}
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 00000000000..0dfa19e7893
--- /dev/null
+++ b/dev-python/pyclamav/pyclamav-0.4.1-r2.ebuild
@@ -0,0 +1,35 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+PYTHON_COMPAT=( python2_7 )
+
+inherit distutils-r1
+
+DESCRIPTION="Python binding for libclamav"
+HOMEPAGE="http://xael.org/norman/python/pyclamav/ http://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}"
+}