summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGuido Guenther <agx@sigxcpu.org>2007-10-19 09:22:17 +0200
committerGuido Guenther <agx@sigxcpu.org>2007-10-19 09:22:17 +0200
commit53d0b13794018f88dcd2df017667e173bb333abf (patch)
treeeae05ca7a450536da845d8403c67630233684cea
parent44a34275141b0646cadfdac38f4c34bbaed1b68e (diff)
add version number to docs and a tools
-rwxr-xr-xdebian/rules14
-rw-r--r--docs/common.ent1
-rw-r--r--docs/manual.sgml7
-rw-r--r--gbp/config.py3
-rwxr-xr-xgit-buildpackage12
5 files changed, 25 insertions, 12 deletions
diff --git a/debian/rules b/debian/rules
index 1dc87692..80b8218e 100755
--- a/debian/rules
+++ b/debian/rules
@@ -12,10 +12,14 @@ MANPAGES=$(patsubst %,docs/%.1,$(COMMANDS))
MANUAL=docs/manual-html
PYCHECKS=$(patsubst %,%.py,$(COMMANDS))
PYCHECK_LEVEL=Error
+GBP_VERSION=gbp/gbp_version.py
+VERSION_ENT=docs/version.ent
docs/%.1: docs/man.%.sgml
docbook2man -o docs/ $<
+docs/manual.sgml: docs/version.ent
+
$(MANUAL): docs/manual.sgml docs/chapters/*.sgml docs/manpages/*.sgml
docbook-2-html -s local $<
@@ -23,10 +27,16 @@ $(MANUAL): docs/manual.sgml docs/chapters/*.sgml docs/manpages/*.sgml
ln -s $< $@
PYTHONPATH=. pychecker -e $(PYCHECK_LEVEL) -q $<
-build/git-buildpackage:: $(MANPAGES) $(MANUAL) $(PYCHECKS)
+$(GBP_VERSION): debian/changelog
+ echo 'gbp_version="$(DEB_VERSION)"' > $(GBP_VERSION)
+
+$(VERSION_ENT): debian/changelog
+ echo '<!ENTITY gbp-version "$(DEB_VERSION)">' > $(VERSION_ENT)
+
+build/git-buildpackage:: $(MANPAGES) $(MANUAL) $(GBP_VERSION) $(PYCHECKS)
clean::
-rm git-*.py
- -rm docs/*.1 docs/manpage.*
+ -rm docs/*.1 docs/manpage.* docs/$(VERSION_ENT)
-rm -r docs/manual-html/
diff --git a/docs/common.ent b/docs/common.ent
index 58e97303..28cd7d39 100644
--- a/docs/common.ent
+++ b/docs/common.ent
@@ -1,6 +1,5 @@
<!ENTITY dhfirstname "<firstname>Guido</firstname>">
<!ENTITY dhsurname "<surname>Guenther</surname>">
- <!ENTITY dhdate "<date>2006-10-02</date>">
<!ENTITY dhsection "<manvolnum>1</manvolnum>">
<!ENTITY dhemail "<email>agx@sigxcpu.org</email>">
<!ENTITY dhusername "Guido Guenther">
diff --git a/docs/manual.sgml b/docs/manual.sgml
index 6d188fdc..e72ebec5 100644
--- a/docs/manual.sgml
+++ b/docs/manual.sgml
@@ -1,6 +1,8 @@
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V4.1//EN" [
<!ENTITY % COMMON SYSTEM "common.ent">
%COMMON;
+ <!ENTITY % VERSION SYSTEM "version.ent">
+ %VERSION;
<!ENTITY % MANPAGES SYSTEM "manpages/manpages.ent">
%MANPAGES;
<!ENTITY % CHAPTERS SYSTEM "chapters/chapters.ent">
@@ -11,10 +13,9 @@
<book id="gbp">
<bookinfo>
<title>Building Debian Packages with git-buildpackage</title>
- <author>
- &dhfirstname; &dhsurname;
- </author>
+ <author>&dhfirstname; &dhsurname;</author>
<address>&dhemail;</address>
+ <subtitle>Version: &gbp-version;</subtitle>
</bookinfo>
&ch.intro;
diff --git a/gbp/config.py b/gbp/config.py
index 244ade5e..21d5f215 100644
--- a/gbp/config.py
+++ b/gbp/config.py
@@ -6,6 +6,7 @@
from optparse import OptionParser
from ConfigParser import SafeConfigParser
import os.path
+from gbp.gbp_version import gbp_version
class GbpOptionParser(OptionParser):
"""
@@ -55,7 +56,7 @@ class GbpOptionParser(OptionParser):
self.prefix = prefix
self.config = {}
self.__parse_config_files()
- OptionParser.__init__(self, usage=usage)
+ OptionParser.__init__(self, usage=usage, version='%s %s' % (self.command, gbp_version))
def add_config_file_option(self, option_name, dest, help, **kwargs):
"""
diff --git a/git-buildpackage b/git-buildpackage
index 2cd26343..ac18bb11 100755
--- a/git-buildpackage
+++ b/git-buildpackage
@@ -93,14 +93,16 @@ def main(argv):
changelog = 'debian/changelog'
default_tree = 'HEAD'
retval = 0
+ prefix = "git-"
- args = [ arg for arg in argv[1:] if arg.find('--git-') == 0 ]
- dpkg_args = [ arg for arg in argv[1:] if arg.find('--git-') == -1 ]
+ args = [ arg for arg in argv[1:] if arg.find('--%s' % prefix) == 0 ]
+ dpkg_args = [ arg for arg in argv[1:] if arg.find('--%s' % prefix) == -1 ]
- if "--help" in dpkg_args:
- args.append('--help')
+ for arg in [ "--help", "-h", "--version" ]:
+ if arg in dpkg_args:
+ args.append(arg)
- parser = GbpOptionParser(command=os.path.basename(argv[0]), prefix='git-')
+ parser = GbpOptionParser(command=os.path.basename(argv[0]), prefix=prefix)
parser.add_option("--git-ignore-new", action="store_true", dest="ignore_new", default=False,
help="build with uncommited changes in the source tree")