import ports/devel/coccigrep, ok jasper@

coccigrep is a semantic grep for the C language based on coccinelle.
It can be used to find where a given structure is used in code files.
coccigrep depends on the spatch program which comes with coccinelle.

quick contrived example to find lines referencing m_len of a struct
mbuf, regardless of actual variable name:

$ coccigrep -t "struct mbuf" -a m_len /sys/netinet/ip_*.c
This commit is contained in:
sthen 2011-09-15 20:20:06 +00:00
parent 340195f8f9
commit 6195f2b398
5 changed files with 75 additions and 0 deletions

33
devel/coccigrep/Makefile Normal file
View File

@ -0,0 +1,33 @@
# $OpenBSD: Makefile,v 1.1.1.1 2011/09/15 20:20:06 sthen Exp $
COMMENT = semantic grep, based on coccinelle
MODPY_EGG_VERSION = 1.0
DISTNAME = coccigrep-${MODPY_EGG_VERSION}
CATEGORIES = devel textproc
HOMEPAGE = http://home.regit.org/software/coccigrep/
# GPLv3 only
PERMIT_PACKAGE_CDROM = Yes
PERMIT_PACKAGE_FTP = Yes
PERMIT_DISTFILES_CDROM = Yes
PERMIT_DISTFILES_FTP = Yes
MASTER_SITES = http://home.regit.org/wp-content/uploads/2011/08/
MODULES = lang/python
RUN_DEPENDS = devel/coccinelle
NO_REGRESS = Yes
MODPY_SETUPTOOLS = Yes
post-configure:
${SUBST_CMD} ${WRKSRC}/src/coccigrep.py
post-install:
${INSTALL_DATA_DIR} ${PREFIX}/share/doc/coccigrep
${INSTALL_DATA} ${WRKSRC}/README.rst ${PREFIX}/share/doc/coccigrep/
.include <bsd.port.mk>

5
devel/coccigrep/distinfo Normal file
View File

@ -0,0 +1,5 @@
MD5 (coccigrep-1.0.tar.gz) = mO56yj2ZKWULgydkmyKVlA==
RMD160 (coccigrep-1.0.tar.gz) = /oCvusvGknLTBULdp2mwknOAVBA=
SHA1 (coccigrep-1.0.tar.gz) = RU4pK2pOVPyoQ/kz3/jK2wRZCUE=
SHA256 (coccigrep-1.0.tar.gz) = e7BSNuZIq3/jUFEkVahu5JehaOq1GOQSGwyeBgK7aEE=
SIZE (coccigrep-1.0.tar.gz) = 28546

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-src_coccigrep_py,v 1.1.1.1 2011/09/15 20:20:06 sthen Exp $
--- src/coccigrep.py.orig Sun Sep 4 22:34:12 2011
+++ src/coccigrep.py Wed Sep 7 01:09:50 2011
@@ -77,7 +77,7 @@ class CocciRunException(CocciException):
_CONF_FILES = tuple((path.join(dirname, name_format % 'coccigrep')
for dirname, name_format in
((path.dirname(__file__), '%s.cfg'),
- ('/etc', '%s'),
+ ('${SYSCONFDIR}', '%s'),
(path.expanduser('~'), '.%s'),
(getcwd(), '.%s'))))

View File

@ -0,0 +1,3 @@
coccigrep is a semantic grep for the C language based on coccinelle.
It can be used to find where a given structure is used in code files.
coccigrep depends on the spatch program which comes with coccinelle.

22
devel/coccigrep/pkg/PLIST Normal file
View File

@ -0,0 +1,22 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2011/09/15 20:20:06 sthen Exp $
bin/coccigrep
lib/python${MODPY_VERSION}/site-packages/coccigrep/
lib/python${MODPY_VERSION}/site-packages/coccigrep-${MODPY_EGG_VERSION}-py${MODPY_VERSION}.egg-info/
lib/python${MODPY_VERSION}/site-packages/coccigrep-${MODPY_EGG_VERSION}-py${MODPY_VERSION}.egg-info/PKG-INFO
lib/python${MODPY_VERSION}/site-packages/coccigrep-${MODPY_EGG_VERSION}-py${MODPY_VERSION}.egg-info/SOURCES.txt
lib/python${MODPY_VERSION}/site-packages/coccigrep-${MODPY_EGG_VERSION}-py${MODPY_VERSION}.egg-info/dependency_links.txt
lib/python${MODPY_VERSION}/site-packages/coccigrep-${MODPY_EGG_VERSION}-py${MODPY_VERSION}.egg-info/top_level.txt
lib/python${MODPY_VERSION}/site-packages/coccigrep/__init__.py
lib/python${MODPY_VERSION}/site-packages/coccigrep/__init__.pyc
lib/python${MODPY_VERSION}/site-packages/coccigrep/coccigrep.cfg
@sample ${SYSCONFDIR}/coccigrep
lib/python${MODPY_VERSION}/site-packages/coccigrep/coccigrep.py
lib/python${MODPY_VERSION}/site-packages/coccigrep/coccigrep.pyc
lib/python${MODPY_VERSION}/site-packages/coccigrep/data/
lib/python${MODPY_VERSION}/site-packages/coccigrep/data/deref.cocci
lib/python${MODPY_VERSION}/site-packages/coccigrep/data/func.cocci
lib/python${MODPY_VERSION}/site-packages/coccigrep/data/set.cocci
lib/python${MODPY_VERSION}/site-packages/coccigrep/data/test.cocci
lib/python${MODPY_VERSION}/site-packages/coccigrep/data/used.cocci
share/doc/coccigrep/
share/doc/coccigrep/README.rst