emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Michael Brand <michael.ch.brand@gmail.com>
To: Org Mode <emacs-orgmode@gnu.org>
Cc: Bernt Hansen <bernt@norang.ca>
Subject: Re: "git describe" in version of info file with "make info_git_describe"
Date: Sun, 16 Oct 2011 21:12:48 +0200	[thread overview]
Message-ID: <CALn3zog1LXMCY5nBu9vZy_3DyrEY4B5Gh3auW0A2yAiTqU=HxQ@mail.gmail.com> (raw)
In-Reply-To: <BANLkTimg4xQsi6N5pY8DCrC9ufnq3=B_jQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 869 bytes --]

Hi all

I made a new patch replacing the previous, now considering the
Makefile targets "target" and "help" introduced meanwhile by Achim
Gratz and with a shorter name "info-vg" for the new target for easier
typing of the make command.

The previous patch attachment had a wrong mime type, could therefore
not be caught by patchwork and has not been accepted.

Michael

On Thu, Jun 2, 2011 at 21:36, Michael Brand <michael.ch.brand@gmail.com> wrote:
> The patch is ready and attached.
>
> On Thu, Jun 2, 2011 at 17:05, Michael Brand <michael.ch.brand@gmail.com> wrote:
> [...]
>> Since I would like to give the more often used "git describe"
>> precedence I will make org-version and "make info_git_describe"
>> consistent with git. The ".dirty" postfix of org-version I will leave
>> untouched in org-version of course and support also in "make
>> info_git_describe".

[-- Attachment #2: 0001-Makefile-info-vg-set-info-version-to-git-describe.patch.txt --]
[-- Type: text/plain, Size: 5459 bytes --]

From 148ddbe2b2bdc45d4e53312669dab207d51d9fd8 Mon Sep 17 00:00:00 2001
From: Michael Brand <michael.ch.brand@gmail.com>
Date: Sun, 16 Oct 2011 21:06:35 +0200
Subject: [PATCH] Makefile info-vg: set info version to git describe

* Makefile (info-vg): New target.
(release): Remove "-a" that has become idle already before from
command "UTILITIES/set-version.pl".
(fixrelease): Remove command "UTILITIES/set-version.pl -o $(TAG)" that
has become idle already before.
(targets help): Include new target info-vg.
* UTILITIES/set-version.pl (org-texi):
New option "--org.texi [<optional_file>]".
* org.el (org-version): Output format consistent with "git describe".

The new Makefile target info-vg builds the info file doc/org like the
target "info" but sets the info version to the output of the command
"git describe".
---
 Makefile                 |   13 +++++++++++--
 UTILITIES/set-version.pl |   35 +++++++++++++++++++++++++----------
 lisp/org.el              |    1 -
 3 files changed, 36 insertions(+), 13 deletions(-)

diff --git a/Makefile b/Makefile
index 8b9aa4d..30bc578 100644
--- a/Makefile
+++ b/Makefile
@@ -280,6 +280,15 @@ html_guide: doc/orgguide.texi
 
 info:	doc/org
 
+# The following target builds the info file doc/org like the target "info"
+# but sets the info version to the output of the command "git describe"
+info-vg: TAG=$(shell git describe --abbrev=4 HEAD)$(shell \
+	test "`git diff-index --name-only HEAD --`" && printf '.dirty')
+info-vg: doc/org.texi
+	cp doc/org.texi /tmp
+	UTILITIES/set-version.pl '$(TAG)' --org.texi /tmp/org.texi
+	$(MAKEINFO) --no-split /tmp/org.texi -o doc/org
+
 pdf:	doc/org.pdf doc/orgguide.pdf
 
 card:	doc/orgcard.pdf doc/orgcard_letter.pdf doc/orgcard.txt
@@ -315,7 +324,7 @@ release:
 	git push -f origin maint
 	git checkout master
 	git merge -s ours maint
-	UTILITIES/set-version.pl -a $(TAG)
+	UTILITIES/set-version.pl $(TAG)
 	git commit -a -m "Update website to show $(TAG) as current release"
 	git push
 
@@ -343,7 +352,6 @@ fixrelease:
 	git push -f origin maint
 	git checkout master
 	git merge -s ours maint
-	UTILITIES/set-version.pl -o $(TAG)
 	git commit -a -m "Update website to show $(TAG) as current release"
 	git push
 
@@ -521,6 +529,7 @@ targets help:
 	@echo ""
 	@echo "make doc - make all documentation"
 	@echo "make info - make Info documentation"
+	@echo "make info-vg - make Info doc, set info version to git describe"
 	@echo "make html - make HTML documentation"
 	@echo "make pdf - make pdf documentation"
 	@echo "make card - make refcards documentation"
diff --git a/UTILITIES/set-version.pl b/UTILITIES/set-version.pl
index ed185ea..47d439b 100755
--- a/UTILITIES/set-version.pl
+++ b/UTILITIES/set-version.pl
@@ -1,43 +1,58 @@
 #!/usr/bin/perl
 $version = $ARGV[0];
-if ($version eq "--all" or $version eq "-a") {
+
+# if no further option is present then default to "all"
+if (not $ARGV[1]) {
   $all = 1;
-  $version = $ARGV[1]
 }
 
-if ($version eq "--only" or $version eq "-o") {
-  $only = 1;
-  $version = $ARGV[1]
+# parse option "--org.texi [<optional_file>]"
+# (only simple parsing since no more than one option supported yet)
+if ($ARGV[1] eq "--org.texi") {
+  $org_texi_opt = 1;
+  if ($ARGV[2]) {
+    $org_texi_file = "$ARGV[2]";
+  }
 }
 
 die "No version given" unless $version=~/\S/;
 $date = `date "+%B %Y"`; chomp $date;
 $year = `date "+%Y"` ; chomp $year;
 
-print STDERR "Changing version to \"$version\" and date to \"$date\" in all relevant files\n" ;
-
-if (not $only) {
+print STDERR "Changing version to \"$version\" and date to \"$date\" in the following files:\n" ;
 
+if ($all) {
   print STDERR join("\n",glob("lisp/*.el")),"\n";
   $cmd = qq{s/^(;; Version:)\\s+(\\S+)[ \t]*\$/\$1 $version/;s/^(\\(defconst org-version )"(\\S+)"/\$1"$version"/};
   $c1 = "perl -pi -e '$cmd' lisp/*.el";
   system($c1);
+}
 
-  print STDERR "doc/org.texi\n";
+if ($all or $org_texi_opt) {
+  if (not "$org_texi_file") {
+    $org_texi_file = "doc/org.texi";
+  }
+  print STDERR "$org_texi_file\n";
   $cmd = qq{s/^(\\\@set VERSION)\\s+(\\S+)[ \t]*\$/\$1 $version/;s/^(\\\@set DATE)\\s+(.*)\$/\$1 $date/;};
-  $c1 = "perl -pi -e '$cmd' doc/org.texi";
+  $c1 = "perl -pi -e '$cmd' '$org_texi_file'";
   system($c1);
+}
 
+if ($all) {
   print STDERR "doc/orgguide.texi\n";
   $cmd = qq{s/^(\\\@set VERSION)\\s+(\\S+)[ \t]*\$/\$1 $version/;s/^(\\\@set DATE)\\s+(.*)\$/\$1 $date/;};
   $c1 = "perl -pi -e '$cmd' doc/orgguide.texi";
   system($c1);
+}
 
+if ($all) {
   print STDERR "doc/orgcard.tex\n";
   $cmd = qq{s/^\\\\def\\\\orgversionnumber\\{\\S+\\}/\\\\def\\\\orgversionnumber{$version}/;s/\\\\def\\\\versionyear\\{\\S+\\}/\\\\def\\\\versionyear{$year}/;s/\\\\def\\\\year\\{\\S+\\}/\\\\def\\\\year{$year}/;};
   $c1 = "perl -pi -e '$cmd' doc/orgcard.tex";
   system($c1);
+}
 
+if ($all) {
   print STDERR "README_DIST\n";
   $cmd = qq{s/^(The version of this release is:)\\s+(\\S+)[ \t]*\$/\$1 $version/;};
   $c1 = "perl -pi -e '$cmd' README_DIST";
diff --git a/lisp/org.el b/lisp/org.el
index 6aba1a2..27c2f2c 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -221,7 +221,6 @@ (defun org-version (&optional here)
 	      (with-current-buffer "*Shell Command Output*"
 		(goto-char (point-min))
 		(setq git-version (buffer-substring (point) (point-at-eol))))
-	      (subst-char-in-string ?- ?. git-version t)
 	      (when (string-match "\\S-"
 				  (shell-command-to-string
 				   "git diff-index --name-only HEAD --"))
-- 
1.7.4.2


  reply	other threads:[~2011-10-16 19:12 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-02 14:11 "git describe" in version of info file with "make info_git_describe" Michael Brand
2011-06-02 14:47 ` Bernt Hansen
2011-06-02 15:05   ` Michael Brand
2011-06-02 19:36     ` Michael Brand
2011-10-16 19:12       ` Michael Brand [this message]
2011-10-21 14:44         ` Carsten Dominik
2011-10-21 16:13           ` Bernt Hansen
2011-10-23 22:50             ` Bernt Hansen
2011-10-26 16:07           ` Michael Brand
2011-10-26 16:56             ` Achim Gratz
2011-10-27 18:24               ` Michael Brand
2011-10-28  9:26                 ` Achim Gratz
2011-10-29 11:40                   ` Michael Brand
2011-10-30  7:01                     ` Achim Gratz
2011-10-30 14:20                       ` Michael Brand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CALn3zog1LXMCY5nBu9vZy_3DyrEY4B5Gh3auW0A2yAiTqU=HxQ@mail.gmail.com' \
    --to=michael.ch.brand@gmail.com \
    --cc=bernt@norang.ca \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.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).