]> git.donarmstrong.com Git - lilypond.git/commitdiff
Fix 1821: Write pathes for ly-to-tely to a separate file rather than passing as cmd...
authorReinhold Kainhofer <reinhold@kainhofer.com>
Tue, 30 Aug 2011 11:42:39 +0000 (13:42 +0200)
committerReinhold Kainhofer <reinhold@kainhofer.com>
Thu, 1 Sep 2011 16:28:24 +0000 (18:28 +0200)
For out-of-source builds, the collated files list has the whole absolute path
for each and every file (>1000 for our regtests), which blows up the cmd line
length to values that don't work with the shell (<=131000 chars allowed...).

This patch takes the list in the makefile and writes the filenames in several
patches (300 at a time for now) to a .list file and then passes just this one
file to lys-to-tely, which reads in the whole long list of file names from that
file. The trick is that while make can handle long variables, we can't pass
it to ly-to-tely on the cmd line, but have to use a helper file.

make/lysdoc-rules.make
scripts/build/lys-to-tely.py

index 5c38f7d4ab33e3bf6db41eb100b61f9804877da4..e8fe8a182eda44a271fab1c496cb151a2140a6da 100644 (file)
@@ -1,2 +1,19 @@
-$(outdir)/collated-files.tely: $(COLLATED_FILES)
-       $(LYS_TO_TELY) --name=$(outdir)/collated-files.tely --title="$(TITLE)" --author="$(AUTHOR)" $^
+$(outdir)/collated-files.list: $(COLLATED_FILES)
+       echo "(Re-)Generating $@"
+       # We can't print the list in one go, as it might be longer than a
+       # shell command is allowed (as of linux 2.6.3x >131000 chars)
+       @echo $(wordlist    1, 299,$^)>$@
+       @echo $(wordlist  300, 599,$^)>>$@
+       @echo $(wordlist  600, 899,$^)>>$@
+       @echo $(wordlist  900,1199,$^)>>$@
+       @echo $(wordlist 1200,1499,$^)>>$@
+       @echo $(wordlist 1500,1799,$^)>>$@
+       @echo $(wordlist 1800,2099,$^)>>$@
+       @echo $(wordlist 2100,2399,$^)>>$@
+       @echo $(wordlist 2400,2699,$^)>>$@
+       @echo $(wordlist 2700,2999,$^)>>$@
+       # Print the rest, just in case the list is that long
+       echo $(wordlist 3000,$(words $^),$^)>>$@
+
+$(outdir)/collated-files.tely: $(outdir)/collated-files.list
+       $(LYS_TO_TELY) --name=$(outdir)/collated-files.tely --title="$(TITLE)" --author="$(AUTHOR)" --input-filename=$^
index 6a2a05ed7df95cc524222b72f7c61e58fbe67b96..a868ea2903395ebadec6f19383d183810a2170a9 100644 (file)
@@ -151,7 +151,7 @@ def name2line (n):
 if glob_input:
     files = glob.glob(glob_input)
 elif input_filename:
-    files = open(input_filename).read().splitlines()
+    files = open(input_filename).read().split()
 
 if files:
     dir = os.path.dirname (name) or "."