The PSPP autobuilder that I'm working on appends a build number to the PSPP
version number, e.g. "0.7.2-build40". The Perl module has two problems
with this:
1. Perl won't parse version numbers that contain anything other than
digits and periods, so "-build" causes an error. So this commit
drops everything from the hyphen onward from the PSPP version number
passed along to Perl.
2. The Perl module itself does a string comparison operation between the
number it expects and the number that PSPP reports. When we drop
the hyphen onward, the comparison fails. So this commit also relaxes
the comparison to one that does pass.
onBoot (ver)
const char *ver
CODE:
- assert (0 == strcmp (ver, bare_version));
+ /* Check that the version is correct up to the length of 'ver'.
+ This allows PSPP autobuilders to add a "-build#" suffix to the
+ PSPP version without causing failures here. */
+ assert (0 == strncmp (ver, bare_version, strlen (ver)));
+
i18n_init ();
msg_init (NULL, message_handler);
settings_init (0, 0);
echo " Generated by src/libpspp/automake.mk --- Do not edit.">> $@
echo "" >> $@
echo " The following line is for the benefit of the perl module" >>$@
- echo "\$$VERSION='"@VERSION@"';" >> $@
+ echo "\$$VERSION='`echo '$(VERSION)' | sed 's/-.*//'`';" >> $@
echo "*/" >> $@
echo "#include \"version.h\"" >> $@
echo "const char bare_version[] = \"@VERSION@\";" >> $@