From: Ben Pfaff Date: Fri, 25 Sep 2009 04:38:09 +0000 (-0700) Subject: perl-module: Tolerate minor PSPP version number differences. X-Git-Tag: build41 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=30f2130261c2b4bdd9dbf95aa7c5cbbdaef4c014;p=pspp-builds.git perl-module: Tolerate minor PSPP version number differences. 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. --- diff --git a/perl-module/PSPP.xs b/perl-module/PSPP.xs index 36300cc8..8572c6fe 100644 --- a/perl-module/PSPP.xs +++ b/perl-module/PSPP.xs @@ -164,7 +164,11 @@ void 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); diff --git a/src/libpspp/automake.mk b/src/libpspp/automake.mk index 5e434206..c7992b46 100644 --- a/src/libpspp/automake.mk +++ b/src/libpspp/automake.mk @@ -89,7 +89,7 @@ src/libpspp/version.c: $(top_srcdir)/AUTHORS Makefile 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@\";" >> $@