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: Thu, 2 Jun 2011 21:36:02 +0200	[thread overview]
Message-ID: <BANLkTimg4xQsi6N5pY8DCrC9ufnq3=B_jQ@mail.gmail.com> (raw)
In-Reply-To: <BANLkTi=QfRwsDJjBWzcyuEsi91Zdu3Pseg@mail.gmail.com>

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

The patch is ready and attached.

Michael

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-Use-git-describe-in-version-of-info-file-with-make-i.patch --]
[-- Type: application/octet-stream, Size: 5182 bytes --]

From cc5e0cdac8a9c50e8fc7eca6a9cb83eea52ef091 Mon Sep 17 00:00:00 2001
From: Michael Brand <michael.ch.brand@gmail.com>
Date: Thu, 2 Jun 2011 21:32:09 +0200
Subject: [PATCH] Use git describe in version of info file with make info_git_describe

* Makefile (info_git_describe): 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.
* UTILITIES/set-version.pl (org-texi):
New option "--org.texi [<optional_file>]".
* org.el (org-version): Consistent with "git describe".

The new Makefile target info_git_describe builds doc/org like the
target "info" but reflects the output of the command "git describe" in
the version, similar to the Org mode function org-version.
---
 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 239ab2e..15b408d 100644
--- a/Makefile
+++ b/Makefile
@@ -281,6 +281,16 @@ html_guide: doc/orgguide.texi
 
 info:	doc/org
 
+# The following target builds doc/org like the target "info" but
+# reflects the output of the command "git describe" in the version,
+# similar to the Org mode function org-version
+info_git_describe: TAG=$(shell git describe --abbrev=4 HEAD)$(shell \
+	test "`git diff-index --name-only HEAD --`" && printf '.dirty')
+info_git_describe: 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
@@ -316,7 +326,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
 
@@ -344,7 +354,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
 
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 1ca03f4..6c20705 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -214,7 +214,6 @@ With prefix arg HERE, insert it at point."
 	      (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-06-02 19:36 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 [this message]
2011-10-16 19:12       ` Michael Brand
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='BANLkTimg4xQsi6N5pY8DCrC9ufnq3=B_jQ@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).