[Rd] non-digits in svnversion output mess up windows build if USE_SVNVERSION=yes (PR#11339)

Bill Dunlap bill at insightful.com
Tue Apr 29 23:05:09 CEST 2008


On Tue, 29 Apr 2008, Duncan Murdoch wrote:

> This is not a bug, it's a feature.
>
> It stops me from distributing versions with unintentional uncommitted
> changes.

It does have that effect, but the error messages
are pretty obscure:
    c:\Rtools\MinGW\bin\windres.exe: rcico.rc:9: syntax error
and
    Error on line 12 in
    e:\R\R-svn\r-devel\src\gnuwin32\installer\R.iss: Value of [Setup]
    section directive "VersionInfoVersion" is invalid.

Both problems are Windows-specific and the desire to not distribute
versions with unintentional uncommitted uncommitted changes is not
Windows-specific.

Note that the rcico.rc problem arises as the first step of compiling R
on Windows from clean source tree, so you cannot even test a proposed
change.  I ran into it because I had to change src/gnuwin32/MkRules to
say that I put Inno Setup in its standard place, "C:/Program Files/Inno
Setup 5", and not in "C:/packages/inno".

I guess I don't need to have USE_SVNVERSION=yes, but doing that means
that version$"svn rev" shows me I have a non-standard version:  that
will show the svn version as something like "123M" or "123:145S".  It
is too bad it only is available on the Windows build.  I think it would
be a good thing to have on the non-Windows builds also.  They use 'svn
info' instead, which does not tell you that the local version is not
the standard one.

If we did that on all platforms then we could check the disribution by
checking that !is.na(as.integer(svn$"svn rev")).

It might also be nice to include the output of 'svn diff' in the
distribution so a user or tester could see how this version was
different than the official one.

> On 29/04/2008 2:30 PM, bill at insightful.com wrote:
> > Full_Name: Bill Dunlap
> > Version: 2.8.0dev
> > OS: Windows XP
> > Submission from: (NULL) (70.98.76.47)
> >
> >
> > I tried for the first time to build R from source on Windows, where I
> > got the source code via svn.  Per the Installation and Administration
> > manual, I altered src\gnuwin32\MkRules so it had the the locally
> > correct paths to HTML Help Workshop and Inno Setup 5.  I also set
> > USE_SVNVERSION=yes, as suggested in MkRules itself.  Then, while in
> > the directory src/gnuwin32 I ran 'make all recommended' and got an
> > error from windres very early in the build:
> >
> >   E:\R\R-svn\r-devel\src\gnuwin32>make all recommended
> >   make --no-print-directory -C front-ends Rpwd
> >   make -C ../../include -f Makefile.win version
> >   make Rpwd.exe
> >   gcc  -std=gnu99 -I../../include  -O3 -Wall -pedantic  -c rpwd.c -o rpwd.o
> >   windres --preprocessor="gcc -E -xc -DRC_INVOKED"   -i rcico.rc -o rcico.o
> >   c:\Rtools\MinGW\bin\windres.exe: rcico.rc:9: syntax error
> >   make[3]: *** [rcico.o] Error 1
> >   make[2]: *** [Rpwd] Error 2
> >   make[1]: *** [front-ends/Rpwd.exe] Error 2
> >   make: *** [all] Error 2
> >
> > Line 9 of src\gnuwin32\front-ends\rcico.rc is
> >   FILEVERSION R_FILEVERSION
> > The problem was that my change to MkRules caused 'svnversion' to put an
> > 'M' (modified) on the end of the svn version it reports.  This svn
> > version number is used in the R_FILEVERSION macro, which is used in in
> > the *.rc files.  The resource file compiler, windres, appears to choke on
> > non-digits in R_FILEVERSION.  (A comment in tools\GETVERSION indicates
> > it might choke on leading 0's as well.)
> >
> > svnversion can also output a string of the form "123:125"
> > to mean the current source is from a variety of svn revisions,
> > between 123 through 125.  An "M" or "S" may also be appended.
> > If you don't have Subversion installed then you might get
> > a svn version of "unknown".  None of these non-digits is
> > acceptble to windres.
> >
> > I patched tools/GETVERSION to fix up this problem.  It removes
> > the trailing M or S and removes anything up to an including a
> > colon, so it reports the highest version in the range.  If there
> > are still non-digits in there it makes the version string "0"
> > (not useful, but doesn't kill the build with a noninformative
> > error message).
> >
> > I ran into another problem with the trailing 'M' from svnversion
> > when doing 'make rinstaller' in R_HOME/src/gnuwin32:
> >    E:\R\R-svn\r-devel\src\gnuwin32\installer>type R-2.8.0dev.log
> >    Inno Setup 5 Command-Line Compiler
> >    ...
> >    Compiler engine version: Inno Setup 5.2.3 (ISPP 5.2.3.0)
> >    ...
> >    [ISPP] Preprocessing.
> >    ...
> >    [ISPP] Preprocessed.
> >    Parsing [Setup] section, line 10
> >    ...
> >    Parsing [Setup] section, line 20
> >    Error on line 12 in e:\R\R-svn\r-devel\src\gnuwin32\installer\R.iss: Value of
> > [Setup] section directive "VersionInfoVersion" is invalid.
> >    Compile aborted.
> > The offending line 12 in R.iss is
> >     12  VersionInfoVersion=2.8.0.45381M
> > and it is put there by src/gnuwin32/installer/JRins.pl.
> >
> > I patched JRins.pl to ensure the svn revision consisted
> > of only digits.
> >
> > Then I could build R on Windows (make distribution)
> > with USE_SVNVERSION=yes set in src/gnuwin32/MkRules
> > and with a variety of svn revision settings.
> >
> > Index: src/gnuwin32/installer/JRins.pl
> > ===================================================================
> > --- src/gnuwin32/installer/JRins.pl     (revision 45553)
> > +++ src/gnuwin32/installer/JRins.pl     (working copy)
> > @@ -44,6 +44,11 @@
> >  $SVN = <ver>;
> >  close ver;
> >  $SVN =~s/Revision: //;
> > +## inno setup requires that SVN be all numeric, not 123M, 120:123, "unknown",
> > or empty
> > +$SVN =~s/[MS]* *$//;
> > +$SVN =~s/^.*://;
> > +$SVN =~s/[^0-9]//g;
> > +$SVN =~s/^$/0/;
> >  $RVER0 .= "." . $SVN;
> >
> >  open insfile, "> R.iss" || die "Cannot open R.iss\n";
> > Index: tools/GETVERSION
> > ===================================================================
> > --- tools/GETVERSION    (revision 45479)
> > +++ tools/GETVERSION    (working copy)
> > @@ -24,6 +24,7 @@
> >      y1=6
> >      svn_rev=unknown
> >    fi
> > +  all_numeric_svn_rev=`echo ${svn_rev}|sed -e 's/[MS]*$//' -e 's/^.*://' -e
> > 's/[^0-9]//g' -e 's/^$/0/'`
> >    echo "/* Rversion.h.  Generated automatically. */"
> >    echo "#ifndef R_VERSION_H"
> >    echo "#define R_VERSION_H"
> > @@ -43,7 +44,7 @@
> >    echo "#define R_SVN_REVISION \"${svn_rev}\""
> >  ## Using 1-digit year stops problems with leading zeros
> >  #  echo "#define R_FILEVERSION    ${maj},${pl}${sl},${y1}${m}${d},0"
> > -  echo "#define R_FILEVERSION    ${maj},${pl}${sl},${svn_rev},0"
> > +  echo "#define R_FILEVERSION    ${maj},${pl}${sl},${all_numeric_svn_rev},0"
> >    echo
> >    echo '#ifdef __cplusplus'
> >    echo '}'
> >
> > ______________________________________________
> > R-devel at r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-devel
>
>

----------------------------------------------------------------------------
Bill Dunlap
Insightful Corporation
bill at insightful dot com
360-428-8146

 "All statements in this message represent the opinions of the author and do
 not necessarily reflect Insightful Corporation policy or position."



More information about the R-devel mailing list