unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* -DVERSION for emacsclient
@ 2006-11-23  2:02 Juanma Barranquero
  2006-11-23  4:27 ` Eli Zaretskii
  0 siblings, 1 reply; 15+ messages in thread
From: Juanma Barranquero @ 2006-11-23  2:02 UTC (permalink / raw)


emacsclient.c includes

 #ifndef VERSION
 #define VERSION "unspecified"
 #endif

and, on non-Windows environments, it is compiled with -DVERSION="\"${version}\""

Is there any portable way to extract the version number from
lisp/version.el when executing lib-src/makefile (or when running
nt/configure.bat)?

The other option is hardcoding the version number in configure.bat or
lib-src/Makefile.w32-in, as it is hardcoded now on nt/emacs.rc. But
then admin/admin.el should have to be modified, shouldn't it?

                    /L/e/k/t/u

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: -DVERSION for emacsclient
  2006-11-23  2:02 -DVERSION for emacsclient Juanma Barranquero
@ 2006-11-23  4:27 ` Eli Zaretskii
  2006-11-23  4:46   ` Lennart Borgman
                     ` (3 more replies)
  0 siblings, 4 replies; 15+ messages in thread
From: Eli Zaretskii @ 2006-11-23  4:27 UTC (permalink / raw)
  Cc: emacs-devel

> Date: Thu, 23 Nov 2006 03:02:38 +0100
> From: "Juanma Barranquero" <lekktu@gmail.com>
> 
> Is there any portable way to extract the version number from
> lisp/version.el when executing lib-src/makefile (or when running
> nt/configure.bat)?

You mean more portable than this:

  sed -n -e '/(defconst emacs-version/ s/^[^"]*\("[^"]*"\).*/\1/p' version.el

?

> The other option is hardcoding the version number in configure.bat or
> lib-src/Makefile.w32-in, as it is hardcoded now on nt/emacs.rc. But
> then admin/admin.el should have to be modified, shouldn't it?

We could require Sed for the Windows build, and then do the above
(just replace single quotes with double quotes and escape-protect the
inner double quotes).  Or we could craft an equivalent command using
native Windows tools.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: -DVERSION for emacsclient
  2006-11-23  4:27 ` Eli Zaretskii
@ 2006-11-23  4:46   ` Lennart Borgman
  2006-11-24 18:20     ` Eli Zaretskii
  2006-11-23  9:17   ` Juanma Barranquero
                     ` (2 subsequent siblings)
  3 siblings, 1 reply; 15+ messages in thread
From: Lennart Borgman @ 2006-11-23  4:46 UTC (permalink / raw)
  Cc: Juanma Barranquero, emacs-devel

Eli Zaretskii wrote:

> We could require Sed for the Windows build, and then do the above
> (just replace single quotes with double quotes and escape-protect the
> inner double quotes).  Or we could craft an equivalent command using
> native Windows tools.


Gnuwin32 contains sed. I do not see much problem requiring it.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: -DVERSION for emacsclient
  2006-11-23  4:27 ` Eli Zaretskii
  2006-11-23  4:46   ` Lennart Borgman
@ 2006-11-23  9:17   ` Juanma Barranquero
  2006-11-24 17:10   ` Benjamin Riefenstahl
  2006-11-24 18:21   ` Eli Zaretskii
  3 siblings, 0 replies; 15+ messages in thread
From: Juanma Barranquero @ 2006-11-23  9:17 UTC (permalink / raw)
  Cc: emacs-devel

On 11/23/06, Eli Zaretskii <eliz@gnu.org> wrote:

> You mean more portable than this:

No, that's about portable enough :-)

> We could require Sed for the Windows build, and then do the above
> (just replace single quotes with double quotes and escape-protect the
> inner double quotes).

I don't really care much one way or the other, but it seems a bit
heavy-handed to require sed just to extract a version number for an
auxiliary tool like emacsclient.

> Or we could craft an equivalent command using
> native Windows tools.

That's what I was originally hoping for. Not very easy to do portably
all the way up from W95/98/98SE/Me, assuming we're still buildable on
these systems.

                    /L/e/k/t/u

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: -DVERSION for emacsclient
  2006-11-23  4:27 ` Eli Zaretskii
  2006-11-23  4:46   ` Lennart Borgman
  2006-11-23  9:17   ` Juanma Barranquero
@ 2006-11-24 17:10   ` Benjamin Riefenstahl
  2006-11-24 18:21   ` Eli Zaretskii
  3 siblings, 0 replies; 15+ messages in thread
From: Benjamin Riefenstahl @ 2006-11-24 17:10 UTC (permalink / raw)
  Cc: Juanma Barranquero, emacs-devel

Hi Eli,


Eli Zaretskii writes:
> You mean more portable than this:
>
>   sed -n -e '/(defconst emacs-version/ s/^[^"]*\("[^"]*"\).*/\1/p' version.el

Wouldn't it be possible to make emacsclient depend on the Emacs binary
(if it isn't already) and use an Elisp script and "emacs -batch" to
put the value of emacs-version into emacsclient.c?

As an alternative, if you don't want to make that a strong dependency,
test if the Emacs binary is present and only call the Elisp script in
the common case that it has been made.


Just a thought,
benny

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: -DVERSION for emacsclient
  2006-11-23  4:46   ` Lennart Borgman
@ 2006-11-24 18:20     ` Eli Zaretskii
  0 siblings, 0 replies; 15+ messages in thread
From: Eli Zaretskii @ 2006-11-24 18:20 UTC (permalink / raw)
  Cc: lekktu, emacs-devel

> Date: Thu, 23 Nov 2006 05:46:44 +0100
> From: Lennart Borgman <lennart.borgman.073@student.lu.se>
> CC: Juanma Barranquero <lekktu@gmail.com>,  emacs-devel@gnu.org
> 
> Gnuwin32 contains sed. I do not see much problem requiring it.

Well, it's buggy, for starters (errors out on some pretty innocent
regular expressions).  But beyond that, each additional program that
is not found on Windows by default is a potential nuisance, IMHO.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: -DVERSION for emacsclient
  2006-11-23  4:27 ` Eli Zaretskii
                     ` (2 preceding siblings ...)
  2006-11-24 17:10   ` Benjamin Riefenstahl
@ 2006-11-24 18:21   ` Eli Zaretskii
  2006-11-24 19:28     ` Juanma Barranquero
  3 siblings, 1 reply; 15+ messages in thread
From: Eli Zaretskii @ 2006-11-24 18:21 UTC (permalink / raw)


> Date: Thu, 23 Nov 2006 06:27:44 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: emacs-devel@gnu.org
> 
> We could require Sed for the Windows build, and then do the above
> (just replace single quotes with double quotes and escape-protect the
> inner double quotes).  Or we could craft an equivalent command using
> native Windows tools.

There's one other option: write a short C program that will run during
the build and extract the version string from version.el, and supply
that program as part of the Emacs distribution (in the nt/
subdirectory).

On balance, I think this is the best alternative.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: -DVERSION for emacsclient
  2006-11-24 18:21   ` Eli Zaretskii
@ 2006-11-24 19:28     ` Juanma Barranquero
  2006-11-24 21:13       ` Eli Zaretskii
  0 siblings, 1 reply; 15+ messages in thread
From: Juanma Barranquero @ 2006-11-24 19:28 UTC (permalink / raw)
  Cc: emacs-devel

On 11/24/06, Eli Zaretskii <eliz@gnu.org> wrote:

> There's one other option: write a short C program that will run during
> the build and extract the version string from version.el, and supply
> that program as part of the Emacs distribution (in the nt/
> subdirectory).
>
> On balance, I think this is the best alternative.

That's trivial to do, but I don't understand why you don't favor just
hardcoding the version into nt/configure.bat or
lib-src/Makefile.w32-in and modifying admin/admin.el to update it...

That's what we currently do with nt/emacs.rc, man/emacs.texi,
lispref/elisp.texi and other files. And the rationale is the same:
for each given release it is a constant, it won't change during
compilation. There's no much point in building a program just to set
that constant.

                    /L/e/k/t/u

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: -DVERSION for emacsclient
  2006-11-24 19:28     ` Juanma Barranquero
@ 2006-11-24 21:13       ` Eli Zaretskii
  2006-11-24 23:55         ` Juanma Barranquero
  0 siblings, 1 reply; 15+ messages in thread
From: Eli Zaretskii @ 2006-11-24 21:13 UTC (permalink / raw)
  Cc: emacs-devel

> Date: Fri, 24 Nov 2006 20:28:35 +0100
> From: "Juanma Barranquero" <lekktu@gmail.com>
> Cc: emacs-devel@gnu.org
> 
> > There's one other option: write a short C program that will run during
> > the build and extract the version string from version.el, and supply
> > that program as part of the Emacs distribution (in the nt/
> > subdirectory).
> >
> > On balance, I think this is the best alternative.
> 
> That's trivial to do, but I don't understand why you don't favor just
> hardcoding the version into nt/configure.bat or
> lib-src/Makefile.w32-in and modifying admin/admin.el to update it...

Because someone needs to remember to update the hardcoded string each
time a new version is released.  Having that in admin.el is only a
band-aid, since someone needs to remember to run it prior to a
release.  That's a maintenance burden that we should avoid, I think.

However, given the amount of files we already handle in admin.el,
perhaps adding lib-src/makefile.w32-in to the list isn't a big deal.
Although I'd prefer that all those files except version.el were
handled like we do with -DVERSION in lib-src/Makefile.in.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: -DVERSION for emacsclient
  2006-11-24 21:13       ` Eli Zaretskii
@ 2006-11-24 23:55         ` Juanma Barranquero
  2006-11-25 10:32           ` Eli Zaretskii
  0 siblings, 1 reply; 15+ messages in thread
From: Juanma Barranquero @ 2006-11-24 23:55 UTC (permalink / raw)
  Cc: emacs-devel

On 11/24/06, Eli Zaretskii <eliz@gnu.org> wrote:

> Because someone needs to remember to update the hardcoded string each
> time a new version is released.

Someone needs to remember pushing up the version anyway.

> Having that in admin.el is only a
> band-aid, since someone needs to remember to run it prior to a
> release.  That's a maintenance burden that we should avoid, I think.

Releasing a version inevitably requires certain amount of
administrative steps, and running admin.el seems like the less of it.
All depends, I suppose, on whether the steps to be followed by the
release manager are documented.

> However, given the amount of files we already handle in admin.el,
> perhaps adding lib-src/makefile.w32-in to the list isn't a big deal.
> Although I'd prefer that all those files except version.el were
> handled like we do with -DVERSION in lib-src/Makefile.in.

I propose the following little patch, that uses the admin.el route and
is minimally disruptive. After the release we can change this to use
the method you suggest.

                    /L/e/k/t/u


Index: admin/admin.el
===================================================================
RCS file: /cvsroot/emacs/emacs/admin/admin.el,v
retrieving revision 1.10
diff -u -2 -r1.10 admin.el
--- admin/admin.el	15 Oct 2006 04:19:36 -0000	1.10
+++ admin/admin.el	24 Nov 2006 23:45:35 -0000
@@ -89,4 +89,7 @@
  		       (rx (and "EMACSVER" (1+ space)
  				(submatch (1+ (in "0-9."))))))
+  (set-version-in-file root "lib-src/makefile.w32-in" version
+		       (rx (and "VERSION" (0+ space) "=" (0+ space)
+				(submatch (1+ (in "0-9."))))))
   ;; nt/emacs.rc also contains the version number, but in an awkward
   ;; format. It must contain four components, separated by commas, and
Index: lib-src/makefile.w32-in
===================================================================
RCS file: /cvsroot/emacs/emacs/lib-src/makefile.w32-in,v
retrieving revision 2.50
diff -u -2 -r2.50 makefile.w32-in
--- lib-src/makefile.w32-in	13 Nov 2006 11:07:47 -0000	2.50
+++ lib-src/makefile.w32-in	24 Nov 2006 23:47:02 -0000
@@ -25,4 +25,6 @@
 .PHONY: $(ALL)

+VERSION =	22.0.91
+
  LOCAL_FLAGS	= -DWINDOWSNT -DDOS_NT -DSTDC_HEADERS=1 -DNO_LDAV=1 \
  		  -DNO_ARCHIVES=1 -DHAVE_CONFIG_H=1 -I../nt/inc \
@@ -69,5 +71,5 @@
  		$(LINK) $(LINK_OUT)$@ $(LINK_FLAGS) $(MOVEMAILOBJS) $(WSOCK32) $(LIBS)

-ECLIENT_CFLAGS = -DHAVE_GETCWD -DHAVE_STRERROR
+ECLIENT_CFLAGS = -DHAVE_GETCWD -DHAVE_STRERROR -DVERSION="\"$(VERSION)\""
  ECLIENTOBJS =	$(BLD)/emacsclient.$(O) \
  		$(BLD)/getopt.$(O) \

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: -DVERSION for emacsclient
  2006-11-24 23:55         ` Juanma Barranquero
@ 2006-11-25 10:32           ` Eli Zaretskii
  2006-11-25 13:01             ` Juanma Barranquero
  0 siblings, 1 reply; 15+ messages in thread
From: Eli Zaretskii @ 2006-11-25 10:32 UTC (permalink / raw)
  Cc: emacs-devel

> Date: Sat, 25 Nov 2006 00:55:36 +0100
> From: "Juanma Barranquero" <lekktu@gmail.com>
> Cc: emacs-devel@gnu.org
> 
> On 11/24/06, Eli Zaretskii <eliz@gnu.org> wrote:
> 
> > Because someone needs to remember to update the hardcoded string each
> > time a new version is released.
> 
> Someone needs to remember pushing up the version anyway.

There's a difference between changing one file and changing half dozen
of them.

> Releasing a version inevitably requires certain amount of
> administrative steps, and running admin.el seems like the less of it.

Are we at least in agreement that, in principle, anything that's done
automatically as part of preparing a release is better than the need
to do that manually?  Or are you saying that manual steps are not a
burden in any way?

> I propose the following little patch, that uses the admin.el route and
> is minimally disruptive.

Thanks.  This is okay with me, but I'd prefer that the default value
of VERSION in lib-src/makefile.w32-in be UNKNOWN.  That way, if we
ever forget to run admin.el, we get the result shouting right in our
face.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: -DVERSION for emacsclient
  2006-11-25 10:32           ` Eli Zaretskii
@ 2006-11-25 13:01             ` Juanma Barranquero
  2006-11-25 13:14               ` Eli Zaretskii
  0 siblings, 1 reply; 15+ messages in thread
From: Juanma Barranquero @ 2006-11-25 13:01 UTC (permalink / raw)
  Cc: emacs-devel

On 11/25/06, Eli Zaretskii <eliz@gnu.org> wrote:

> There's a difference between changing one file and changing half dozen
> of them.

Sure. But, as it stands now, the release manager does not change any
file. Even lisp/version.el is updated from admin/admin.el.

> Are we at least in agreement that, in principle, anything that's done
> automatically as part of preparing a release is better than the need
> to do that manually?

Of course. :)

> Or are you saying that manual steps are not a
> burden in any way?

No, I'm not saying that.

> Thanks.  This is okay with me, but I'd prefer that the default value
> of VERSION in lib-src/makefile.w32-in be UNKNOWN.  That way, if we
> ever forget to run admin.el, we get the result shouting right in our
> face.

But VERSION is going to be UNKNOWN just the first time. Once the
release manager runs admin.el the first time (for example, when
releasing the 22.0.92 pretest), VERSION will have forever a version
string...

I can change the regexp to

  (rx (and "VERSION" (0+ space) "=" (0+ space)
           (submatch (or "UNKNOWN" (1+ (in "0-9."))))))

but it's a bit of complexity added for one time's sake.

                    /L/e/k/t/u

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: -DVERSION for emacsclient
  2006-11-25 13:01             ` Juanma Barranquero
@ 2006-11-25 13:14               ` Eli Zaretskii
  2006-11-25 13:25                 ` Juanma Barranquero
  0 siblings, 1 reply; 15+ messages in thread
From: Eli Zaretskii @ 2006-11-25 13:14 UTC (permalink / raw)
  Cc: emacs-devel

> Date: Sat, 25 Nov 2006 14:01:40 +0100
> From: "Juanma Barranquero" <lekktu@gmail.com>
> Cc: emacs-devel@gnu.org
> 
> But VERSION is going to be UNKNOWN just the first time. Once the
> release manager runs admin.el the first time (for example, when
> releasing the 22.0.92 pretest), VERSION will have forever a version
> string...

Do you mean the modified makefile.w32-in are intended to be checked
into CVS?

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: -DVERSION for emacsclient
  2006-11-25 13:14               ` Eli Zaretskii
@ 2006-11-25 13:25                 ` Juanma Barranquero
  2006-11-25 14:01                   ` Eli Zaretskii
  0 siblings, 1 reply; 15+ messages in thread
From: Juanma Barranquero @ 2006-11-25 13:25 UTC (permalink / raw)
  Cc: emacs-devel

On 11/25/06, Eli Zaretskii <eliz@gnu.org> wrote:

> Do you mean the modified makefile.w32-in are intended to be checked
> into CVS?

Yes. How is that different from nt/emacs.rc or man/emacs.texi, which
are checked into CVS with the current version number?

                    /L/e/k/t/u

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: -DVERSION for emacsclient
  2006-11-25 13:25                 ` Juanma Barranquero
@ 2006-11-25 14:01                   ` Eli Zaretskii
  0 siblings, 0 replies; 15+ messages in thread
From: Eli Zaretskii @ 2006-11-25 14:01 UTC (permalink / raw)
  Cc: emacs-devel

> Date: Sat, 25 Nov 2006 14:25:57 +0100
> From: "Juanma Barranquero" <lekktu@gmail.com>
> Cc: emacs-devel@gnu.org
> 
> On 11/25/06, Eli Zaretskii <eliz@gnu.org> wrote:
> 
> > Do you mean the modified makefile.w32-in are intended to be checked
> > into CVS?
> 
> Yes.

Then it really doesn't matter what you put there, but please run
admin.el on it to produce the version string before you commit.

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2006-11-25 14:01 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-23  2:02 -DVERSION for emacsclient Juanma Barranquero
2006-11-23  4:27 ` Eli Zaretskii
2006-11-23  4:46   ` Lennart Borgman
2006-11-24 18:20     ` Eli Zaretskii
2006-11-23  9:17   ` Juanma Barranquero
2006-11-24 17:10   ` Benjamin Riefenstahl
2006-11-24 18:21   ` Eli Zaretskii
2006-11-24 19:28     ` Juanma Barranquero
2006-11-24 21:13       ` Eli Zaretskii
2006-11-24 23:55         ` Juanma Barranquero
2006-11-25 10:32           ` Eli Zaretskii
2006-11-25 13:01             ` Juanma Barranquero
2006-11-25 13:14               ` Eli Zaretskii
2006-11-25 13:25                 ` Juanma Barranquero
2006-11-25 14:01                   ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).