[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[XEN PATCH v6 07/31] build,include: rework compat-build-source.py


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Anthony PERARD <anthony.perard@xxxxxxxxxx>
  • Date: Thu, 1 Jul 2021 15:09:47 +0100
  • Authentication-results: esa5.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: Anthony PERARD <anthony.perard@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Thu, 01 Jul 2021 14:10:32 +0000
  • Ironport-hdrordr: A9a23:fExu1qhU81WMd6RejdhUkxV2BnBQXuIji2hC6mlwRA09TySZ// rBoB19726TtN9xYgBZpTnuAsm9qB/nmaKdpLNhWItKPzOW31dATrsSjrcKqgeIc0aVm9K1l5 0QF5SWYOeAdGSS5vya3ODXKbkdKaG8gcKVuds=
  • Ironport-sdr: R+4i4GvhQ/bsJUtm/f25GRNBFTY3QnEzZIDpOXXFfnM5XPyNmcnKTNMALl1I858HTbrVLZVixL FgY6jes9ShraMHqbhQlMzSz8xTfRFUc9jB7H1cETWgAamV0+K9rrCleR8qbkJ0a0BRdAQ9eYaP nUvRrZOqNNPCZlfHQPUvTRpOcY27WfA4TJ5l//hJnCFFvDQvJ2gox59VU6cgAH4FAwStzGRh0f IvuCpRqKjohQzU3SLVpZMJktlV2zWnSMmKVSs5/fCBnhAyBheMMWULR8HDZNLd5afZ0WMwzF3W Izk=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Improvement are:
- give the path to xlat.lst as argument
- include `grep -v` in compat-build-source.py script, we don't need to
  write this in several scripted language.

Also remove dependency on Makefile as the file generation doesn't
depend on it anymore.

No changes in final compat/%.h headers.

Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
---

Notes:
    v6:
    - remove dependency on Makefile as it's not needed anymore
    
    v5:
    - removed "have 'xlat.lst' path as a variable" from the patch.
    
    v4:
    - new patch

 xen/include/Makefile             | 5 ++---
 xen/tools/compat-build-source.py | 8 +++++++-
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/xen/include/Makefile b/xen/include/Makefile
index c8ca97eed0fc..be3b81485bdc 100644
--- a/xen/include/Makefile
+++ b/xen/include/Makefile
@@ -59,10 +59,9 @@ compat/%.h: compat/%.i Makefile 
$(BASEDIR)/tools/compat-build-header.py
 compat/%.i: compat/%.c Makefile
        $(CPP) $(filter-out -Wa$(comma)% -include 
%/include/xen/config.h,$(XEN_CFLAGS)) $(cppflags-y) -o $@ $<
 
-compat/%.c: public/%.h xlat.lst Makefile 
$(BASEDIR)/tools/compat-build-source.py
+compat/%.c: public/%.h xlat.lst $(BASEDIR)/tools/compat-build-source.py
        mkdir -p $(@D)
-       grep -v 'DEFINE_XEN_GUEST_HANDLE(long)' $< | \
-       $(PYTHON) $(BASEDIR)/tools/compat-build-source.py >$@.new
+       $(PYTHON) $(BASEDIR)/tools/compat-build-source.py xlat.lst <$< >$@.new
        mv -f $@.new $@
 
 compat/.xlat/%.h: compat/%.h compat/.xlat/%.lst $(BASEDIR)/tools/get-fields.sh 
Makefile
diff --git a/xen/tools/compat-build-source.py b/xen/tools/compat-build-source.py
index 2bcaf27d05a3..274d6917ab7f 100755
--- a/xen/tools/compat-build-source.py
+++ b/xen/tools/compat-build-source.py
@@ -13,7 +13,11 @@ pats = [
  [ r"XEN_GUEST_HANDLE", r"COMPAT_HANDLE" ],
 ];
 
-xlatf = open('xlat.lst', 'r')
+try:
+    xlatf = open(sys.argv[1], 'r')
+except IndexError:
+    print('missing path to xlat.lst argument')
+    sys.exit(1)
 for line in xlatf.readlines():
     match = re.subn(r"^\s*\?\s+(\w*)\s.*", r"\1", line.rstrip())
     if match[1]:
@@ -25,6 +29,8 @@ for pat in pats:
     pat[0] = re.compile(pat[0])
 
 for line in sys.stdin.readlines():
+    if 'DEFINE_XEN_GUEST_HANDLE(long)' in line:
+        continue
     for pat in pats:
         line = re.sub(pat[0], pat[1], line)
     print(line.rstrip())
-- 
Anthony PERARD




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.