Hello community, here is the log from the commit of package coccigrep for openSUSE:Factory checked in at 2018-07-06 10:45:12 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/coccigrep (Old) and /work/SRC/openSUSE:Factory/.coccigrep.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "coccigrep" Fri Jul 6 10:45:12 2018 rev:13 rq:621050 version:1.17+git.20180322 Changes: -------- --- /work/SRC/openSUSE:Factory/coccigrep/coccigrep.changes 2016-11-10 13:22:21.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.coccigrep.new/coccigrep.changes 2018-07-06 10:45:16.675020308 +0200 @@ -1,0 +2,14 @@ +Mon Jun 18 08:22:13 UTC 2018 - opensuse-packag...@opensuse.org + +- Update to version 1.17+git.20180322: + * grep mode: fix multiline case + * fix typo in comment + * used: fix equality match + * allow multiple match on the same line + * fix grep mode display + * Update version to 1.17 + * set only color in grep mode for tty + * color attribute in grep mode + * add grep mode for color + +------------------------------------------------------------------- Old: ---- coccigrep-1.16+git.20160815.tar.xz New: ---- coccigrep-1.17+git.20180322.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ coccigrep.spec ++++++ --- /var/tmp/diff_new_pack.fQdHMn/_old 2018-07-06 10:45:17.723019059 +0200 +++ /var/tmp/diff_new_pack.fQdHMn/_new 2018-07-06 10:45:17.723019059 +0200 @@ -17,7 +17,7 @@ Name: coccigrep -Version: 1.16+git.20160815 +Version: 1.17+git.20180322 Release: 0 Summary: Semantic grep tool for C, based on coccinelle License: GPL-3.0 ++++++ _service ++++++ --- /var/tmp/diff_new_pack.fQdHMn/_old 2018-07-06 10:45:17.747019031 +0200 +++ /var/tmp/diff_new_pack.fQdHMn/_new 2018-07-06 10:45:17.747019031 +0200 @@ -1,13 +1,15 @@ <services> - <service mode="localonly" name="tar_scm"> + <service mode="disabled" name="tar_scm"> <param name="url">git://github.com/regit/coccigrep</param> <param name="scm">git</param> - <param name="versionformat">1.16+git.%ad</param> <param name="changesgenerate">enable</param> + <param name="versionformat">@PARENT_TAG@+git.%cd</param> + <param name="versionrewrite-pattern">v(.*)</param> + <param name="versionrewrite-replacement">\1</param> </service> - <service mode="localonly" name="recompress"> + <service mode="disabled" name="recompress"> <param name="file">*.tar</param> <param name="compression">xz</param> </service> - <service mode="localonly" name="set_version"/> + <service mode="disabled" name="set_version"/> </services> ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.fQdHMn/_old 2018-07-06 10:45:17.759019016 +0200 +++ /var/tmp/diff_new_pack.fQdHMn/_new 2018-07-06 10:45:17.763019012 +0200 @@ -1,4 +1,4 @@ <servicedata> <service name="tar_scm"> <param name="url">git://github.com/regit/coccigrep</param> - <param name="changesrevision">59e7e8cc1953c7947dbe0e4600b6837a8bd30630</param></service></servicedata> \ No newline at end of file + <param name="changesrevision">2e7322d19c8e0e8e162a633c0c3572bacbc7714b</param></service></servicedata> \ No newline at end of file ++++++ coccigrep-1.16+git.20160815.tar.xz -> coccigrep-1.17+git.20180322.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/coccigrep-1.16+git.20160815/coccigrep new/coccigrep-1.17+git.20180322/coccigrep --- old/coccigrep-1.16+git.20160815/coccigrep 2016-08-15 16:32:51.000000000 +0200 +++ new/coccigrep-1.17+git.20180322/coccigrep 2018-03-22 23:51:44.000000000 +0100 @@ -59,6 +59,7 @@ parser.add_argument('-B', '--before-context', dest='before', type=int, default=cocciinst.getint('output', 'before'), help='Number of lines before context') parser.add_argument('-p', '--process', dest='ncpus', type=int, default=cocciinst.getint('global', 'concurrency_level'), help='Number of cpus to use') parser.add_argument('-c', '--color', action='store_const', default=cocciinst.getboolean('output', 'color'), const=True, help='colorize output (need pygments)') +parser.add_argument('-g', '--grep', action='store_const', default=cocciinst.getboolean('output', 'grep'), const=True, help='colorize output like grep') parser.add_argument('--cpp', action='store_const', default=cocciinst.getboolean('global', 'cpp'), const=True, help='Activate coccinelle C++ support') parser.add_argument('-V', '--vim', action='store_const', const=True, default=cocciinst.getboolean('output', 'vim'), help='vim output') parser.add_argument('-E', '--emacs', action='store_const', const=True, default=cocciinst.getboolean('output', 'emacs'), help='emacs output') @@ -158,6 +159,8 @@ output = coccigrep.display(mode='emacs') elif args.color: output = coccigrep.display(mode='color', oformat=args.oformat, before=args.before, after=args.after) +elif args.grep: + output = coccigrep.display(mode='grep', oformat=args.oformat, before=args.before, after=args.after) else: output = coccigrep.display(mode='raw', before=args.before, after=args.after) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/coccigrep-1.16+git.20160815/src/coccigrep.cfg new/coccigrep-1.17+git.20180322/src/coccigrep.cfg --- old/coccigrep-1.16+git.20160815/src/coccigrep.cfg 2016-08-15 16:32:51.000000000 +0200 +++ new/coccigrep-1.17+git.20180322/src/coccigrep.cfg 2018-03-22 23:51:44.000000000 +0100 @@ -9,6 +9,7 @@ color = false vim = false emacs = false +grep = false format = term after = 0 before = 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/coccigrep-1.16+git.20160815/src/coccigrep.py new/coccigrep-1.17+git.20180322/src/coccigrep.py --- old/coccigrep-1.16+git.20160815/src/coccigrep.py 2016-08-15 16:32:51.000000000 +0200 +++ new/coccigrep-1.17+git.20180322/src/coccigrep.py 2018-03-22 23:51:44.000000000 +0100 @@ -1,4 +1,4 @@ -# Copyright (C) 2011-2015 Eric Leblond <e...@regit.org> +# Copyright (C) 2011-2018 Eric Leblond <e...@regit.org> # # You can copy, redistribute or modify this Program under the terms of # the GNU General Public License version 3 as published by the Free @@ -21,13 +21,13 @@ from os import unlink, path, listdir, getcwd from string import Template from subprocess import Popen, PIPE, STDOUT -from sys import stderr +from sys import stderr, stdout from tempfile import NamedTemporaryFile import errno import re import sys -COCCIGREP_VERSION = "1.16" +COCCIGREP_VERSION = "1.17" have_multiprocessing = True try: @@ -119,14 +119,15 @@ ptype_regexp = re.compile("^[ )]*\.") - def __init__(self, mfile, mline, mcol, mlineend, mcolend): + def __init__(self, mfile, mline, mcol, mlineend, mcolend, search): self.file = mfile self.line = int(mline) self.column = int(mcol) self.lineend = int(mlineend) self.columnend = int(mcolend) + self.search = search self.start_at = self.line - self.stop_at = self.line + self.stop_at = int(mlineend) self.trailer = "" def display(self, stype, mode='raw', oformat='term'): @@ -162,9 +163,18 @@ elif mode == 'emacs': output += "%s:%s: (%s %s%s): %s" % (self.file, i + 1, stype, ptype, pmatch, lines[i]) + elif mode == 'grep' and stdout.isatty(): + lineend = lines[i][self.columnend:] + if self.search.attribute: + lineend = lineend.replace(self.search.attribute,"\033[0;31m" + self.search.attribute + "\033[0m", 1) + content = lines[i][:self.column] + \ + "\033[0;32m" + lines[i][self.column:self.columnend] + "\033[0m" \ + + lineend + output += "%s:%s:\t%s" % (self.file, i + 1, content) elif i == self.line - 1: - output += "%s:%s (%s %s%s): %s" % (self.file, i + 1, - stype, ptype, pmatch, lines[i]) + content = lines[i] + output += "%s:%s (%s %s%s):\t%s" % (self.file, i + 1, + stype, ptype, pmatch, content) else: output += "%s-%s %s - %s" % (self.file, i + 1, ' ' * (2 + len(stype + ptype + pmatch)), lines[i]) @@ -290,9 +300,15 @@ of initialisation and running of the request. """ spatch = "spatch" + cocci_python_hdr_std = """ +@ script:python @ +""" + cocci_python_hdr_filter = """ +@ script:python depends on filter @ +""" + cocci_python = """ -@ script:python @ p1 << init.p1; @@ @@ -455,7 +471,10 @@ # do substitution cocci_smpl = cocci_smpl_tmpl.substitute(type=self.type, attribute=self.attribute, cocci_regexp_equal=cocci_op) - cocci_grep = cocci_smpl + CocciGrep.cocci_python + if '@filter@' in cocci_smpl: + cocci_grep = cocci_smpl + CocciGrep.cocci_python_hdr_filter + CocciGrep.cocci_python + else: + cocci_grep = cocci_smpl + CocciGrep.cocci_python_hdr_std + CocciGrep.cocci_python if sys.version < '3': tmp_cocci_file.write(cocci_grep) @@ -513,18 +532,11 @@ tmp_cocci_file.close() - prevfile = None - prevline = None self.matches = [] for ematch in output.decode('utf8').split("\n"): try: (efile, eline, ecol, elinend, ecolend) = ematch.split(":") - nmatch = CocciMatch(efile, eline, ecol, elinend, ecolend) - # if there is equality then we will already display the line - if (efile == prevfile) and (eline == prevline): - continue - prevfile = efile - prevline = eline + nmatch = CocciMatch(efile, eline, ecol, elinend, ecolend, self) self.matches.append(nmatch) except ValueError: pass @@ -561,7 +573,7 @@ cur_match.start_at = prev_match.stop_at + 1 if prev_match.stop_at + 1 == cur_match.start_at: - # No seprator if groups are contiguous + # No separator if groups are contiguous prev_match.trailer = "" prev_match = cur_match diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/coccigrep-1.16+git.20160815/src/data/used.cocci new/coccigrep-1.17+git.20180322/src/data/used.cocci --- old/coccigrep-1.16+git.20160815/src/data/used.cocci 2016-08-15 16:32:51.000000000 +0200 +++ new/coccigrep-1.17+git.20180322/src/data/used.cocci 2018-03-22 23:51:44.000000000 +0100 @@ -1,8 +1,8 @@ // Author: Eric Leblond <e...@regit.org> // Desc: Search all usage of 'type' structure -// Confidence: 100% +// Confidence: 90% // Arguments: type -// Revision: 1 +// Revision: 2 @init@ $type *p; $type ps; @@ -14,3 +14,10 @@ | ps@p1 ) + +@filter@ +identifier mp !~ "="; +position init.p1; +@@ + +mp@p1