bug-gnulib
[Top][All Lists]
Advanced

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

gnulib-tool.py: Avoid undesired diagnostics from the 'patch' command


From: Bruno Haible
Subject: gnulib-tool.py: Avoid undesired diagnostics from the 'patch' command
Date: Sat, 23 Mar 2024 18:11:57 +0100

With Automake 1.16.3 in $PATH, I see this test failure:

$ GNULIB_TOOL_IMPL=py ./test-create-testdir-2.sh
./test-create-testdir-2.out tmp2119378-out differ: byte 16366, line 886
--- ./test-create-testdir-2.out 2024-03-19 17:28:37.195424671 +0100
+++ tmp2119378-out      2024-03-23 18:05:58.725173290 +0100
@@ -883,6 +883,10 @@
   tests/test-stat.h
   tests/test-stdbool.c
   tests/test-stdckdint.c
+patching file build-aux/test-driver
+Hunk #1 FAILED at 109.
+1 out of 1 hunk FAILED -- saving rejects to file build-aux/test-driver.rej
+patching file build-aux/test-driver
   tests/test-stddef.c
   tests/test-stdint.c
   tests/test-stdio.c
@@ -936,4 +940,3 @@
 executing autoheader
 executing touch config.h.in
 executing automake --add-missing --copy
-patching file build-aux/test-driver
FAIL: gnulib-tool's output has unexpected differences.

This patch fixes it, reflecting my commit to gnulib-tool.sh from yesterday.


2024-03-23  Bruno Haible  <bruno@clisp.org>

        gnulib-tool.py: Produce same diagnostics regardless of Automake version.
        * pygnulib/GLTestDir.py (_patch_test_driver): Suppress the diagnostics
        from 'patch', and instead provide our own diagnostics.

diff --git a/pygnulib/GLTestDir.py b/pygnulib/GLTestDir.py
index 5f6fc1a0d9..c1ab923386 100644
--- a/pygnulib/GLTestDir.py
+++ b/pygnulib/GLTestDir.py
@@ -63,6 +63,7 @@ normpath = os.path.normpath
 def _patch_test_driver() -> None:
     '''Patch the test-driver script in testdirs.'''
     test_driver = joinpath('build-aux', 'test-driver')
+    print('patching file %s' % test_driver)
     diffs = [ joinpath(DIRS['root'], name)
               for name in [joinpath('build-aux', 'test-driver.diff'),
                            joinpath('build-aux', 'test-driver-1.16.3.diff')]]
@@ -70,7 +71,7 @@ def _patch_test_driver() -> None:
     for diff in diffs:
         command = f'patch {test_driver} < {diff}'
         try:
-            result = sp.call(command, shell=True)
+            result = sp.call(command, shell=True, stdout=sp.DEVNULL, 
stderr=sp.DEVNULL)
         except OSError:
             if isfile(f'{test_driver}.orig'):
                 os.remove(f'{test_driver}.orig')






reply via email to

[Prev in Thread] Current Thread [Next in Thread]