Infrastructure for tig rpm builds.
PATCH 1/1 Infrastructure for tig rpm builds.
Adds RPM_VERSION to Makefile and new make targets: tig.spec, dist, and rpm. A simple 'make rpm' will build the rpm. Also adds tig.spec.in which is used to generate tig.spec.
Accidentally VERSION (and adding -DVERSION=$(VERSION) to CFLAGS) is now defined always, even if we do not compile from the "live" tig repository.
Minimally tested (meaning "make rpm" from tig repository works).
---
'tig.spec.in' is based on 'git.spec.in' from git repository.
This is the initial, minimal version. For example it does not add TIG-VERSION-GEN file and the rest of versioning infrastructure that is used in git Makefile.
Commands used to get version string (in RPM_VERSION) suitable as a version field in the rpm can, most probably, be improved. Perhaps (with the new git-describe output) we should put closest version tag as version of tig in rpm, and distance from the tag (perhaps plus 1) as release number (in the rpm sense).
TODO: Change '--without docs' to '--with rebuild-docs' and use pre-generated docs when creating rpm, instead of generating them (and requiring asciidoc, xmlto and docbook2pdf to build rpm if we want tig documentation).
P.S. I have build tig-0.6.4.g9eded37-1.i386.rpm using "make rpm" from tig repository, and installed it without problems, but when trying to build it again _without network_ it failed on building manual.pdf. Error log attached.
asciidoc-7.1.2-2.fc3.rf
docbook-dtds-1.0-26
docbook-style-dsssl-1.79-1
docbook-style-xsl-1.68.1-1
docbook-utils-0.6.14-4
docbook-utils-pdf-0.6.14-4
jadetex-3.12-13
openjade-1.3.2-16
I think we can skip generation of manual.pdf, and generate it only on request (e.g. "make doc-pdf"), or using doc-man and doc-html in place of doc in the spec file... but this is better left for the next commit.
By the way, why do you use xmlto and docbook2pdf, instead of a2x from asciidoc package?
.gitignore | 2 ++ Makefile | 34 ++++++++++++++++++++++++++++++++-- tig.spec.in | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 90 insertions(+), 2 deletions(-) create mode 100644 tig.spec.in
.gitignore +2 -0
@@ -2,3 +2,5 @@ manual.html-chunked manual.pdf manual.toc tig +tig.spec +tig-*.tar.gz
Makefile +32 -2
@@ -18,8 +18,16 @@ DOCS = $(DOCS_MAN) $(DOCS_HTML) \ ifneq (,$(wildcard .git)) VERSION = $(shell git-describe) WTDIRTY = $(shell git-diff-index --name-only HEAD 2>/dev/null) -CFLAGS += '-DVERSION="$(VERSION)$(if $(WTDIRTY),-dirty)"' +else +GEN_VER="tig-0.6.TIG" +VERSION = $(shell test -f version && cat version || echo "$(GEN_VER)") endif +CFLAGS += '-DVERSION="$(VERSION)$(if $(WTDIRTY),-dirty)"' +RPM_VERSION = $(subst tig-,,$(VERSION)) +RPM_VERSION := $(subst -,.,$(RPM_VERSION)) + +TARNAME=tig-$(RPM_VERSION) + all: $(PROGS) all-debug: $(PROGS)
@@ -57,6 +65,9 @@ install-doc: install-doc-man install-doc-html clean: rm -rf manual.html-chunked rm -f $(PROGS) $(DOCS) core *.xml + rm -f *.spec + rm -rf $(TARNAME) + rm -f $(TARNAME).tar.gz spell-check: aspell --lang=en --check tig.1.txt tigrc.5.txt manual.txt
@@ -64,7 +75,7 @@ spell-check: strip: all strip $(PROGS) -.PHONY: all all-debug doc doc-man doc-html install install-doc install-doc-man install-doc-html clean spell-check +.PHONY: all all-debug doc doc-man doc-html install install-doc install-doc-man install-doc-html clean spell-check dist rpm manual.html: manual.toc manual.toc: manual.txt
@@ -119,3 +130,22 @@ sync-docs: make doc cg commit -m "Sync docs" cg switch master + +tig.spec: tig.spec.in + sed -e 's/@@VERSION@@/$(RPM_VERSION)/g' < $< > $@+ + mv $@+ $@ + +dist: tig.spec + git-archive --format=tar \ + --prefix=$(TARNAME)/ HEAD^{tree} > $(TARNAME).tar + @mkdir -p $(TARNAME) + @cp tig.spec $(TARNAME) + @echo $(VERSION) > $(TARNAME)/version + tar rf $(TARNAME).tar \ + $(TARNAME)/tig.spec \ + $(TARNAME)/version + @rm -rf $(TARNAME) + gzip -f -9 $(TARNAME).tar + +rpm: dist + rpmbuild -ta $(TARNAME).tar.gz
tig.spec.in new file +56 -0
56 lines not on this page · raw message
Signature · 1 line
1.5.2
docbook2pdf manual.xml
Using catalogs: /etc/sgml/xml-docbook-4.2-1.0-26.cat
Using stylesheet: /usr/share/sgml/docbook/utils-0.6.14/docbook-utils.dsl#print
Working on: /home/local/builddir/BUILD/tig-0.6.4.g9eded37/manual.xml jade:/home/local/builddir/BUILD/tig-0.6.4.g9eded37/manual.xml:2:118:E: could not resolve host "www.oasis-open.org" (try again later) jade:/home/local/builddir/BUILD/tig-0.6.4.g9eded37/manual.xml:2:118:E: DTD did not contain element declaration for document type name jade:/home/local/builddir/BUILD/tig-0.6.4.g9eded37/manual.xml:4:14:E: there is no attribute "lang" jade:/home/local/builddir/BUILD/tig-0.6.4.g9eded37/manual.xml:4:18:E: element "article" undefined
[...]
jade:/home/local/builddir/BUILD/tig-0.6.4.g9eded37/manual.xml:400:10:E: element "entry" undefined jade:/home/local/builddir/BUILD/tig-0.6.4.g9eded37/manual.xml:401:172:E: element "emphasis" undefined jade:/home/local/builddir/BUILD/tig-0.6.4.g9eded37/manual.xml:404:6:E: element "row" undefined
jade:I: maximum number of errors (200) reached; change with -E option
jade:/usr/share/sgml/docbook/dsssl-stylesheets-1.79/print/../common/dbtable.dsl:224:13:E: 2nd argument for primitive "ancestor" of wrong type: "#<unknown object 152549536>" not a singleton node list jade:/usr/share/sgml/docbook/dsssl-stylesheets-1.79/print/../common/dbtable.dsl:224:13:E: 2nd argument for primitive "ancestor" of wrong type: "#<unknown object 152549536>" not a singleton node list jade:/usr/share/sgml/docbook/dsssl-stylesheets-1.79/print/../common/dbtable.dsl:224:13:E: 2nd argument for primitive "ancestor" of wrong type: "#<unknown object 152549536>" not a singleton node list
[...]
jade:/usr/share/sgml/docbook/dsssl-stylesheets-1.79/print/../common/dbtable.dsl:224:13:E: 2nd argument for primitive "ancestor" of wrong type: "#<unknown object 152549536>" not a singleton node list jade:/usr/share/sgml/docbook/dsssl-stylesheets-1.79/print/../common/dbtable.dsl:224:13:E: 2nd argument for primitive "ancestor" of wrong type: "#<unknown object 152549536>" not a singleton node list make[1]: *** [manual.pdf] Błąd 8
rm manual.xml tigrc.5.xml tig.1.xml
make[1]: Leaving directory `/home/local/builddir/BUILD/tig-0.6.4.g9eded37'
Hej Jakub,
Jakub Narebski <[email protected]> wrote Mon, May 28, 2007:
Quoted 3 lines
Adds
RPM_VERSIONtoMakefileand new make targets: tig.spec, dist, and rpm. A simple 'make rpm' will build the rpm. Also adds tig.spec.in which is used to generate tig.spec.
Thank you. :)
Quoted 3 lines
Accidentally VERSION (and adding -DVERSION=$(VERSION) to CFLAGS) is now defined always, even if we do not compile from the "live" tig repository.
Yeah, this is probably a good idea; the same goes for moving version info to a file instead of having it in tig.c.
Quoted 1 line
Minimally tested (meaning "make rpm" from tig repository works).
Trying 'make rpm' on ubuntu 7.04 I get:
$ rpmbuild -ta tig-0.6.g2463b4e.tar.gz error: Name field must be present in package: (main package) error: Version field must be present in package: (main package) error: Release field must be present in package: (main package) error: Summary field must be present in package: (main package) error: Group field must be present in package: (main package) error: License field must be present in package: (main package) $ ls -l /usr/src/rpm/SPECS/ total 0 -rw------- 1 root root 0 2007-05-29 21:46 tar: Pattern matching characters used in file names. Please,
Strange.
Quoted 7 lines
Signed-off-by Jakub Narebski <[email protected]>---
'tig.spec.in' is based on 'git.spec.in' from git repository.This is the initial, minimal version. For example it does not add TIG-VERSION-GEN file and the rest of versioning infrastructure that is used in git
Makefile.
I would prefer to do without. ;)
Quoted 10 lines
Commands used to get version string (in
RPM_VERSION) suitable as a version field in the rpm can, most probably, be improved. Perhaps (with the new git-describe output) we should put closest version tag as version of tig in rpm, and distance from the tag (perhaps plus 1) as release number (in the rpm sense).TODO: Change '--without docs' to '--with rebuild-docs' and use pre-generated docs when creating rpm, instead of generating them (and requiring asciidoc, xmlto and docbook2pdf to build rpm if we want tig documentation).
Yeah, once the "official" tarballs contains the version info, this sounds like a good idea.
Quoted 4 lines
P.S. I have build tig-0.6.4.g9eded37-1.i386.rpm using "make rpm" from tig repository, and installed it without problems, but when trying to build it again_withoutnetwork_it failed on building manual.pdf. Error log attached.
Looks like some problems with the SGML catalogs info.
Quoted 9 lines
asciidoc-7.1.2-2.fc3.rf
docbook-dtds-1.0-26
docbook-style-dsssl-1.79-1
docbook-style-xsl-1.68.1-1
docbook-utils-0.6.14-4
docbook-utils-pdf-0.6.14-4
jadetex-3.12-13
openjade-1.3.2-16
Quoted 4 lines
I think we can skip generation of manual.pdf, and generate it only on request (e.g. "make doc-pdf"), or using doc-man and doc-html in place of doc in the spec file... but this is better left for the next commit.
Good idea, PDF is not essential and probably suboptimal to either of the HTML versions of the manual.
Quoted 2 lines
By the way, why do you use xmlto and docbook2pdf, instead of a2x from asciidoc package?
It is a fairly recent addition to the asciidoc. Besides, I just tried it and it seems to be completely unusable on ubuntu because of the way it has been packaged; it cannot find required files.
Quoted 22 lines
.gitignore | 2 ++ Makefile | 34 ++++++++++++++++++++++++++++++++-- tig.spec.in | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 90 insertions(+), 2 deletions(-) create mode 100644 tig.spec.in.gitignore +2
-0@@ -2,3 +2,5 @@ manual.html-chunked manual.pdf manual.toc tig +tig.spec +tig-*.tar.gzMakefile +0
-0@@ -18,8 +18,16 @@ DOCS = $(DOCS_MAN) $(DOCS_HTML) \ ifneq (,$(wildcard .git))
Makefile DOCS = $(DOCS_MAN) $(DOCS_HTML) \ · line 27
Quoted 10 lines
Makefile +6
-1VERSION = $(shell git-describe) WTDIRTY = $(shell git-diff-index --name-only HEAD 2>/dev/null) -CFLAGS += '-DVERSION="$(VERSION)$(if $(WTDIRTY),-dirty)"' +else +GEN_VER="tig-0.6.TIG" +VERSION = $(shell test -f version && cat version || echo "$(GEN_VER)") endif +CFLAGS += '-DVERSION="$(VERSION)$(if $(WTDIRTY),-dirty)"' +RPM_VERSION = $(subst tig-,,$(VERSION)) +RPM_VERSION := $(subst -,.,$(RPM_VERSION))
I will probably try to simplify and clean this up a bit.
Quoted 35 lines
Makefile +13
-1+ +TARNAME=tig-$(RPM_VERSION) + all: $(PROGS) all-debug: $(PROGS)@@ -57,6 +65,9 @@ install-doc: install-doc-man install-doc-html clean: rm -rf manual.html-chunked rm -f $(PROGS) $(DOCS) core *.xml + rm -f *.spec + rm -rf $(TARNAME) + rm -f $(TARNAME).tar.gz spell-check: aspell --lang=en --check tig.1.txt tigrc.5.txt manual.txt@@ -64,7 +75,7 @@ spell-check: strip: all strip $(PROGS) -.PHONY: all all-debug doc doc-man doc-html install install-doc install-doc-man install-doc-html clean spell-check +.PHONY: all all-debug doc doc-man doc-html install install-doc install-doc-man install-doc-html clean spell-check dist rpm manual.html: manual.toc manual.toc: manual.txt@@ -119,3 +130,22 @@ sync-docs: make doc cg commit -m "Sync docs" cg switch master + +tig.spec: tig.spec.in + sed -e 's/@@VERSION@@/$(RPM_VERSION)/g' < $< > $@+ + mv $@+ $@ + +dist: tig.spec
Makefile sync-docs: · line 148
Quoted 10 lines
Makefile +10
-0+ git-archive --format=tar \ + --prefix=$(TARNAME)/ HEAD^{tree} > $(TARNAME).tar + @mkdir -p $(TARNAME) + @cp tig.spec $(TARNAME) + @echo $(VERSION) > $(TARNAME)/version + tar rf $(TARNAME).tar \ + $(TARNAME)/tig.spec \ + $(TARNAME)/version + @rm -rf $(TARNAME) + gzip -f -9 $(TARNAME).tar
Does the .spec file need to be in the tarball for rpm to work? I mean, if it can be generated from .spec.in, I would rather have the rpm target create it?
Quoted 11 lines
Makefile +2
-0+rpm: dist + rpmbuild -ta $(TARNAME).tar.gztig.spec.in new file +3
-0@@ -0,0 +1,56 @@ +# -*- mode: rpm-spec-mode; encoding: utf-8; -*- +# Pass '--without docs' to rpmbuild if you don't want the documentation +
tig.spec.in line 13
Quoted 10 lines
tig.spec.in new file +10
-0+Summary: Tig: text-mode interface for git +Name: tig +Version: @@VERSION@@ +Release: 1%{?dist} +License: GPL +Group: Development/Tools +Vendor: Jonas Fonseca <[email protected]> +URL: http://jonas.nitro.dk/tig/ +Source: http://jonas.nitro.dk/tig/releases/%{name}-%{version}.tar.gz +BuildRequires: ncurses-devel%{!?_without_docs:, xmlto, asciidoc > 6.0.3, /usr/bin/docbook2pdf}
Is the last entry a shorthand for the doc dependencies you listed above?
Quoted 26 lines
tig.spec.in new file +26
-0+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +Requires: git-core, ncurses + +%description +Tig is a git repository browser that additionally can act as a pager +for output from various git commands. + +When browsing repositories, it uses the underlying git commands to +present the user with various views, such as summarized revision log +and showing the commit with the log message, diffstat, and the diff. + +Using it as a pager, it will display input from stdin and colorize it. + +%prep +%setup -q + +%build +CFLAGS="$RPM_OPT_FLAGS -DVERSION=tig-%{version}-%{release}" +%{__make} %{_smp_mflags} \ + prefix=%{_prefix} \ + all %{!?_without_docs: doc} + +%install +[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT +CFLAGS="$RPM_OPT_FLAGS -DVERSION=tig-%{version}-%{release}" +%{__make} %{_smp_mflags} DESTDIR=$RPM_BUILD_ROOT \
tig.spec.in line 49
Quoted 10 lines
tig.spec.in new file +10
-0+ prefix=%{_prefix} bindir=%{_bindir} mandir=%{_mandir} \ + install %{!?_without_docs: install-doc-man} + +%clean +[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT + +%files +%defattr(-,root,root) +%{_bindir}/* +%doc README COPYING INSTALL SITES BUGS TODO tigrc
I don't know if manual.txt should perhaps be included if HTML and PDF files will not be generated.
Quoted 7 lines
tig.spec.in new file +7
-0+%{!?_without_docs: %{_mandir}/man1/*.1*} +%{!?_without_docs: %{_mandir}/man5/*.5*} +%{!?_without_docs: %doc *.html *.pdf} + +%changelog +* Mon May 28 2007 Jakub Narebski <[email protected]> +- Initial tig spec file
Signature · 1 line
Jonas Fonseca
Quoted 17 lines · Jonas Fonseca
Jakub Narebski <[email protected]> wrote Mon, May 28, 2007:
Quoted 1 line
Minimally tested (meaning "make rpm" from tig repository works).
Trying 'make rpm' on ubuntu 7.04 I get:
$ rpmbuild -ta tig-0.6.g2463b4e.tar.gz error: Name field must be present in package: (main package) error: Version field must be present in package: (main package) error: Release field must be present in package: (main package) error: Summary field must be present in package: (main package) error: Group field must be present in package: (main package) error: License field must be present in package: (main package) $ ls -l /usr/src/rpm/SPECS/ total 0 -rw------- 1 root root 0 2007-05-29 21:46 tar: Pattern matching characters used in file names. Please,
Quoted 1 line
Strange.
Hmmm... WORKSFORME. Aurox 11.1 (Fedora Core 4 based distribution), with rpm 4.4.1. By the way, isn't Ubuntu based on Debian? Do you have rpmbuild installed?
BTW. perhaps you could provide spec equivalent for building tig*.deb?
1000:[master!tig]$ make rpm
sed -e 's/@@VERSION@@/0.6.5.g2bba6eb/g' < tig.spec.in > tig.spec+ mv tig.spec+ tig.spec
git-archive --format=tar \
--prefix=tig-0.6.5.g2bba6eb/ HEAD^{tree} > tig-0.6.5.g2bba6eb.tar
tar rf tig-0.6.5.g2bba6eb.tar \
tig-0.6.5.g2bba6eb/tig.spec \
tig-0.6.5.g2bba6eb/version gzip -f -9 tig-0.6.5.g2bba6eb.tar
rpmbuild -ta tig-0.6.5.g2bba6eb.tar.gz Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.85822
+ umask 022
+ cd /home/local/builddir/BUILD
+ LANG=C
+ export LANG
+ unset DISPLAY
+ cd /home/local/builddir/BUILD
+ rm -rf tig-0.6.5.g2bba6eb
+ /usr/bin/gzip -dc /home/jnareb/tig/tig-0.6.5.g2bba6eb.tar.gz
+ tar -xf -
+ STATUS=0
Quoted 9 lines
Quoted 7 lines
Signed-off-by Jakub Narebski <[email protected]>---
'tig.spec.in' is based on 'git.spec.in' from git repository.This is the initial, minimal version. For example it does not add TIG-VERSION-GEN file and the rest of versioning infrastructure that is used in git
Makefile.I would prefer to do without. ;)
I think we can do without it, but in current implementation there is no guarantee that we would not get wrong version.
[...]
Quoted 6 lines
Quoted 4 lines
P.S. I have build tig-0.6.4.g9eded37-1.i386.rpm using "make rpm" from tig repository, and installed it without problems, but when trying to build it again_withoutnetwork_it failed on building manual.pdf. Error log attached.Looks like some problems with the SGML catalogs info.
If I only knew how to debug that...
Quoted 7 lines
Quoted 4 lines
I think we can skip generation of manual.pdf, and generate it only on request (e.g. "make doc-pdf"), or using doc-man and doc-html in place of doc in the spec file... but this is better left for the next commit.
Good idea, PDF is not essential and probably suboptimal to either of the HTML versions of the manual.
And it is very easy to implement: just replace 'doc' in make invocation in tig.spec.in by the 'doc-man doc-html'.
Quoted 6 lines
Quoted 2 lines
By the way, why do you use xmlto and docbook2pdf, instead of a2x from asciidoc package?
It is a fairly recent addition to the asciidoc. Besides, I just tried it and it seems to be completely unusable on ubuntu because of the way it has been packaged; it cannot find required files.
Fair enough.
[...]
Quoted 10 lines
Quoted 10 lines
Makefile +1
-1@@ -18,8 +18,16 @@ DOCS = $(DOCS_MAN) $(DOCS_HTML) \ ifneq (,$(wildcard .git)) VERSION = $(shell git-describe) WTDIRTY = $(shell git-diff-index --name-only HEAD 2>/dev/null) -CFLAGS += '-DVERSION="$(VERSION)$(if $(WTDIRTY),-dirty)"' +else
Quoted 8 lines
Makefile DOCS = $(DOCS_MAN) $(DOCS_HTML) \ · line 27
Quoted 6 lines
Makefile +5
-0+GEN_VER="tig-0.6.TIG" +VERSION = $(shell test -f version && cat version || echo "$(GEN_VER)") endif +CFLAGS += '-DVERSION="$(VERSION)$(if $(WTDIRTY),-dirty)"' +RPM_VERSION = $(subst tig-,,$(VERSION)) +RPM_VERSION := $(subst -,.,$(RPM_VERSION))I will probably try to simplify and clean this up a bit.
That would be nice.
[...]
Quoted 7 lines
Quoted 7 lines
Makefile +7
-0+dist: tig.spec + git-archive --format=tar \ + --prefix=$(TARNAME)/ HEAD^{tree}> $(TARNAME).tar + @mkdir -p $(TARNAME) + @cp tig.spec $(TARNAME) + @echo $(VERSION)> $(TARNAME)/version + tar rf $(TARNAME).tar \
Quoted 8 lines
Makefile sync-docs: · line 148
Quoted 4 lines
Makefile +4
-0+ $(TARNAME)/tig.spec \ + $(TARNAME)/version + @rm -rf $(TARNAME) + gzip -f -9 $(TARNAME).tarDoes the .spec file need to be in the tarball for rpm to work? I mean, if it can be generated from .spec.in, I would rather have the rpm target create it?
Having .spec file in the tarbal allows to download tarball and use 'rpmbuild -ta tig-*.tar.gz' to build rpms; no need to unpack then do 'make rpm'.
Besides rpm target makes use of this, although there is alternate solution.
Quoted 2 lines
Quoted 2 lines
Makefile +2
-0+rpm: dist + rpmbuild -ta $(TARNAME).tar.gz
[...]
Quoted 3 lines
Quoted 1 line
+BuildRequires: ncurses-devel%{!?_without_docs:, xmlto, asciidoc> 6.0.3,
/usr/bin/docbook2pdf}Is the last entry a shorthand for the doc dependencies you listed above?
Nope, the list of packages was because the error with creating manual.pdf might depend on versions of packages I have installed.
The last entry written using name of binary (needed to generate manual.pdf) because I think where this tool can be found, i.e. in which package, might depend on distribution you use. For example in FC4 it is in docbook-utils-pdf package.
[...]
Quoted 4 lines
Quoted 4 lines
+%files
+%defattr(-,root,root)
+%{_bindir}/*
+%doc README COPYING INSTALL SITES BUGS TODO tigrc
By the way, should we put tigrc in examples/tigrc, or perhaps in some skeleton file?
Quoted 6 lines
I don't know if manual.txt should perhaps be included if HTML and PDF files will not be generated.
Quoted 3 lines
+%{!?_without_docs: %{_mandir}/man1/*.1*}
+%{!?_without_docs: %{_mandir}/man5/*.5*}
+%{!?_without_docs: %doc *.html *.pdf}
O.K. It would be as easy as %{?_without_docs: %doc *.txt}
Signature · 2 lines
Jakub Narebski Poland
Jakub Narebski <[email protected]> wrote Wed, May 30, 2007:
Quoted 5 lines · Jonas Fonseca
Quoted 1 line
Jakub Narebski <[email protected]> wrote Mon, May 28, 2007:
[...]
By the way, isn't Ubuntu based on Debian? Do you
have rpmbuild installed?
Yes it is Debian-based and yes I do, but I don't know if I need to do something explicitly to get it working. Mostly, prefixing things with 'sudo' works magic on Ubuntu but not in this case. ;)
Quoted 1 line
BTW. perhaps you could provide spec equivalent for building tig*.deb?
Well, there already exists a Debian package for tig so it would be easy to lift the files required and if the Debian maintainer wanted it, sure. However, not as simple as a .spec file so it is more work to maintain.
Quoted 1 line
1000:[master!tig]$ make rpm
Maybe you can test the newly released tig 0.7 tarball?
Your patch was added as commit 8cdf56913e7e486bb3f527c24ee4a4d19f2a4f61, with a few minor adjustments.
Quoted 8 lines
[...]
Quoted 4 lines
Quoted 4 lines
+%files
+%defattr(-,root,root)
+%{_bindir}/*
+%doc README COPYING INSTALL SITES BUGS TODO tigrcBy the way, should we put tigrc in examples/tigrc, or perhaps in some skeleton file?
It is mostly the default (builtin) options, so I don't see the point. Maybe it is time tig got a contrib area though, since I've been wanting to make a bash completion file. The tigrc file could go there as tigrc.sample or something. Could make it more obvious the intension of the file?
Quoted 8 lines
Quoted 6 lines
I don't know if manual.txt should perhaps be included if HTML and PDF files will not be generated.
Quoted 3 lines
+%{!?_without_docs: %{_mandir}/man1/*.1*}
+%{!?_without_docs: %{_mandir}/man5/*.5*}
+%{!?_without_docs: %doc *.html *.pdf}O.K. It would be as easy as %{?_without_docs: %doc *.txt}
I will try to correct this together with the no-PDF doc-building.
Signature · 1 line
Jonas Fonseca
PATCH 1/3 Remove PDF version of manual from being build and installed
Because PDF version of "The tig Manual" doesn't offer anything new that is not present in HTML version, and building PDF requires additional tools (docbook2pdf) and their dependencies present, remove it from tig rpm.
---
Jakub Narebski <[email protected]> wrote Wed, May 30, 2007:
Quoted 8 lines · Jonas Fonseca
Quoted 7 lines
Jakub Narebski <[email protected]> wrote Mon, May 28, 2007:
Quoted 4 lines
I think we can skip generation of manual.pdf, and generate it only on request (e.g. "make doc-pdf"), or using doc-man and doc-html in place of doc in the spec file... but this is better left for the next commit.
Quoted 5 lines
Quoted 2 lines
Good idea, PDF is not essential and probably suboptimal to either of the HTML versions of the manual.
And it is very easy to implement: just replace 'doc' in make invocation in tig.spec.in by the 'doc-man doc-html'.
This patch (commit) does just that.
Quoted 1 line · Jonas Fonseca
I will try to correct this together with the no-PDF doc-building.
I hope we didn't end up duplicating our efforts.
tig.spec.in | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-)
tig.spec.in +6 -3
@@ -10,7 +10,7 @@ Group: Development/Tools Vendor: Jonas Fonseca <[email protected]> URL: http://jonas.nitro.dk/tig/ Source: http://jonas.nitro.dk/tig/releases/%{name}-%{version}.tar.gz -BuildRequires: ncurses-devel%{!?_without_docs:, xmlto, asciidoc > 6.0.3, /usr/bin/docbook2pdf} +BuildRequires: ncurses-devel%{!?_without_docs:, xmlto, asciidoc > 6.0.3} BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Requires: git-core, ncurses
@@ -31,7 +31,7 @@ Using it as a pager, it will display input from stdin and colorize it. CFLAGS="$RPM_OPT_FLAGS -DVERSION=tig-%{version}-%{release}" %{__make} %{_smp_mflags} \ prefix=%{_prefix} \ - all %{!?_without_docs: doc} + all %{!?_without_docs: doc-man doc-html} %install [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
@@ -49,8 +49,11 @@ CFLAGS="$RPM_OPT_FLAGS -DVERSION=tig-%{version}-%{release}" %doc README COPYING INSTALL SITES BUGS TODO tigrc %{!?_without_docs: %{_mandir}/man1/*.1*} %{!?_without_docs: %{_mandir}/man5/*.5*} -%{!?_without_docs: %doc *.html *.pdf} +%{!?_without_docs: %doc *.html} %changelog +* Fri Jun 1 2007 Jakub Narebski <[email protected]> +- Remove PDF version of manual from being build and installed + * Mon May 28 2007 Jakub Narebski <[email protected]> - Initial tig spec file
Signature · 1 line
1.5.2
Re: [PATCH 1/3] Remove PDF version of manual from being build and installed
Jakub Narebski <[email protected]> wrote Fri, Jun 01, 2007:
Quoted 5 lines
[...]
Quoted 1 line · Jonas Fonseca
I will try to correct this together with the no-PDF doc-building.
I hope we didn't end up duplicating our efforts.
Nope, it didn't. Again, thanks for doing this!
Signature · 1 line
Jonas Fonseca
PATCH 2/3 Include documentation sources for rpmbuild with '--without docs'
In reply to Jonas FonsecaThis includes _all_ documentation sources (and not only manual.txt) in the rpm file build with '--without docs' option.
---
Jakub Narebski <[email protected]> wrote Wed, May 30, 2007:
Quoted 11 lines · Jonas Fonseca
Quoted 8 lines
Jakub Narebski <[email protected]> wrote Mon, May 28, 2007:
I don't know if manual.txt should perhaps be included if HTML and PDF files will not be generated.
Quoted 3 lines
+%{!?_without_docs: %{_mandir}/man1/*.1*}
+%{!?_without_docs: %{_mandir}/man5/*.5*}
+%{!?_without_docs: %doc *.html *.pdf}O.K. It would be as easy as %{?_without_docs: %doc *.txt}
Actually it does add more than manual.txt, it adds sources for all tig documentation (including manpages).
This patch textually depends on earlier patch, but in fact thic change is independent on previous one.
tig.spec.in | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
tig.spec.in +3 -1
@@ -1,5 +1,5 @@ # -*- mode: rpm-spec-mode; encoding: utf-8; -*- -# Pass '--without docs' to rpmbuild if you don't want the documentation +# Pass '--without docs' to rpmbuild if you don't want the documentation to be build Summary: Tig: text-mode interface for git Name: tig
@@ -50,9 +50,11 @@ CFLAGS="$RPM_OPT_FLAGS -DVERSION=tig-%{version}-%{release}" %{!?_without_docs: %{_mandir}/man1/*.1*} %{!?_without_docs: %{_mandir}/man5/*.5*} %{!?_without_docs: %doc *.html} +%{?_without_docs: %doc *.txt} %changelog * Fri Jun 1 2007 Jakub Narebski <[email protected]> +- Include documentation sources for --without docs - Remove PDF version of manual from being build and installed * Mon May 28 2007 Jakub Narebski <[email protected]>
Signature · 1 line
1.5.2
PATCH 3/3 Refresh VERSION file when building distribution tarball in "make dist"
In reply to Jonas FonsecaOverwrite contents of VERSION file from the HEAD revision with the current version (at the time of building), so VERSION file in the tarball generated by "make dist" (and which follows also rpm package generated by "make rpm") is up to date.
Otherwise for example when building rpm it will be compiled with wrong version string.
---
Quoted 4 lines · Jonas Fonseca
Maybe you can test the newly released tig 0.7 tarball?
Your patch was added as commit
8cdf56913e7e486bb3f527c24ee4a4d19f2a4f61, with a few minor adjustments.
One of those changes was using HEAD version of VERSION file in "make dist", instead of regenerating it and replacing it with the one containing _current_ version in the tar file.
$ make rpm sed -e 's/@@VERSION@@/0.7.4.g1995120/g' < tig.spec.in > tig.spec git-archive --format=tar --prefix=tig-0.7.4.g1995120/ HEAD > tig-0.7.4.g1995120.tar tar rf tig-0.7.4.g1995120.tar tig-0.7.4.g1995120/tig.spec gzip -f -9 tig-0.7.4.g1995120.tar rpmbuild -ta tig-0.7.4.g1995120.tar.gz Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.72336 Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.72336 make[1]: Entering directory `/home/local/builddir/BUILD/tig-0.7.4.g1995120' cc -Wall -O2 '-DVERSION="0.7.git"' tig.c -lcurses -o tig asciidoc -b docbook -d manpage -aversion=0.7.git tig.1.txt xmlto -m manpage.xsl man tig.1.xml [...]
Note the mismatch in the versions: 0.7.4.g1995120 vs 0.7.git (by the way, shouldn't it be 0.7.tig?), even when building from live repo, and not from tarball.
This is 3rd patch in the series, but it is actually independent on the rest, and can be applied in any order.
Makefile | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
Makefile +4 -1
@@ -76,7 +76,10 @@ dist: tig.spec git-archive --format=tar --prefix=$(TARNAME)/ HEAD > $(TARNAME).tar @mkdir -p $(TARNAME) @cp tig.spec $(TARNAME) - tar rf $(TARNAME).tar $(TARNAME)/tig.spec + echo $(VERSION) > $(TARNAME)/VERSION + tar rf $(TARNAME).tar \ + $(TARNAME)/tig.spec \ + $(TARNAME)/VERSION @rm -rf $(TARNAME) gzip -f -9 $(TARNAME).tar
Signature · 1 line
1.5.2
Re: [PATCH 3/3] Refresh VERSION file when building distribution tarball in "make dist"
Jakub Narebski <[email protected]> wrote Fri, Jun 01, 2007:
Quoted 25 lines · Jonas Fonseca
Quoted 5 lines
Maybe you can test the newly released tig 0.7 tarball?
Your patch was added as commit
8cdf56913e7e486bb3f527c24ee4a4d19f2a4f61, with a few minor adjustments.One of those changes was using HEAD version of VERSION file in "make dist", instead of regenerating it and replacing it with the one containing _current_ version in the tar file.
$ make rpm sed -e 's/@@VERSION@@/0.7.4.g1995120/g' < tig.spec.in > tig.spec git-archive --format=tar --prefix=tig-0.7.4.g1995120/ HEAD > tig-0.7.4.g1995120.tar tar rf tig-0.7.4.g1995120.tar tig-0.7.4.g1995120/tig.spec gzip -f -9 tig-0.7.4.g1995120.tar rpmbuild -ta tig-0.7.4.g1995120.tar.gz Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.72336 Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.72336 make[1]: Entering directory `/home/local/builddir/BUILD/tig-0.7.4.g1995120' cc -Wall -O2 '-DVERSION="0.7.git"' tig.c -lcurses -o tig asciidoc -b docbook -d manpage -aversion=0.7.git tig.1.txt xmlto -m manpage.xsl man tig.1.xml [...]
Quoted 3 lines
Note the mismatch in the versions: 0.7.4.g1995120 vs 0.7.git (by the way, shouldn't it be 0.7.tig?), even when building from live repo, and not from tarball.
Gah, somehow I didn't realize the problems of not updating the VERSION file. Beautiful, so now it should actually work even for non-RPM builds using the 'make dist' result. :)
Signature · 1 line
Jonas Fonseca
[RFC/PATCH 4/3] Simplify naming (versioning) of non-release tig tarball and rpm file
In reply to Jonas FonsecaUse the tag part of git-describe output, with `tig-' prefix stripped off, as version number. Use number of commits since given tag as release number, using 0 if we are at tagged version, and adding '.dirty' suffix if working directory is dirty. Do not use 'g<sha 1>' part of git-describe output.
For example, when git-describe output was tig-0.7-8-g26d0386, before this commit tarball was named tig-0.7.8.g26d0386.tar.gz and rpm was named tig-0.7.8.g26d0386-1.src.rpm (for dirty tree tarball was tig-0.7.8.g26d0386.dirty.tar.gz), now tarball is named tig-0.7-8.tar.gz and rpm is named tig-0.7-8.src.rpm (for dirty tree tarball is tig-0.7-8.dirty.tar.gz).
---
This is proposal to simplify naming of non-release tarballs and rpm file, both for tig and also for git itself. Instead of using whole git-describe output as version number in tarball/rpm name (BTW. it would be nice to have command line switch to git-describe which would return old output, without number of commits since given tag) use tag part as version number, and number of commits since (plus optional marking dirty) as release number.
What do you think about this?
Makefile | 13 ++++++++++--- tig.spec.in | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-)
Makefile +10 -3
@@ -17,7 +17,13 @@ ifdef DIST_VERSION VERSION = $(DIST_VERSION) endif -RPM_VERSION = $(subst -,.,$(VERSION)) +# $(GITDESC) looks like either x.y, or like x.y-z-g<sha1> +SPLIT_VERSION := $(shell echo $(GITDESC) | \ + sed -e 's/^\(.*\)-\([0-9]\+\)-\(g[0-9a-f]\+\)$$/\1 \2 \3/g') +RPM_VERSION = $(subst -,.,$(word 1,$(SPLIT_VERSION))) +RPM_RELEASE = $(strip \ + $(subst -,.,$(if $(word 2,$(SPLIT_VERSION)),\ + $(word 2,$(SPLIT_VERSION)),0)$(WTDIRTY))) LDLIBS = -lcurses CFLAGS = -Wall -O2 '-DVERSION="$(VERSION)"'
@@ -26,7 +32,7 @@ PROGS = tig MANDOC = tig.1 tigrc.5 HTMLDOC = tig.1.html tigrc.5.html manual.html README.html ALLDOC = $(MANDOC) $(HTMLDOC) manual.html-chunked manual.pdf -TARNAME = tig-$(RPM_VERSION) +TARNAME = tig-$(RPM_VERSION)-$(RPM_RELEASE) all: $(PROGS) all-debug: $(PROGS)
@@ -104,7 +110,8 @@ release-dist: release-doc install-doc-man install-doc-html clean spell-check dist rpm tig.spec: tig.spec.in - sed -e 's/@@VERSION@@/$(RPM_VERSION)/g' < $< > $@ + sed -e 's/@@VERSION@@/$(RPM_VERSION)/g' \ + -e 's/@@RELEASE@@/$(RPM_RELEASE)/g' < $< > $@ tig: tig.c
tig.spec.in +1 -1
@@ -4,7 +4,7 @@ Summary: Tig: text-mode interface for git Name: tig Version: @@VERSION@@ -Release: 1%{?dist} +Release: @@RELEASE@@%{?dist} License: GPL Group: Development/Tools Vendor: Jonas Fonseca <[email protected]>
Signature · 1 line
1.5.2
Re: [RFC/PATCH 4/3] Simplify naming (versioning) of non-release tig tarball and rpm file
Jakub Narebski <[email protected]> wrote Sat, Jun 02, 2007:
Quoted 9 lines
This is proposal to simplify naming of non-release tarballs and rpm file, both for tig and also for git itself. Instead of using whole git-describe output as version number in tarball/rpm name (BTW. it would be nice to have command line switch to git-describe which would return old output, without number of commits since given tag) use tag part as version number, and number of commits since (plus optional marking dirty) as release number.
What do you think about this?
I like the simpler and less confusing names. How about the simpler version below?
BTW, I also added make dist DIST_VERSION=X.Y to make it easy to force a version. I used it when building the documentation in the release branch.
Quoted 9 lines
Makefile +0
-1@@ -17,7 +17,13 @@ ifdef DIST_VERSION VERSION = $(DIST_VERSION) endif -RPM_VERSION = $(subst -,.,$(VERSION))
Makefile ifdef DIST_VERSION · line 29
Quoted 10 lines
Makefile +7
-0+# $(GITDESC) looks like either x.y, or like x.y-z-g<sha1> +SPLIT_VERSION := $(shell echo $(GITDESC) | \ + sed -e 's/^\(.*\)-\([0-9]\+\)-\(g[0-9a-f]\+\)$$/\1 \2 \3/g') +RPM_VERSION = $(subst -,.,$(word 1,$(SPLIT_VERSION))) +RPM_RELEASE = $(strip \ + $(subst -,.,$(if $(word 2,$(SPLIT_VERSION)),\ + $(word 2,$(SPLIT_VERSION)),0)$(WTDIRTY))) LDLIBS = -lcurses CFLAGS = -Wall -O2 '-DVERSION="$(VERSION)"'
Makefile +5 -1
@@ -17,7 +17,11 @@ ifdef DIST_VERSION VERSION = $(DIST_VERSION) endif -RPM_VERSION = $(subst -,.,$(VERSION)) +# Split the version "TAG-OFFSET-gSHA1-DIRTY" into "TAG OFFSET" +# and append 0 as a fallback offset for "exact" tagged versions. +RPM_VERLIST = $(filter-out g% dirty,$(subst -, ,$(VERSION))) 0 +RPM_VERSION = $(word 1,$(RPM_VERLIST)) +RPM_RELEASE = $(word 2,$(RPM_VERLIST))$(if $(WTDIRTY),.dirty) LDLIBS = -lcurses CFLAGS = -Wall -O2
Signature · 1 line
Jonas Fonseca
Re: [RFC/PATCH 4/3] Simplify naming (versioning) of non-release tig tarball and rpm file
Quoted 10 lines · Jonas Fonseca
Jakub Narebski <[email protected]> wrote Sat, Jun 02, 2007:
Quoted 8 lines
This is proposal to simplify naming of non-release tarballs and rpm file, both for tig and also for git itself. Instead of using whole git-describe output as version number in tarball/rpm name (BTW. it would be nice to have command line switch to git-describe which would return old output, without number of commits since given tag) use tag part as version number, and number of commits since (plus optional marking dirty) as release number.
Quoted 4 lines
Quoted 1 line
What do you think about this?
I like the simpler and less confusing names. How about the simpler version below?
This version would work for tig now, but is not very generic. See also comments below.
Quoted 3 lines
BTW, I also added
make dist DIST_VERSION=X.Yto make it easy to force a version. I used it when building the documentation in the release branch.
Nice idea.
Quoted 27 lines
Quoted 19 lines
Makefile +7
-1@@ -17,7 +17,13 @@ ifdef DIST_VERSION VERSION = $(DIST_VERSION) endif -RPM_VERSION = $(subst -,.,$(VERSION)) +# $(GITDESC) looks like either x.y, or like x.y-z-g<sha1> +SPLIT_VERSION := $(shell echo $(GITDESC) | \ + sed -e 's/^\(.*\)-\([0-9]\+\)-\(g[0-9a-f]\+\)$$/\1 \2 \3/g') +RPM_VERSION = $(subst -,.,$(word 1,$(SPLIT_VERSION))) +RPM_RELEASE = $(strip \ + $(subst -,.,$(if $(word 2,$(SPLIT_VERSION)),\ + $(word 2,$(SPLIT_VERSION)),0)$(WTDIRTY))) LDLIBS = -lcurses CFLAGS = -Wall -O2 '-DVERSION="$(VERSION)"'Makefile +0
-0@@ -17,7 +17,11 @@ ifdef DIST_VERSION VERSION = $(DIST_VERSION) endif
Makefile ifdef DIST_VERSION · line 27
Quoted 10 lines
Makefile +5
-1-RPM_VERSION = $(subst -,.,$(VERSION)) +# Split the version "TAG-OFFSET-gSHA1-DIRTY" into "TAG OFFSET" +# and append 0 as a fallback offset for "exact" tagged versions. +RPM_VERLIST = $(filter-out g% dirty,$(subst -, ,$(VERSION))) 0 +RPM_VERSION = $(word 1,$(RPM_VERLIST)) +RPM_RELEASE = $(word 2,$(RPM_VERLIST))$(if $(WTDIRTY),.dirty) LDLIBS = -lcurses CFLAGS = -Wall -O2
I'd like to note that I wanted to make _generic_ version of generating RPM_VERSION and RPM_RELEASE from the output of git-describe (also with marking that working directory was in dirty state). Your simpler version works for tags used in tig repository, but for example not necessarily so for git repository.
I assume that "version tags" are of the form
[<prefix>]<version>
where optional <prefix> is "v" for git and linux repositories, "tig-" for tig repository, "gitgui-" for git-gui repository. <version> starts with a number, and usually consists of numbers separated by dots, but it can contain also alphanumeric suffix, for example "-rc1", "-pre7", "b" (c.f. v0.99.9b tag in git repository), etc. I assume that <version> is the part that starts with the number.
This means that git-describe output is either of the form
[<prefix>]<version>
(if there is exact match), or of the form
[<prefix>]<version>-<number of additional commits>-g<abbreviated sha-1>
For exact match (release tarball) I'd like to have
RPM_VERSION = $(subst -,.,<version>) RPM_RELEASE = 0
and for non-exact match to have
RPM_VERSION = $(subst -,.,<version>) RPM_RELEASE = <number of additional commits>.g<abbreviated sha-1>
The "g<abbreviated sha-1>", which was missing from my (and yours) proposal is needed because we can have multiple branches, and the part before "-g<abbreviated sha-1>" could be the same for different commits (on different branches, e.g. 'master' and 'next').
For "make dist" run from a dirty tree we want to have ".dirty" suffix added to RPM_RELEASE.
Example: if git-describe returns v1.4.3-rc2-21-g0a7a9a1 in a dirty tree (with uncommitted changes) I'd like to have 1.4.3.rc2 as version number and 21.g0a7a9a1.dirty as release number, so tarball would be named git-1.4.3.rc2-21.g0a7a9a1.dirty.tar.gz
Now to the implementation. I wanted to do the above using only Makefile functions, if not for two complications. First I didn't know how to get second-to-last word, or how to remove last word from variable; trick with filter-out could work there. Second in generic version is quite hard to distinguish using only make functions between exact and non-exact match for arbitrary versioning (tagging versions) scheme.
P.S. Perhaps instead of RPM_VERSION we should (re)use DIST_VERSION, and instead of RPM_RELEASE use DIST_RELEASE?
Signature · 2 lines
Jakub Narebski Poland