[Libreoffice-commits] core.git: bin/gla11y solenv/gbuild

Samuel Thibault sthibault at hypra.fr
Thu Mar 1 13:45:13 UTC 2018


 bin/gla11y                              |   16 ++++++++++++----
 solenv/gbuild/UIConfig.mk               |    2 +-
 solenv/gbuild/platform/com_GCC_class.mk |    2 +-
 solenv/gbuild/platform/com_MSC_class.mk |    2 +-
 4 files changed, 15 insertions(+), 7 deletions(-)

New commits:
commit e85b8efafc715f2bf3e240f24617dc1d6aa46d4f
Author: Samuel Thibault <sthibault at hypra.fr>
Date:   Thu Mar 1 13:16:12 2018 +0100

    gla11y: fix build outside source
    
    We need to pass the absolute path to gla11y for build outside source to
    work. We however do not want to expose absolute paths in suppression files,
    so we have to introduce a parameter that provides the common prefix to be
    stripped.
    
    Change-Id: Iaf652cb8d6c3646438f828a0949dfd811f964e77
    Reviewed-on: https://gerrit.libreoffice.org/50568
    Reviewed-by: jan iversen <jani at libreoffice.org>
    Tested-by: jan iversen <jani at libreoffice.org>

diff --git a/bin/gla11y b/bin/gla11y
index 9d550a6ea001..13f1c8e98b97 100755
--- a/bin/gla11y
+++ b/bin/gla11y
@@ -42,6 +42,7 @@ progname = os.path.basename(sys.argv[0])
 suppressions = {}
 gen_suppr = None
 gen_supprfile = None
+suppr_prefix = ""
 outfile = None
 pflag = False
 Werror = False
@@ -133,10 +134,12 @@ def elm_suppr(filename, tree, elm, msgtype):
     Return the prefix to be displayed to the user and the suppression line for
     the warning type "msgtype" for element "elm"
     """
-    global gen_suppr, gen_supprfile, pflag
+    global gen_suppr, gen_supprfile, suppr_prefix, pflag
 
     if suppressions or gen_suppr is not None or pflag:
         prefix = errpath(filename, tree, elm)
+        if prefix[0:len(suppr_prefix)] == suppr_prefix:
+            prefix = prefix[len(suppr_prefix):]
 
     if suppressions or gen_suppr is not None:
         suppr = '%s %s' % (prefix, msgtype)
@@ -151,6 +154,8 @@ def elm_suppr(filename, tree, elm, msgtype):
     if not pflag:
         # Use user-friendly line numbers
         prefix = elm_prefix(filename, elm)
+        if prefix[0:len(suppr_prefix)] == suppr_prefix:
+            prefix = prefix[len(suppr_prefix):]
 
     return (prefix, suppr)
 
@@ -322,20 +327,21 @@ def check_a11y_relation(filename, tree):
 
 
 def usage():
-    print("%s [-W error|none] [-p] [-g SUPPR_FILE] [-s SUPPR_FILE] [-o LOG_FILE] [file ... | -L filelist]" % progname,
+    print("%s [-W error|none] [-p] [-g SUPPR_FILE] [-s SUPPR_FILE] [-P SUPPR_PREFIX] [-o LOG_FILE] [file ... | -L filelist]" % progname,
           file=sys.stderr)
     print("  -p print XML class path instead of line number");
     print("  -g Generate suppression file SUPPR_FILE");
     print("  -s Suppress warnings given by file SUPPR_FILE");
+    print("  -P Suppress SUPPR_PREFIX from emitted warnings, e.g. absolute source directory");
     print("  -o Also prints errors and warnings to given file");
     sys.exit(2)
 
 
 def main():
-    global pflag, Werror, Wnone, gen_suppr, gen_supprfile, suppressions, errors, outfile
+    global pflag, Werror, Wnone, gen_suppr, gen_supprfile, suppressions, suppr_prefix, errors, outfile
 
     try:
-        opts, args = getopt.getopt(sys.argv[1:], "W:pg:s:o:L:")
+        opts, args = getopt.getopt(sys.argv[1:], "W:pg:s:P:o:L:")
     except getopt.GetoptError:
         usage()
 
@@ -354,6 +360,8 @@ def main():
             gen_suppr = a
         elif o == "-s":
             suppr = a
+        elif o == "-P":
+            suppr_prefix = a
         elif o == "-o":
             out = a
         elif o == "-L":
diff --git a/solenv/gbuild/UIConfig.mk b/solenv/gbuild/UIConfig.mk
index a0d8974fffe9..c5a04e33ab56 100644
--- a/solenv/gbuild/UIConfig.mk
+++ b/solenv/gbuild/UIConfig.mk
@@ -190,7 +190,7 @@ $(call gb_UIConfig_get_imagelist_target,$(1)) : UI_IMAGELISTS += $(call gb_UIIma
 $(call gb_UIConfig_get_imagelist_target,$(1)) : $(call gb_UIImageListTarget_get_target,$(2))
 $(call gb_UIConfig_get_clean_target,$(1)) : $(call gb_UIImageListTarget_get_clean_target,$(2))
 
-$(call gb_UIConfig_get_a11yerrors_target,$(1)) : UIFILES += $(2).ui
+$(call gb_UIConfig_get_a11yerrors_target,$(1)) : UIFILES += $(SRCDIR)/$(2).ui
 
 endef
 
diff --git a/solenv/gbuild/platform/com_GCC_class.mk b/solenv/gbuild/platform/com_GCC_class.mk
index 3345c7f6cca3..6d5393d2fad9 100644
--- a/solenv/gbuild/platform/com_GCC_class.mk
+++ b/solenv/gbuild/platform/com_GCC_class.mk
@@ -159,7 +159,7 @@ define gb_UIConfig__gla11y_command
 $(call gb_Helper_abbreviate_dirs,\
 	$(gb_UIConfig_LXML_PATH) $(gb_Helper_set_ld_path) \
 	$(call gb_ExternalExecutable_get_command,python) \
-	$(gb_UIConfig_gla11y_SCRIPT) -s $(UI_A11YSUPPRS) $(GEN_A11Y_SUPPRS) -o $@ $(UIFILES)
+	$(gb_UIConfig_gla11y_SCRIPT) -s $(UI_A11YSUPPRS) $(GEN_A11Y_SUPPRS) -P $(SRCDIR)/ -o $@ $(UIFILES)
 )
 
 endef
diff --git a/solenv/gbuild/platform/com_MSC_class.mk b/solenv/gbuild/platform/com_MSC_class.mk
index 467d27cbc529..0a1cdab314ac 100644
--- a/solenv/gbuild/platform/com_MSC_class.mk
+++ b/solenv/gbuild/platform/com_MSC_class.mk
@@ -583,7 +583,7 @@ $(call gb_Helper_abbreviate_dirs,\
 	FILES=$(call var2file,$(shell $(gb_MKTEMP)),100,$(UIFILES)) && \
 	$(gb_UIConfig_LXML_PATH) $(gb_Helper_set_ld_path) \
 	$(call gb_ExternalExecutable_get_command,python) \
-	$(gb_UIConfig_gla11y_SCRIPT) -s $(UI_A11YSUPPRS) $(GEN_A11Y_SUPPRS) -o $@ -L $$FILES
+	$(gb_UIConfig_gla11y_SCRIPT) -s $(UI_A11YSUPPRS) $(GEN_A11Y_SUPPRS) -P $(SRCDIR)/ -o $@ -L $$FILES
 )
 
 endef


More information about the Libreoffice-commits mailing list