]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
qa/coccinelle: fix make distcheck
authorEric Leblond <eric@regit.org>
Sat, 30 Nov 2019 18:07:05 +0000 (19:07 +0100)
committerVictor Julien <victor@inliniac.net>
Thu, 5 Dec 2019 12:40:02 +0000 (13:40 +0100)
We need to use top_srcdir to know where the sources are. Relative
directory is not enough.

qa/coccinelle/Makefile.am
qa/coccinelle/struct-flags.py

index 60ec6a5bf59146ac59c243e454d51d30ec2a606b..36f2724b7f395534f7e4b290a1fa5616b2218164 100644 (file)
@@ -13,7 +13,7 @@ EXTRA_DIST= access-pkt-packet.cocci \
 
 if HAVE_COCCINELLE
 struct-flags.cocci:
-       $(srcdir)/struct-flags.py > $(top_builddir)/qa/coccinelle/struct-flags.cocci
+       $(srcdir)/struct-flags.py  $(top_srcdir)/src > $(top_builddir)/qa/coccinelle/struct-flags.cocci
 
 check: struct-flags.cocci
        TOP_BUILDDIR=${abs_top_builddir} TOP_SRCDIR=$(abs_top_srcdir) $(top_srcdir)/qa/coccinelle/run_check.sh
index 38c40b33e4906d8343f98792f1f234ebb74351b5..3186cf6bd0c27139d4ed13d13663f53a00521119 100755 (executable)
@@ -1,9 +1,13 @@
 #!/usr/bin/env python
 import re
-from os import listdir
+import sys
+import os
 from string import Template
 
-SRC_DIR = "../../src/"
+if len(sys.argv) == 2:
+    SRC_DIR = sys.argv[1]
+else:
+    SRC_DIR = "../../src/"
 
 
 class Structure:
@@ -22,10 +26,10 @@ cmd = "grep -h coccinelle ../../src/*[ch] | sed -e 's/.*coccinelle: \(.*\) \*\//
 struct_list = []
 setter_getter_list = []
 
-dirList = listdir(SRC_DIR)
+dirList = os.listdir(SRC_DIR)
 for fname in dirList:
     if re.search("\.[ch]$", fname):
-        for line in open(SRC_DIR + fname):
+        for line in open(os.path.join(SRC_DIR, fname)):
             if "coccinelle:" in line:
                 m = re.search("coccinelle: (.*) \*\/", line)
                 if "()" not in m.group(1):