Re: [Rd] pointers on including SVN revision number in package info?

From: Dirk Eddelbuettel <edd_at_debian.org>
Date: Fri, 06 Jan 2012 16:59:17 -0600

On 6 January 2012 at 16:45, Duncan Murdoch wrote:
| I'd like one that produced an R version number directly, but I think
| Dirk's script is the only way to do it, and I forget how to use such
| scripts five minutes after I write them.

And I of course forgot to include the little script once written for littler; now below.

For Rcpp and RInside, I wrote little ad-hoc release helper scripts to also run doxygen, copy vignettes and tarballs to webfolders etc pp. If you do that, you have a hook -- but then you'd have to run this once pre-commit / build.

| R-forge sometimes gets out of sync in what it displays as the revision,
| the Version, and what it actually offers as the "Package source" (let
| alone binaries), so I find putting the revision into the version number
| very helpful. But I often forget to do it...

Scripts can help. Somewhat.

Dirk

PS The ad-hoc script 'bootstrap' from littler is below.

#!/bin/bash -e

call_svnversion() {

    svnrevision=`LC_ALL=C svn info | awk '/^Revision:/ {print $2}'`     svndate=`LC_ALL=C svn info | awk '/^Last Changed Date:/ {print $4,$5}'`

    now=`date`

    if [ "$svnrevision" != "" ]; then

	if [ "$svndate" != "" ]; then
	    cat <<EOF > svnversion.h

// Do not edit!  This file was autogenerated 
//      by $0 
//      on $now
//

// svnrevision and svndate are as reported by svn at that point in time, // compiledate and compiletime are being filled gcc at compilation

#include <stdlib.h>  

static const char* svnrevision = "$svnrevision";
static const char* svndate = "$svndate";
static const char* compiletime = __TIME__;
static const char* compiledate = __DATE__;

EOF
	fi

    fi
}

if [ "$#" -ge 0 ]; then

    if [ "$1" = "--svnversion" ]; then

        # added hoops: make sure we only call this when we have a 
	# svn binary in the path ... so that this does not get called
	# on machines that do not have svn
	set +e
	svnprog=`type -p svn`
	set -e
	if [ "${svnprog}" != "" ]; then
	    call_svnversion 
	fi
	exit

    fi
fi

test -f svnversion.h || call_svnversion
aclocal
autoheader
automake
autoconf
./configure
make

-- 
"Outside of a dog, a book is a man's best friend. Inside of a dog, it is too
dark to read." -- Groucho Marx

______________________________________________
R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Fri 06 Jan 2012 - 23:02:03 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 08 Jan 2012 - 20:10:08 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive