From 7cea4b0ad0824dfbff37b84796a4255cf46f0c55 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Fri, 13 Jul 2012 10:32:33 +0200 Subject: [PATCH] [ng] dist: do not exceed command line length limits, even with many files * lib/am/distdir.am (am.mkdir-for-dist, am.write-list-of-distfiles): New internal functions. (distdir): Using them and the 'am.xargs-map' function, in a way that should prevent failures due to excessive command line lengths. With this, the tests 'dist-many.sh' and 'dist-many2.sh' pass on the systems where we verified they were previously failing. Signed-off-by: Stefano Lattarini --- lib/am/distdir.am | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/lib/am/distdir.am b/lib/am/distdir.am index 371a57d33..fd2c39d4b 100644 --- a/lib/am/distdir.am +++ b/lib/am/distdir.am @@ -69,6 +69,12 @@ am__dist_parent_dirs = \ $(call am__memoize,am__dist_parent_dirs,$(strip $(sort \ $(filter-out ., $(patsubst ./%,%,$(dir $(am__dist_files_cooked))))))) +am.mkdir-for-dist = \ + @$(MKDIR_P) $(patsubst %,"$(distdir)"/%,$1)$(am__newline) +am.write-list-of-distfiles = \ + @lst='$1'; for x in $$lst; do echo $$x; done \ + >> $(am__dir)/$@-list$(am__newline) + if %?TOPDIR_P% distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) @@ -127,7 +133,7 @@ if %?SUBDIRS% AM_RECURSIVE_TARGETS += distdir endif %?SUBDIRS% -distdir: $(am__dist_files) +distdir: $(am__dist_files) | $(am__dir) ## ## For Gnits users, this is pretty handy. Look at 15 lines ## in case some explanatory text is desirable. @@ -149,16 +155,19 @@ if %?TOPDIR_P% $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" endif %?TOPDIR_P% -## Make the subdirectories for the files. - @$(if $(am__dist_parent_dirs),\ - $(MKDIR_P) $(patsubst %,"$(distdir)"/%,$(am__dist_parent_dirs))) +## Make the subdirectories for the files, avoiding to exceed command +## line length limitations. + $(call am.xargs-map,am.mkdir-for-dist,$(am__dist_parent_dirs)) ## Install the files and directories, applying a "VPATH rewrite" ## by hand where needed. ## To get the files in the distribution directory, use 'cp', not 'ln'. ## There are situations in which 'ln' can fail. For instance a file to ## distribute could actually be a cross-filesystem symlink -- this can ## easily happen if "gettextize" was run on the distribution. - @lst='$(am__dist_files_cooked)'; for file in $$lst; do \ + @rm -f $(am__dir)/$@-list + $(call am.xargs-map,am.write-list-of-distfiles, \ + $(am__dist_files_cooked)) + @while read file; do \ ## Always look for the file or directory to distribute in the build ## directory first, in VPATH spirit. if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ @@ -191,7 +200,7 @@ endif %?TOPDIR_P% || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ - done + done < $(am__dir)/$@-list ## ## Test for directory existence here because previous automake ## invocation might have created some directories. Note that we -- 2.47.2