Subject: | Cleaner Makefile recipe for downloading test datasets |
Date: | Sat, 23 Jun 2018 23:19:43 -0400 |
To: | <bug-Unicode-LineBreak [...] rt.cpan.org> |
From: | Daniel Macks <dmacks [...] netspace.org> |
The downloading of test datasets seems overly complicated. From Unicode-LineBreak-2018.003 on OS X 10.13 using Apple's perl-5.18.2, Makefile.PL generates Makefile that contains:
copy_unidata :
cd test-data; \
[ -f LineBreakTest.txt ] || \
wget -q -N -O LineBreakTest.txt \
ftp://unicode.org/Public/8.0.0/ucd/auxiliary/LineBreakTest*.txt \
|| $(NOOP)
cd test-data; \
[ -f GraphemeBreakTest.txt ] || \
wget -q -N -O GraphemeBreakTest.txt \
ftp://unicode.org/Public/8.0.0/ucd/auxiliary/GraphemeBreakTest*.txt \
|| $(NOOP)
The concept is that each file needs to exist, and if it doesn't, a command should be executed to create it. That suggests that each file could have its own recipe and use standard Makefile dependencies rather than a monolithic set of shell file tests. For example:
copy_unidata : test-data/LineBreakTest.txt test-data/GraphemeBreakTest.txt
test-data/LineBreakTest.txt:
wget -q -N -O $@ ftp://unicode.org/Public/8.0.0/ucd/auxiliary/LineBreakTest*.txt
test-data/GraphemeTest.txt:
wget -q -N -O $@ ftp://unicode.org/Public/8.0.0/ucd/auxiliary/GraphemeBreakTest*.txt
It's now also self-documenting what needs what and how it comes to exist. I'm not sure why the "|| $(NOOP)" was used, but it seems like that would mask failures of wget, leaving things in a poor state and triggering harder-to-diagnose failures later.
dan