tools/gnulib: use exact directory copy for install

The python implementation of gnulib-tool
uses a hidden file as the independent main function.

A copy with glob ('*') does not include hidden files
at the top level directory, so use whole directory copy
instead and remove the patch for a non-hidden python file.

Ensure the directory does not already exist
by attempting uninstall first to remove it
and by not using "install" to create a directory.

Rename the clean target to uninstall, as it handles
the staging directory and not the build directory.

Removed:
 - 021-python-main.patch

Signed-off-by: Michael Pratt <mcpratt@pm.me>
Link: https://github.com/openwrt/openwrt/pull/16522
Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit is contained in:
Michael Pratt 2025-05-31 14:07:05 -04:00 committed by Robert Marko
parent b07b8c8b43
commit 774ce21c66
2 changed files with 3 additions and 18 deletions

View File

@ -14,14 +14,14 @@ define Host/Configure
endef
define Host/Install
$(call Host/Uninstall)
$(INSTALL_DIR) $(1)/share/aclocal
$(INSTALL_DATA) $(HOST_BUILD_DIR)/m4/*.m4 $(1)/share/aclocal/
$(INSTALL_DIR) $(1)/share/gnulib
$(CP) $(HOST_BUILD_DIR)/* $(1)/share/gnulib/
$(CP) $(HOST_BUILD_DIR)/ $(1)/share/gnulib/
ln -sf ../share/gnulib/gnulib-tool $(STAGING_DIR_HOST)/bin/gnulib-tool
endef
define Host/Clean
define Host/Uninstall
rm -rf $(STAGING_DIR_HOST)/bin/gnulib-tool $(STAGING_DIR_HOST)/share/gnulib
endef

View File

@ -1,15 +0,0 @@
--- /dev/null
+++ b/gnulib-tool-main.py
@@ -0,0 +1,4 @@
+from pygnulib import main
+
+if __name__ == '__main__':
+ main.main_with_exception_handling()
--- a/gnulib-tool.py
+++ b/gnulib-tool.py
@@ -157,4 +157,4 @@ fi
profiler_args=
# For profiling, cf. <https://docs.python.org/3/library/profile.html>.
#profiler_args="-m cProfile -s tottime"
-exec python3 $profiler_args "$gnulib_dir/.gnulib-tool.py" "$@"
+exec python3 $profiler_args "$gnulib_dir/gnulib-tool-main.py" "$@"