+2024-03-22 Bruno Haible <bruno@clisp.org>
+
+ gnulib-tool: Remove test-driver.{orig,rej} if patching succeeded.
+ * gnulib-tool.sh (func_create_testdir, func_create_megatestdir): After
+ a 'patch' command failed, remove the leftover files test-driver.orig and
+ test-driver.rej.
+ * pygnulib/GLTestDir.py (_patch_test_driver): Likewise.
+
2024-03-22 Bruno Haible <bruno@clisp.org>
gnulib-tool.py: Fix an error in --create-testdir.
(cd "$testdir"
if test -f build-aux/test-driver; then
patch build-aux/test-driver < "$gnulib_dir"/build-aux/test-driver.diff \
- || patch build-aux/test-driver < "$gnulib_dir"/build-aux/test-driver-1.16.3.diff \
- || func_exit 1
+ || { rm -f build-aux/test-driver.orig build-aux/test-driver.rej
+ patch build-aux/test-driver < "$gnulib_dir"/build-aux/test-driver-1.16.3.diff \
+ || { rm -f build-aux/test-driver.orig build-aux/test-driver.rej
+ func_exit 1
+ }
+ }
fi
) || func_exit 1
}
rm -rf autom4te.cache
if test -f build-aux/test-driver; then
patch build-aux/test-driver < "$gnulib_dir"/build-aux/test-driver.diff \
- || patch build-aux/test-driver < "$gnulib_dir"/build-aux/test-driver-1.16.3.diff \
- || func_exit 1
+ || { rm -f build-aux/test-driver.orig build-aux/test-driver.rej
+ patch build-aux/test-driver < "$gnulib_dir"/build-aux/test-driver-1.16.3.diff \
+ || { rm -f build-aux/test-driver.orig build-aux/test-driver.rej
+ func_exit 1
+ }
+ }
fi
) || func_exit 1
}
try:
result = sp.call(command, shell=True)
except OSError:
+ if isfile(f'{test_driver}.orig'):
+ os.remove(f'{test_driver}.orig')
+ if isfile(f'{test_driver}.rej'):
+ os.remove(f'{test_driver}.rej')
raise GLError(20, None)
if result == 0:
patched = True
break
+ if isfile(f'{test_driver}.orig'):
+ os.remove(f'{test_driver}.orig')
+ if isfile(f'{test_driver}.rej'):
+ os.remove(f'{test_driver}.rej')
if not patched:
raise GLError(20, None)