From 148ddbe2b2bdc45d4e53312669dab207d51d9fd8 Mon Sep 17 00:00:00 2001 From: Michael Brand 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 []". * 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 []" +# (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