diff options
author | Alexander Köplinger <alex.koeplinger@outlook.com> | 2018-01-02 16:03:12 +0300 |
---|---|---|
committer | Alexander Köplinger <alex.koeplinger@outlook.com> | 2018-01-02 18:51:09 +0300 |
commit | c354ac8ac1c5e88b63b80de18e9406cff81c7b70 (patch) | |
tree | cd3f7e76cb693dc80b07af29903771a9f41df756 /mcs | |
parent | 1003597c4e2664689e2cfa6ef5f17d4e3274b7cf (diff) |
Dist files in groups of 100 entries
On some distros the number of strings you can pass to execve()
is limited which means you get the following error when trying
to create the tarball:
```
make[5]: execvp: /bin/sh: Argument list too long
make[5]: * [../../build/rules.make:303: dist-default] Error 127
```
To solve this we split the DISTFILES variable into groups of 100
entries and invoke the shell for each group instead of adding all
into the same invocation. Also removed looking for 'makefile' and
'GNUmakefile' since those don't exist in Mono and simplifies the logic.
Found during investigation of https://github.com/mono/mono/issues/6349
Diffstat (limited to 'mcs')
-rw-r--r-- | mcs/build/rules.make | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/mcs/build/rules.make b/mcs/build/rules.make index d7baee55f31..b01c8291b77 100644 --- a/mcs/build/rules.make +++ b/mcs/build/rules.make @@ -288,6 +288,15 @@ dist-recursive: dist-local (cd $$d && $(MAKE) distdir=$$reldir/$$d $@) || exit 1 ; \ done +# function to dist files in groups of 100 entries to make sure we don't exceed shell char limits +define distfilesingroups +for f in $(wordlist 1, 100, $(1)) ; do \ + dest=`dirname "$(distdir)/$$f"` ; \ + $(MKINSTALLDIRS) $$dest && cp -p "$$f" $$dest || exit 1 ; \ +done +$(if $(word 101, $(1)), $(call distfilesingroups, $(wordlist 101, $(words $(1)), $(1)))) +endef + # The following target can be used like # # dist-local: dist-default @@ -296,17 +305,11 @@ dist-recursive: dist-local # Notes: # 1. we invert the test here to not end in an error if ChangeLog doesn't exist. # 2. we error out if we try to dist a nonexistant file. -# 3. we pick up Makefile, makefile, or GNUmakefile. +# 3. we pick up Makefile dist-default: -mkdir -p $(distdir) test '!' -f ChangeLog || cp ChangeLog $(distdir) - if test -f Makefile; then m=M; fi; \ - if test -f makefile; then m=m; fi; \ - if test -f GNUmakefile; then m=GNUm; fi; \ - for f in $${m}akefile $(DISTFILES) ; do \ - dest=`dirname "$(distdir)/$$f"` ; \ - $(MKINSTALLDIRS) $$dest && cp -p "$$f" $$dest || exit 1 ; \ - done + $(call distfilesingroups, Makefile $(DISTFILES)) if test -d Documentation ; then \ find . -name '*.xml' > .files ; \ tar cTf .files - | (cd $(distdir); tar xf -) ; \ |