It seems that gettext catches a lot of issues with gnulib-tool.py... The first patch addresses this:
diff -ru /home/collin/.local/src/gettext/gettext-runtime/gnulib-m4/gnulib-cache.m4 /home/collin/.local/src/glpyVCpuH3/gettext-runtime/gnulib-m4/gnulib-cache.m4 --- /home/collin/.local/src/gettext/gettext-runtime/gnulib-m4/gnulib-cache.m4 2024-04-06 05:23:27.471667282 -0700 +++ /home/collin/.local/src/glpyVCpuH3/gettext-runtime/gnulib-m4/gnulib-cache.m4 2024-04-06 06:06:28.102539887 -0700 @@ -34,7 +34,7 @@ # --m4-base=gnulib-m4 \ # --doc-base=doc \ # --tests-base=tests \ -# --aux-dir=../build-aux \ +# --aux-dir=build-aux \ # --no-conditional-dependencies \ # --no-libtool \ # --macro-prefix=gl \ Only in /home/collin/.local/src/glpyVCpuH3/gettext-runtime/gnulib-m4: gnulib-cache.m4~ diff -ru /home/collin/.local/src/gettext/gettext-runtime/gnulib-m4/gnulib-comp.m4 /home/collin/.local/src/glpyVCpuH3/gettext-runtime/gnulib-m4/gnulib-comp.m4 --- /home/collin/.local/src/gettext/gettext-runtime/gnulib-m4/gnulib-comp.m4 2024-04-06 05:23:29.262666548 -0700 +++ /home/collin/.local/src/glpyVCpuH3/gettext-runtime/gnulib-m4/gnulib-comp.m4 2024-04-06 06:06:28.103539887 -0700 @@ -387,7 +387,7 @@ gl_CONDITIONAL([GL_COND_OBJ_CLOSE], [test $REPLACE_CLOSE = 1]) gl_UNISTD_MODULE_INDICATOR([close]) AC_REQUIRE([gt_CSHARPCOMP]) - AC_CONFIG_FILES([csharpcomp.sh:../build-aux/csharpcomp.sh.in]) + AC_CONFIG_FILES([csharpcomp.sh:build-aux/csharpcomp.sh.in]) This is because gnulib-tool.py gets the auxdir from AC_CONFIG_AUX_DIR with destdir. This seems to be incorrect based on the section of code in gnulib-tool.sh starting at line 7275: if test -z "$auxdir"; then auxdir="$guessed_auxdir" fi The second patch addresses this: diff -ru /home/collin/.local/src/gettext/gettext-runtime/gnulib-lib/Makefile.am /home/collin/.local/src/glpyaGkFPQ/gettext-runtime/gnulib-lib/Makefile.am --- /home/collin/.local/src/gettext/gettext-runtime/gnulib-lib/Makefile.am 2024-04-06 05:23:34.728664307 -0700 +++ /home/collin/.local/src/glpyaGkFPQ/gettext-runtime/gnulib-lib/Makefile.am 2024-04-06 06:13:24.432322731 -0700 @@ -379,7 +379,7 @@ ## begin gnulib module csharpcomp-script -EXTRA_DIST += $(top_srcdir)/../build-aux/csharpcomp.sh.in +EXTRA_DIST += build-aux/csharpcomp.sh.in Since joinpath() uses os.path.norm(), it will see '$(top_srcdir)/..' and delete both path components. This is incorrect. I've just wrapped that variable with os.path.join() for now which will prevent it from being deleted. That function is starting to become pretty annoying though. :( Collin
From f6015a5f2416c2e077fc85b94e474a4921f59f04 Mon Sep 17 00:00:00 2001 From: Collin Funk <collin.fu...@gmail.com> Date: Sat, 6 Apr 2024 05:57:51 -0700 Subject: [PATCH 2/3] gnulib-tool.py: Use auxdir as given by AC_CONFIG_AUX_DIR. * pygnulib/GLImport.py (GLImport.__init__): Don't modify the path given by AC_CONFIG_AUX_DIR by prefixing it with destdir. Use a more strict regular expression instead of cleaner(). --- ChangeLog | 7 +++++++ pygnulib/GLImport.py | 7 +++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index feed5699f7..9e94583721 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2024-04-06 Collin Funk <collin.fu...@gmail.com> + + gnulib-tool.py: Use auxdir as given by AC_CONFIG_AUX_DIR. + * pygnulib/GLImport.py (GLImport.__init__): Don't modify the path given + by AC_CONFIG_AUX_DIR by prefixing it with destdir. Use a more strict + regular expression instead of cleaner(). + 2024-04-06 Collin Funk <collin.fu...@gmail.com> gnulib-tool.py: Locate configure.ac correctly when --dir is given. diff --git a/pygnulib/GLImport.py b/pygnulib/GLImport.py index ee238a1615..2776f2c964 100644 --- a/pygnulib/GLImport.py +++ b/pygnulib/GLImport.py @@ -93,11 +93,10 @@ class GLImport: self.cache.setAuxDir('.') with codecs.open(self.config.getAutoconfFile(), 'rb', 'UTF-8') as file: data = file.read() - pattern = re.compile(r'^AC_CONFIG_AUX_DIR\((.*)\)$', re.M) - match = pattern.findall(data) + pattern = re.compile(r'^AC_CONFIG_AUX_DIR\([\[ ]*([^\]"\$`\\\)]+).*?$', re.MULTILINE) + match = pattern.search(data) if match: - result = cleaner(match)[0] - self.cache.setAuxDir(joinpath(self.config['destdir'], result)) + self.cache.setAuxDir(match.group(1)) pattern = re.compile(r'A[CM]_PROG_LIBTOOL', re.M) guessed_libtool = bool(pattern.findall(data)) if self.config['auxdir'] == '': -- 2.44.0
From d93e3cd4657a3fa9c05bee6b1249cf5d9d6fe3d4 Mon Sep 17 00:00:00 2001 From: Collin Funk <collin.fu...@gmail.com> Date: Sat, 6 Apr 2024 06:04:52 -0700 Subject: [PATCH 3/3] gnulib-tool.py: Don't allow path normalization to delete a variable. * pygnulib/GLModuleSystem.py (GLModule.getAutomakeSnippet_Unconditional): Use os.path.join() on the Makefile variable so it isn't deleted by a following '..' from os.path.norm(). --- ChangeLog | 8 ++++++++ pygnulib/GLModuleSystem.py | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 9e94583721..2b633d174a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2024-04-06 Collin Funk <collin.fu...@gmail.com> + + gnulib-tool.py: Don't allow path normalization to delete a variable. + * pygnulib/GLModuleSystem.py + (GLModule.getAutomakeSnippet_Unconditional): Use os.path.join() on the + Makefile variable so it isn't deleted by a following '..' from + os.path.norm(). + 2024-04-06 Collin Funk <collin.fu...@gmail.com> gnulib-tool.py: Use auxdir as given by AC_CONFIG_AUX_DIR. diff --git a/pygnulib/GLModuleSystem.py b/pygnulib/GLModuleSystem.py index 98a21c4696..f8ff71383a 100644 --- a/pygnulib/GLModuleSystem.py +++ b/pygnulib/GLModuleSystem.py @@ -645,7 +645,7 @@ class GLModule: buildaux_files = filter_filelist(constants.NL, all_files, 'build-aux/', '', 'build-aux/', '') if buildaux_files != '': - buildaux_files = [ joinpath('$(top_srcdir)', auxdir, filename) + buildaux_files = [ os.path.join('$(top_srcdir)', joinpath(auxdir, filename)) for filename in buildaux_files.split(constants.NL) ] result += 'EXTRA_DIST += %s' % ' '.join(buildaux_files) result += '\n\n' -- 2.44.0