MutopiaProject / MutopiaWeb

MutopiaProject site evolution to HTML5
3 stars 7 forks source link

New OS agnostic script for mutopia-combine.sh #11

Closed ksnortum closed 8 years ago

ksnortum commented 8 years ago

This is one of several scripts I wrote in Perl that provide an alternative to the Linux-centric shell scripts currently on the site. I'm hoping they will be useful to others.

ksnortum commented 8 years ago

I'm not sure I get how mutopia-combine.sh is supposed to work. If the folder is piece_name and it contains piece_name-lys then it seems like it should look in -lys folder for the files (*.ps.gz, *png, et al) and zip them in piece_name. This is the structure I see when I looked at MutopiaProject.org. But this is not what mutopia-combine.sh is doing.

Maybe we should come back to this one after a while.

ksnortum commented 8 years ago

I don't know make very well, here's my understanding of the following:

# Makefile.single_ly

all: $(addsuffix .rdf, $(basename $(wildcard *.ly))) \
     $(addsuffix .log, $(basename $(wildcard *.ly)))

%.rdf: %.ly
    mutopia-clean.sh
    java Mutopia -f $<
    mutopia-compile.sh $<
    mutopia-combine.sh $(basename $<)

%.log: %.ly
    mutopia-history.sh

When the target file is any file ending in .rdf, check that you have a file ending in .ly. Then do mutopia-clean.sh (which needs no file input), java Mutopia -f with the first (only?) .ly file, mutopia-compile.sh with the first .ly file, then mutopia-combine.sh with the basname of the first .ly file.

Does this sound correct?

glenl commented 8 years ago

"make" is all about dependency rules. It is not a check for the existence of the item to the right of the ":", it is a check for modification of the right-hand side.

The "%.log" rule is a "pure" make rule --- you have foo.log that you build from foo.ly. If foo.ly changes, rebuild the foo.log with mutopia-history.sh.

The "%.rdf" rule will build foo.rdf if foo.ly changes; do this by first doing a clean, then update the fields in foo.ly (to get new build date and copyright), build them, then combine. This rule isn't pure because there are many side-effects; in this case the rule is using the change difference between foo.rdf and foo.ly (or the existence of foo.rdf) as a trigger to build several items. It is circular because when the foo.ly file changes, the rule rebuilds foo,ly (this rules dependency) with the Mutopia -f foo.ly command.

This is Makfile.single_ly so, yes, it should be applied to a single .ly file.

glenl commented 8 years ago

That's the last time I will use email to write a GITHUB reply. I'll edit it to remove the citing.