nano-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nano-devel] [patch] letting autoconf brand a build from SVN


From: Eitan Adler
Subject: Re: [Nano-devel] [patch] letting autoconf brand a build from SVN
Date: Tue, 7 Apr 2015 11:35:47 -0400

On 3 April 2015 at 07:02, Benno Schulenberg <address@hidden> wrote:
>
> Hi all,
>
> Now that the compile time has disappeared from the version string,
> it would be nice if there were some other and better way to identify
> a build from SVN.  The patch below achieves this for me, but surely
> there are things wrong with it.  Mike, Kamil, Eitan, Jordi?  Is this
> portable enough?  And what can be improved?

Overall this is a good idea.  I did not yet test the patch (my
development computer has some issues).  It would be nice to support
git-svn in addition to pure svn.

> Benno
>
> Index: src/nano.h
> ===================================================================
> --- src/nano.h  (revision 5172)
> +++ src/nano.h  (working copy)
> @@ -600,4 +600,10 @@
>  /* The maximum number of bytes buffered at one time. */
>  #define MAX_BUF_SIZE 128
>
> +#ifdef REVISION
> +#define BRANDING "nano SVN "REVISION
> +#else
> +#define BRANDING PACKAGE_STRING
> +#endif
> +
>  #endif /* !NANO_H */
> Index: src/winio.c
> ===================================================================
> --- src/winio.c (revision 5172)
> +++ src/winio.c (working copy)
> @@ -2125,8 +2125,7 @@
>      if (space >= 4) {
>         /* Add a space after the version message, and account for both
>          * it and the two spaces before it. */
> -       mvwaddnstr(topwin, 0, 2, PACKAGE_STRING,
> -               actual_x(PACKAGE_STRING, verlen));
> +       mvwaddnstr(topwin, 0, 2, BRANDING, actual_x(BRANDING, verlen));

I don't believe there is enough context here, but is verlen correct?


> +#ifdef REVISION
> +    printf(" GNU nano, from %s, SVN revision %s\n", VERSION, REVISION);
> +#else
>      printf(_(" GNU nano, version %s\n"), VERSION);
> +#endif

This is fine


> +AC_MSG_CHECKING([whether building from SVN])
> +if test -d .svn ; then

^this will only work if the cwd contains .svn.  I am uncertain if
configure attempts to change directory to the repo root at start.
I am concerned that something like

nano/configure or ../configure will miss this check.

> +    AC_MSG_RESULT([yes])
> +    AC_PATH_PROG([SVNVERSION], [svnversion])
> +    REVISION=`($SVNVERSION >/dev/null 2>&1) && ($SVNVERSION -n)`
> +    AC_SUBST(REVISION)
> +    AC_DEFINE_UNQUOTED([REVISION],"${REVISION}","Setting REVISION in 
> config.h.")
> +else
> +    AC_MSG_RESULT([no])
> +fi
>




-- 
Eitan Adler



reply via email to

[Prev in Thread] Current Thread [Next in Thread]