{"thread":{"id":"8339","subject":"[PATCH (tig)] Infrastructure for tig rpm builds.","startedAt":"2007-05-28T08:54:04Z","lastAt":"2007-06-03T21:12:59Z","messageCount":12,"participants":["Jakub Narebski","Jonas Fonseca"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"43486","messageId":"200705281054.05376.jnareb@gmail.com","threadId":"8339","inReplyTo":null,"subject":"[PATCH (tig)] Infrastructure for tig rpm builds.","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-05-28T08:54:04Z","receivedAt":"2007-05-28T08:54:04Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Adds RPM_VERSION to Makefile and new make targets: tig.spec, dist, and\nrpm. A simple 'make rpm' will build the rpm. Also adds tig.spec.in\nwhich is used to generate tig.spec.\n\nAccidentally VERSION (and adding -DVERSION=$(VERSION) to CFLAGS) is\nnow defined always, even if we do not compile from the \"live\" tig\nrepository.\n\nMinimally tested (meaning \"make rpm\" from tig repository works).\n\nSigned-off-by: Jakub Narebski <jnareb@gmail.com>\n---\n'tig.spec.in' is based on 'git.spec.in' from git repository.\n\nThis is the initial, minimal version.  For example it does not add\nTIG-VERSION-GEN file and the rest of versioning infrastructure that is\nused in git Makefile.\n\nCommands used to get version string (in RPM_VERSION) suitable as a\nversion field in the rpm can, most probably, be improved.  Perhaps\n(with the new git-describe output) we should put closest version tag\nas version of tig in rpm, and distance from the tag (perhaps plus 1)\nas release number (in the rpm sense).\n\nTODO: Change '--without docs' to '--with rebuild-docs' and use\npre-generated docs when creating rpm, instead of generating them (and\nrequiring asciidoc, xmlto and docbook2pdf to build rpm if we want tig\ndocumentation).\n\n\nP.S. I have build tig-0.6.4.g9eded37-1.i386.rpm using \"make rpm\" from\ntig repository, and installed it without problems, but when trying to\nbuild it again _without network_ it failed on building\nmanual.pdf. Error log attached.\n\n  asciidoc-7.1.2-2.fc3.rf\n  docbook-dtds-1.0-26\n  docbook-style-dsssl-1.79-1\n  docbook-style-xsl-1.68.1-1\n  docbook-utils-0.6.14-4\n  docbook-utils-pdf-0.6.14-4\n  jadetex-3.12-13\n  openjade-1.3.2-16\n\nI think we can skip generation of manual.pdf, and generate it only on\nrequest (e.g. \"make doc-pdf\"), or using doc-man and doc-html in place\nof doc in the spec file... but this is better left for the next\ncommit.\n\nBy the way, why do you use xmlto and docbook2pdf, instead of a2x from\nasciidoc package?\n\n .gitignore  |    2 ++\n Makefile    |   34 ++++++++++++++++++++++++++++++++--\n tig.spec.in |   56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n 3 files changed, 90 insertions(+), 2 deletions(-)\n create mode 100644 tig.spec.in\n\ndiff --git a/.gitignore b/.gitignore\nindex 8f6aa93..f7ab840 100644\n--- a/.gitignore\n+++ b/.gitignore\n@@ -2,3 +2,5 @@ manual.html-chunked\n manual.pdf\n manual.toc\n tig\n+tig.spec\n+tig-*.tar.gz\ndiff --git a/Makefile b/Makefile\nindex 06a5d6a..45c833b 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -18,8 +18,16 @@ DOCS\t= $(DOCS_MAN) $(DOCS_HTML) \\\n ifneq (,$(wildcard .git))\n VERSION = $(shell git-describe)\n WTDIRTY = $(shell git-diff-index --name-only HEAD 2>/dev/null)\n-CFLAGS += '-DVERSION=\"$(VERSION)$(if $(WTDIRTY),-dirty)\"'\n+else\n+GEN_VER=\"tig-0.6.TIG\"\n+VERSION = $(shell test -f version && cat version || echo \"$(GEN_VER)\")\n endif\n+CFLAGS += '-DVERSION=\"$(VERSION)$(if $(WTDIRTY),-dirty)\"'\n+RPM_VERSION  = $(subst tig-,,$(VERSION))\n+RPM_VERSION := $(subst -,.,$(RPM_VERSION))\n+\n+TARNAME=tig-$(RPM_VERSION)\n+\n \n all: $(PROGS)\n all-debug: $(PROGS)\n@@ -57,6 +65,9 @@ install-doc: install-doc-man install-doc-html\n clean:\n \trm -rf manual.html-chunked\n \trm -f $(PROGS) $(DOCS) core *.xml\n+\trm -f *.spec\n+\trm -rf $(TARNAME)\n+\trm -f $(TARNAME).tar.gz\n \n spell-check:\n \taspell --lang=en --check tig.1.txt tigrc.5.txt manual.txt\n@@ -64,7 +75,7 @@ spell-check:\n strip: all\n \tstrip $(PROGS)\n \n-.PHONY: all all-debug doc doc-man doc-html install install-doc install-doc-man install-doc-html clean spell-check\n+.PHONY: all all-debug doc doc-man doc-html install install-doc install-doc-man install-doc-html clean spell-check dist rpm\n \n manual.html: manual.toc\n manual.toc: manual.txt\n@@ -119,3 +130,22 @@ sync-docs:\n \tmake doc\n \tcg commit -m \"Sync docs\"\n \tcg switch master\n+\n+tig.spec: tig.spec.in\n+\tsed -e 's/@@VERSION@@/$(RPM_VERSION)/g' < $< > $@+\n+\tmv $@+ $@\n+\n+dist: tig.spec\n+\tgit-archive --format=tar \\\n+\t\t--prefix=$(TARNAME)/ HEAD^{tree} > $(TARNAME).tar\n+\t@mkdir -p $(TARNAME)\n+\t@cp tig.spec $(TARNAME)\n+\t@echo $(VERSION) > $(TARNAME)/version\n+\ttar rf $(TARNAME).tar \\\n+\t       $(TARNAME)/tig.spec \\\n+\t       $(TARNAME)/version\n+\t@rm -rf $(TARNAME)\n+\tgzip -f -9 $(TARNAME).tar\n+\n+rpm: dist\n+\trpmbuild -ta $(TARNAME).tar.gz\ndiff --git a/tig.spec.in b/tig.spec.in\nnew file mode 100644\nindex 0000000..2ce6cdb\n--- /dev/null\n+++ b/tig.spec.in\n@@ -0,0 +1,56 @@\n+# -*- mode: rpm-spec-mode; encoding: utf-8; -*-\n+# Pass '--without docs' to rpmbuild if you don't want the documentation\n+\n+Summary: \tTig: text-mode interface for git\n+Name: \t\ttig\n+Version: \t@@VERSION@@\n+Release: \t1%{?dist}\n+License: \tGPL\n+Group: \t\tDevelopment/Tools\n+Vendor: \tJonas Fonseca <fonseca@diku.dk>\n+URL: \t\thttp://jonas.nitro.dk/tig/\n+Source: \thttp://jonas.nitro.dk/tig/releases/%{name}-%{version}.tar.gz\n+BuildRequires: \tncurses-devel%{!?_without_docs:, xmlto, asciidoc > 6.0.3, /usr/bin/docbook2pdf}\n+BuildRoot: \t%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)\n+Requires: \tgit-core, ncurses\n+\n+%description\n+Tig is a git repository browser that additionally can act as a pager\n+for output from various git commands.\n+\n+When browsing repositories, it uses the underlying git commands to\n+present the user with various views, such as summarized revision log\n+and showing the commit with the log message, diffstat, and the diff.\n+\n+Using it as a pager, it will display input from stdin and colorize it.\n+\n+%prep\n+%setup -q\n+\n+%build\n+CFLAGS=\"$RPM_OPT_FLAGS -DVERSION=tig-%{version}-%{release}\"\n+%{__make} %{_smp_mflags} \\\n+\tprefix=%{_prefix} \\\n+\tall %{!?_without_docs: doc}\n+\n+%install\n+[ \"$RPM_BUILD_ROOT\" != \"/\" ] && rm -rf $RPM_BUILD_ROOT\n+CFLAGS=\"$RPM_OPT_FLAGS -DVERSION=tig-%{version}-%{release}\"\n+%{__make} %{_smp_mflags} DESTDIR=$RPM_BUILD_ROOT \\\n+\tprefix=%{_prefix} bindir=%{_bindir} mandir=%{_mandir} \\\n+\tinstall %{!?_without_docs: install-doc-man}\n+\n+%clean\n+[ \"$RPM_BUILD_ROOT\" != \"/\" ] && rm -rf $RPM_BUILD_ROOT\n+\n+%files\n+%defattr(-,root,root)\n+%{_bindir}/*\n+%doc README COPYING INSTALL SITES BUGS TODO tigrc\n+%{!?_without_docs: %{_mandir}/man1/*.1*}\n+%{!?_without_docs: %{_mandir}/man5/*.5*}\n+%{!?_without_docs: %doc *.html *.pdf}\n+\n+%changelog\n+* Mon May 28 2007 Jakub Narebski <jnareb@gmail.com>\n+- Initial tig spec file\n-- \n1.5.2\n\n\n\ndocbook2pdf manual.xml\nUsing catalogs: /etc/sgml/xml-docbook-4.2-1.0-26.cat\nUsing stylesheet: /usr/share/sgml/docbook/utils-0.6.14/docbook-utils.dsl#print\nWorking on: /home/local/builddir/BUILD/tig-0.6.4.g9eded37/manual.xml\njade:/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)\njade:/home/local/builddir/BUILD/tig-0.6.4.g9eded37/manual.xml:2:118:E: DTD did not contain element declaration for document type name\njade:/home/local/builddir/BUILD/tig-0.6.4.g9eded37/manual.xml:4:14:E: there is no attribute \"lang\"\njade:/home/local/builddir/BUILD/tig-0.6.4.g9eded37/manual.xml:4:18:E: element \"article\" undefined\n\n[...]\n\njade:/home/local/builddir/BUILD/tig-0.6.4.g9eded37/manual.xml:400:10:E: element \"entry\" undefined\njade:/home/local/builddir/BUILD/tig-0.6.4.g9eded37/manual.xml:401:172:E: element \"emphasis\" undefined\njade:/home/local/builddir/BUILD/tig-0.6.4.g9eded37/manual.xml:404:6:E: element \"row\" undefined\njade:I: maximum number of errors (200) reached; change with -E option\njade:/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\njade:/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\njade:/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\n\n[...]\n\njade:/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\njade:/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\nmake[1]: *** [manual.pdf] Błąd 8\nrm manual.xml tigrc.5.xml tig.1.xml\nmake[1]: Leaving directory `/home/local/builddir/BUILD/tig-0.6.4.g9eded37'\n"},{"id":"43584","messageId":"20070529202923.GA6358@diku.dk","threadId":"8339","inReplyTo":"200705281054.05376.jnareb@gmail.com","subject":"Re: [PATCH (tig)] Infrastructure for tig rpm builds.","fromName":"Jonas Fonseca","fromEmail":"fonseca@diku.dk","sentAt":"2007-05-29T20:29:23Z","receivedAt":"2007-05-29T20:29:23Z","isPatch":true,"sender":{"key":"fonseca@diku.dk","avatar":"https://gravatar.com/avatar/f82f3ad698717c51873b020c750a92438c820a24056dc39fe4d07baa10a92264?d=mp&s=160"},"body":"Hej Jakub,\n\nJakub Narebski <jnareb@gmail.com> wrote Mon, May 28, 2007:\n> Adds RPM_VERSION to Makefile and new make targets: tig.spec, dist, and\n> rpm. A simple 'make rpm' will build the rpm. Also adds tig.spec.in\n> which is used to generate tig.spec.\n\nThank you. :)\n\n> Accidentally VERSION (and adding -DVERSION=$(VERSION) to CFLAGS) is\n> now defined always, even if we do not compile from the \"live\" tig\n> repository.\n\nYeah, this is probably a good idea; the same goes for moving version\ninfo to a file instead of having it in tig.c.\n\n> Minimally tested (meaning \"make rpm\" from tig repository works).\n\nTrying 'make rpm' on ubuntu 7.04 I get:\n\n  $ rpmbuild -ta tig-0.6.g2463b4e.tar.gz\n  error: Name field must be present in package: (main package)\n  error: Version field must be present in package: (main package)\n  error: Release field must be present in package: (main package)\n  error: Summary field must be present in package: (main package)\n  error: Group field must be present in package: (main package)\n  error: License field must be present in package: (main package)\n  $ ls -l /usr/src/rpm/SPECS/\n  total 0\n  -rw------- 1 root root 0 2007-05-29 21:46 tar: Pattern matching characters used in file names. Please,\n\nStrange.\n\n> Signed-off-by: Jakub Narebski <jnareb@gmail.com>\n> ---\n> 'tig.spec.in' is based on 'git.spec.in' from git repository.\n> \n> This is the initial, minimal version.  For example it does not add\n> TIG-VERSION-GEN file and the rest of versioning infrastructure that is\n> used in git Makefile.\n\nI would prefer to do without. ;)\n \n> Commands used to get version string (in RPM_VERSION) suitable as a\n> version field in the rpm can, most probably, be improved.  Perhaps\n> (with the new git-describe output) we should put closest version tag\n> as version of tig in rpm, and distance from the tag (perhaps plus 1)\n> as release number (in the rpm sense).\n> \n> TODO: Change '--without docs' to '--with rebuild-docs' and use\n> pre-generated docs when creating rpm, instead of generating them (and\n> requiring asciidoc, xmlto and docbook2pdf to build rpm if we want tig\n> documentation).\n\nYeah, once the \"official\" tarballs contains the version info, this\nsounds like a good idea.\n\n> P.S. I have build tig-0.6.4.g9eded37-1.i386.rpm using \"make rpm\" from\n> tig repository, and installed it without problems, but when trying to\n> build it again _without network_ it failed on building\n> manual.pdf. Error log attached.\n\nLooks like some problems with the SGML catalogs info.\n \n>   asciidoc-7.1.2-2.fc3.rf\n>   docbook-dtds-1.0-26\n>   docbook-style-dsssl-1.79-1\n>   docbook-style-xsl-1.68.1-1\n>   docbook-utils-0.6.14-4\n>   docbook-utils-pdf-0.6.14-4\n>   jadetex-3.12-13\n>   openjade-1.3.2-16\n> \n> I think we can skip generation of manual.pdf, and generate it only on\n> request (e.g. \"make doc-pdf\"), or using doc-man and doc-html in place\n> of doc in the spec file... but this is better left for the next\n> commit.\n\nGood idea, PDF is not essential and probably suboptimal to either of the\nHTML versions of the manual.\n\n> By the way, why do you use xmlto and docbook2pdf, instead of a2x from\n> asciidoc package?\n\nIt is a fairly recent addition to the asciidoc. Besides, I just tried it\nand it seems to be completely unusable on ubuntu because of the way it\nhas been packaged; it cannot find required files.\n\n>  .gitignore  |    2 ++\n>  Makefile    |   34 ++++++++++++++++++++++++++++++++--\n>  tig.spec.in |   56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n>  3 files changed, 90 insertions(+), 2 deletions(-)\n>  create mode 100644 tig.spec.in\n> \n> diff --git a/.gitignore b/.gitignore\n> index 8f6aa93..f7ab840 100644\n> --- a/.gitignore\n> +++ b/.gitignore\n> @@ -2,3 +2,5 @@ manual.html-chunked\n>  manual.pdf\n>  manual.toc\n>  tig\n> +tig.spec\n> +tig-*.tar.gz\n> diff --git a/Makefile b/Makefile\n> index 06a5d6a..45c833b 100644\n> --- a/Makefile\n> +++ b/Makefile\n> @@ -18,8 +18,16 @@ DOCS\t= $(DOCS_MAN) $(DOCS_HTML) \\\n>  ifneq (,$(wildcard .git))\n>  VERSION = $(shell git-describe)\n>  WTDIRTY = $(shell git-diff-index --name-only HEAD 2>/dev/null)\n> -CFLAGS += '-DVERSION=\"$(VERSION)$(if $(WTDIRTY),-dirty)\"'\n> +else\n> +GEN_VER=\"tig-0.6.TIG\"\n> +VERSION = $(shell test -f version && cat version || echo \"$(GEN_VER)\")\n>  endif\n> +CFLAGS += '-DVERSION=\"$(VERSION)$(if $(WTDIRTY),-dirty)\"'\n> +RPM_VERSION  = $(subst tig-,,$(VERSION))\n> +RPM_VERSION := $(subst -,.,$(RPM_VERSION))\n\nI will probably try to simplify and clean this up a bit. \n\n> +\n> +TARNAME=tig-$(RPM_VERSION)\n> +\n>  \n>  all: $(PROGS)\n>  all-debug: $(PROGS)\n> @@ -57,6 +65,9 @@ install-doc: install-doc-man install-doc-html\n>  clean:\n>  \trm -rf manual.html-chunked\n>  \trm -f $(PROGS) $(DOCS) core *.xml\n> +\trm -f *.spec\n> +\trm -rf $(TARNAME)\n> +\trm -f $(TARNAME).tar.gz\n>  \n>  spell-check:\n>  \taspell --lang=en --check tig.1.txt tigrc.5.txt manual.txt\n> @@ -64,7 +75,7 @@ spell-check:\n>  strip: all\n>  \tstrip $(PROGS)\n>  \n> -.PHONY: all all-debug doc doc-man doc-html install install-doc install-doc-man install-doc-html clean spell-check\n> +.PHONY: all all-debug doc doc-man doc-html install install-doc install-doc-man install-doc-html clean spell-check dist rpm\n>  \n>  manual.html: manual.toc\n>  manual.toc: manual.txt\n> @@ -119,3 +130,22 @@ sync-docs:\n>  \tmake doc\n>  \tcg commit -m \"Sync docs\"\n>  \tcg switch master\n> +\n> +tig.spec: tig.spec.in\n> +\tsed -e 's/@@VERSION@@/$(RPM_VERSION)/g' < $< > $@+\n> +\tmv $@+ $@\n> +\n> +dist: tig.spec\n> +\tgit-archive --format=tar \\\n> +\t\t--prefix=$(TARNAME)/ HEAD^{tree} > $(TARNAME).tar\n> +\t@mkdir -p $(TARNAME)\n> +\t@cp tig.spec $(TARNAME)\n> +\t@echo $(VERSION) > $(TARNAME)/version\n> +\ttar rf $(TARNAME).tar \\\n> +\t       $(TARNAME)/tig.spec \\\n> +\t       $(TARNAME)/version\n> +\t@rm -rf $(TARNAME)\n> +\tgzip -f -9 $(TARNAME).tar\n\nDoes the .spec file need to be in the tarball for rpm to work? I mean,\nif it can be generated from .spec.in, I would rather have the rpm target\ncreate it?\n\n> +rpm: dist\n> +\trpmbuild -ta $(TARNAME).tar.gz\n> diff --git a/tig.spec.in b/tig.spec.in\n> new file mode 100644\n> index 0000000..2ce6cdb\n> --- /dev/null\n> +++ b/tig.spec.in\n> @@ -0,0 +1,56 @@\n> +# -*- mode: rpm-spec-mode; encoding: utf-8; -*-\n> +# Pass '--without docs' to rpmbuild if you don't want the documentation\n> +\n> +Summary: \tTig: text-mode interface for git\n> +Name: \t\ttig\n> +Version: \t@@VERSION@@\n> +Release: \t1%{?dist}\n> +License: \tGPL\n> +Group: \t\tDevelopment/Tools\n> +Vendor: \tJonas Fonseca <fonseca@diku.dk>\n> +URL: \t\thttp://jonas.nitro.dk/tig/\n> +Source: \thttp://jonas.nitro.dk/tig/releases/%{name}-%{version}.tar.gz\n> +BuildRequires: \tncurses-devel%{!?_without_docs:, xmlto, asciidoc > 6.0.3, /usr/bin/docbook2pdf}\n\nIs the last entry a shorthand for the doc dependencies you listed above?\n\n> +BuildRoot: \t%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)\n> +Requires: \tgit-core, ncurses\n> +\n> +%description\n> +Tig is a git repository browser that additionally can act as a pager\n> +for output from various git commands.\n> +\n> +When browsing repositories, it uses the underlying git commands to\n> +present the user with various views, such as summarized revision log\n> +and showing the commit with the log message, diffstat, and the diff.\n> +\n> +Using it as a pager, it will display input from stdin and colorize it.\n> +\n> +%prep\n> +%setup -q\n> +\n> +%build\n> +CFLAGS=\"$RPM_OPT_FLAGS -DVERSION=tig-%{version}-%{release}\"\n> +%{__make} %{_smp_mflags} \\\n> +\tprefix=%{_prefix} \\\n> +\tall %{!?_without_docs: doc}\n> +\n> +%install\n> +[ \"$RPM_BUILD_ROOT\" != \"/\" ] && rm -rf $RPM_BUILD_ROOT\n> +CFLAGS=\"$RPM_OPT_FLAGS -DVERSION=tig-%{version}-%{release}\"\n> +%{__make} %{_smp_mflags} DESTDIR=$RPM_BUILD_ROOT \\\n> +\tprefix=%{_prefix} bindir=%{_bindir} mandir=%{_mandir} \\\n> +\tinstall %{!?_without_docs: install-doc-man}\n> +\n> +%clean\n> +[ \"$RPM_BUILD_ROOT\" != \"/\" ] && rm -rf $RPM_BUILD_ROOT\n> +\n> +%files\n> +%defattr(-,root,root)\n> +%{_bindir}/*\n> +%doc README COPYING INSTALL SITES BUGS TODO tigrc\n\nI don't know if manual.txt should perhaps be included if\nHTML and PDF files will not be generated.\n\n> +%{!?_without_docs: %{_mandir}/man1/*.1*}\n> +%{!?_without_docs: %{_mandir}/man5/*.5*}\n> +%{!?_without_docs: %doc *.html *.pdf}\n> +\n> +%changelog\n> +* Mon May 28 2007 Jakub Narebski <jnareb@gmail.com>\n> +- Initial tig spec file\n\n-- \nJonas Fonseca\n"},{"id":"43587","messageId":"200705300131.17137.jnareb@gmail.com","threadId":"8339","inReplyTo":"20070529202923.GA6358@diku.dk","subject":"Re: [PATCH (tig)] Infrastructure for tig rpm builds.","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-05-29T23:31:16Z","receivedAt":"2007-05-29T23:31:16Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"On Tue, 29 May 2007, Jonas Fonseca wrote:\n> Jakub Narebski <jnareb@gmail.com> wrote Mon, May 28, 2007:\n\n>> Minimally tested (meaning \"make rpm\" from tig repository works).\n> \n> Trying 'make rpm' on ubuntu 7.04 I get:\n> \n>   $ rpmbuild -ta tig-0.6.g2463b4e.tar.gz\n>   error: Name field must be present in package: (main package)\n>   error: Version field must be present in package: (main package)\n>   error: Release field must be present in package: (main package)\n>   error: Summary field must be present in package: (main package)\n>   error: Group field must be present in package: (main package)\n>   error: License field must be present in package: (main package)\n>   $ ls -l /usr/src/rpm/SPECS/\n>   total 0\n>   -rw------- 1 root root 0 2007-05-29 21:46 tar: Pattern matching characters used in file names. Please,\n> \n> Strange.\n\nHmmm... WORKSFORME. Aurox 11.1 (Fedora Core 4 based distribution),\nwith rpm 4.4.1. By the way, isn't Ubuntu based on Debian? Do you\nhave rpmbuild installed?\n\nBTW. perhaps you could provide spec equivalent for building tig*.deb?\n\n  1000:[master!tig]$ make rpm\n  sed -e 's/@@VERSION@@/0.6.5.g2bba6eb/g' < tig.spec.in > tig.spec+\n  mv tig.spec+ tig.spec\n  git-archive --format=tar \\\n  --prefix=tig-0.6.5.g2bba6eb/ HEAD^{tree} > tig-0.6.5.g2bba6eb.tar\n  tar rf tig-0.6.5.g2bba6eb.tar \\\n         tig-0.6.5.g2bba6eb/tig.spec \\\n         tig-0.6.5.g2bba6eb/version\n  gzip -f -9 tig-0.6.5.g2bba6eb.tar\n  rpmbuild -ta tig-0.6.5.g2bba6eb.tar.gz\n  Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.85822\n  + umask 022\n  + cd /home/local/builddir/BUILD\n  + LANG=C\n  + export LANG\n  + unset DISPLAY\n  + cd /home/local/builddir/BUILD\n  + rm -rf tig-0.6.5.g2bba6eb\n  + /usr/bin/gzip -dc /home/jnareb/tig/tig-0.6.5.g2bba6eb.tar.gz\n  + tar -xf -\n  + STATUS=0\n \n>> Signed-off-by: Jakub Narebski <jnareb@gmail.com>\n>> ---\n>> 'tig.spec.in' is based on 'git.spec.in' from git repository.\n>> \n>> This is the initial, minimal version.  For example it does not add\n>> TIG-VERSION-GEN file and the rest of versioning infrastructure that is\n>> used in git Makefile.\n> \n> I would prefer to do without. ;)\n\nI think we can do without it, but in current implementation there is\nno guarantee that we would not get wrong version.\n \n[...]\n>> P.S. I have build tig-0.6.4.g9eded37-1.i386.rpm using \"make rpm\" from\n>> tig repository, and installed it without problems, but when trying to\n>> build it again _without network_ it failed on building\n>> manual.pdf. Error log attached.\n> \n> Looks like some problems with the SGML catalogs info.\n\nIf I only knew how to debug that...\n\n>> I think we can skip generation of manual.pdf, and generate it only on\n>> request (e.g. \"make doc-pdf\"), or using doc-man and doc-html in place\n>> of doc in the spec file... but this is better left for the next\n>> commit.\n> \n> Good idea, PDF is not essential and probably suboptimal to either of the\n> HTML versions of the manual.\n\nAnd it is very easy to implement: just replace 'doc' in make invocation\nin tig.spec.in by the 'doc-man doc-html'.\n\n>> By the way, why do you use xmlto and docbook2pdf, instead of a2x from\n>> asciidoc package?\n> \n> It is a fairly recent addition to the asciidoc. Besides, I just tried it\n> and it seems to be completely unusable on ubuntu because of the way it\n> has been packaged; it cannot find required files.\n\nFair enough.\n \n[...]\n>> diff --git a/Makefile b/Makefile\n>> index 06a5d6a..45c833b 100644\n>> --- a/Makefile\n>> +++ b/Makefile\n>> @@ -18,8 +18,16 @@ DOCS\t= $(DOCS_MAN) $(DOCS_HTML) \\\n>>  ifneq (,$(wildcard .git))\n>>  VERSION = $(shell git-describe)\n>>  WTDIRTY = $(shell git-diff-index --name-only HEAD 2>/dev/null)\n>> -CFLAGS += '-DVERSION=\"$(VERSION)$(if $(WTDIRTY),-dirty)\"'\n>> +else\n>> +GEN_VER=\"tig-0.6.TIG\"\n>> +VERSION = $(shell test -f version && cat version || echo \"$(GEN_VER)\")\n>>  endif\n>> +CFLAGS += '-DVERSION=\"$(VERSION)$(if $(WTDIRTY),-dirty)\"'\n>> +RPM_VERSION  = $(subst tig-,,$(VERSION))\n>> +RPM_VERSION := $(subst -,.,$(RPM_VERSION))\n> \n> I will probably try to simplify and clean this up a bit. \n\nThat would be nice.\n\n[...]\n>> +dist: tig.spec\n>> +\tgit-archive --format=tar \\\n>> +\t\t--prefix=$(TARNAME)/ HEAD^{tree}> $(TARNAME).tar\n>> +\t@mkdir -p $(TARNAME)\n>> +\t@cp tig.spec $(TARNAME)\n>> +\t@echo $(VERSION)> $(TARNAME)/version\n>> +\ttar rf $(TARNAME).tar \\\n>> +\t       $(TARNAME)/tig.spec \\\n>> +\t       $(TARNAME)/version\n>> +\t@rm -rf $(TARNAME)\n>> +\tgzip -f -9 $(TARNAME).tar\n> \n> Does the .spec file need to be in the tarball for rpm to work? I mean,\n> if it can be generated from .spec.in, I would rather have the rpm target\n> create it?\n\nHaving .spec file in the tarbal allows to download tarball and use\n'rpmbuild -ta tig-*.tar.gz' to build rpms; no need to unpack then do\n'make rpm'.\n\nBesides rpm target makes use of this, although there is alternate\nsolution.\n\n>> +rpm: dist\n>> +\trpmbuild -ta $(TARNAME).tar.gz\n\n[...]\n>> +BuildRequires: \tncurses-devel%{!?_without_docs:, xmlto, asciidoc> 6.0.3, /usr/bin/docbook2pdf}\n> \n> Is the last entry a shorthand for the doc dependencies you listed above?\n\nNope, the list of packages was because the error with creating\nmanual.pdf might depend on versions of packages I have installed.\n\nThe last entry written using name of binary (needed to generate\nmanual.pdf) because I think where this tool can be found, i.e.\nin which package, might depend on distribution you use. For example\nin FC4 it is in docbook-utils-pdf package.\n\n[...]\n>> +%files\n>> +%defattr(-,root,root)\n>> +%{_bindir}/*\n>> +%doc README COPYING INSTALL SITES BUGS TODO tigrc\n\nBy the way, should we put tigrc in examples/tigrc, or perhaps in some\nskeleton file?\n\n> I don't know if manual.txt should perhaps be included if\n> HTML and PDF files will not be generated.\n> \n>> +%{!?_without_docs: %{_mandir}/man1/*.1*}\n>> +%{!?_without_docs: %{_mandir}/man5/*.5*}\n>> +%{!?_without_docs: %doc *.html *.pdf}\n\nO.K. It would be as easy as %{?_without_docs: %doc *.txt}\n\n-- \nJakub Narebski\nPoland\n"},{"id":"43684","messageId":"20070531131615.GA27044@diku.dk","threadId":"8339","inReplyTo":"200705300131.17137.jnareb@gmail.com","subject":"Re: [PATCH (tig)] Infrastructure for tig rpm builds.","fromName":"Jonas Fonseca","fromEmail":"fonseca@diku.dk","sentAt":"2007-05-31T13:16:16Z","receivedAt":"2007-05-31T13:16:16Z","isPatch":true,"sender":{"key":"fonseca@diku.dk","avatar":"https://gravatar.com/avatar/f82f3ad698717c51873b020c750a92438c820a24056dc39fe4d07baa10a92264?d=mp&s=160"},"body":"Jakub Narebski <jnareb@gmail.com> wrote Wed, May 30, 2007:\n> On Tue, 29 May 2007, Jonas Fonseca wrote:\n> > Jakub Narebski <jnareb@gmail.com> wrote Mon, May 28, 2007:\n> [...]\n> By the way, isn't Ubuntu based on Debian? Do you\n> have rpmbuild installed?\n\nYes it is Debian-based and yes I do, but I don't know if I need to do\nsomething explicitly to get it working. Mostly, prefixing things with\n'sudo' works magic on Ubuntu but not in this case. ;)\n\n> BTW. perhaps you could provide spec equivalent for building tig*.deb?\n\nWell, there already exists a Debian package for tig so it would be easy\nto lift the files required and if the Debian maintainer wanted it, sure.\nHowever, not as simple as a .spec file so it is more work to maintain.\n \n>   1000:[master!tig]$ make rpm\n\nMaybe you can test the newly released tig 0.7 tarball?\n\nYour patch was added as commit 8cdf56913e7e486bb3f527c24ee4a4d19f2a4f61,\nwith a few minor adjustments.\n \n> [...]\n> >> +%files\n> >> +%defattr(-,root,root)\n> >> +%{_bindir}/*\n> >> +%doc README COPYING INSTALL SITES BUGS TODO tigrc\n> \n> By the way, should we put tigrc in examples/tigrc, or perhaps in some\n> skeleton file?\n\nIt is mostly the default (builtin) options, so I don't see the point.\nMaybe it is time tig got a contrib area though, since I've been wanting\nto make a bash completion file. The tigrc file could go there as\ntigrc.sample or something. Could make it more obvious the intension of\nthe file?\n\n> > I don't know if manual.txt should perhaps be included if\n> > HTML and PDF files will not be generated.\n> > \n> >> +%{!?_without_docs: %{_mandir}/man1/*.1*}\n> >> +%{!?_without_docs: %{_mandir}/man5/*.5*}\n> >> +%{!?_without_docs: %doc *.html *.pdf}\n> \n> O.K. It would be as easy as %{?_without_docs: %doc *.txt}\n\nI will try to correct this together with the no-PDF doc-building.\n\n-- \nJonas Fonseca\n"},{"id":"43769","messageId":"200706011824.08148.jnareb@gmail.com","threadId":"8339","inReplyTo":"20070531131615.GA27044@diku.dk","subject":"[PATCH 1/3] Remove PDF version of manual from being build and installed","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-06-01T16:24:07Z","receivedAt":"2007-06-01T16:24:07Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Because PDF version of \"The tig Manual\" doesn't offer anything new\nthat is not present in HTML version, and building PDF requires\nadditional tools (docbook2pdf) and their dependencies present, remove\nit from tig rpm.\n\nSigned-off-by: Jakub Narebski <jnareb@gmail.com>\n---\nJakub Narebski <jnareb@gmail.com> wrote Wed, May 30, 2007:\n> On Tue, 29 May 2007, Jonas Fonseca wrote:\n>> Jakub Narebski <jnareb@gmail.com> wrote Mon, May 28, 2007:\n>>\n>>> I think we can skip generation of manual.pdf, and generate it only on\n>>> request (e.g. \"make doc-pdf\"), or using doc-man and doc-html in place\n>>> of doc in the spec file... but this is better left for the next\n>>> commit.\n>> \n>> Good idea, PDF is not essential and probably suboptimal to either of the\n>> HTML versions of the manual.\n>\n> And it is very easy to implement: just replace 'doc' in make invocation\n> in tig.spec.in by the 'doc-man doc-html'.\n\nThis patch (commit) does just that.\n\n\nOn Thu, 31 May 2007, Jonas Fonseca wrote:\n\n> I will try to correct this together with the no-PDF doc-building.\n\nI hope we didn't end up duplicating our efforts.\n\n tig.spec.in |    9 ++++++---\n 1 files changed, 6 insertions(+), 3 deletions(-)\n\ndiff --git a/tig.spec.in b/tig.spec.in\nindex 2ce6cdb..b7753fd 100644\n--- a/tig.spec.in\n+++ b/tig.spec.in\n@@ -10,7 +10,7 @@ Group: \t\tDevelopment/Tools\n Vendor: \tJonas Fonseca <fonseca@diku.dk>\n URL: \t\thttp://jonas.nitro.dk/tig/\n Source: \thttp://jonas.nitro.dk/tig/releases/%{name}-%{version}.tar.gz\n-BuildRequires: \tncurses-devel%{!?_without_docs:, xmlto, asciidoc > 6.0.3, /usr/bin/docbook2pdf}\n+BuildRequires: \tncurses-devel%{!?_without_docs:, xmlto, asciidoc > 6.0.3}\n BuildRoot: \t%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)\n Requires: \tgit-core, ncurses\n \n@@ -31,7 +31,7 @@ Using it as a pager, it will display input from stdin and colorize it.\n CFLAGS=\"$RPM_OPT_FLAGS -DVERSION=tig-%{version}-%{release}\"\n %{__make} %{_smp_mflags} \\\n \tprefix=%{_prefix} \\\n-\tall %{!?_without_docs: doc}\n+\tall %{!?_without_docs: doc-man doc-html}\n \n %install\n [ \"$RPM_BUILD_ROOT\" != \"/\" ] && rm -rf $RPM_BUILD_ROOT\n@@ -49,8 +49,11 @@ CFLAGS=\"$RPM_OPT_FLAGS -DVERSION=tig-%{version}-%{release}\"\n %doc README COPYING INSTALL SITES BUGS TODO tigrc\n %{!?_without_docs: %{_mandir}/man1/*.1*}\n %{!?_without_docs: %{_mandir}/man5/*.5*}\n-%{!?_without_docs: %doc *.html *.pdf}\n+%{!?_without_docs: %doc *.html}\n \n %changelog\n+* Fri Jun  1 2007 Jakub Narebski <jnareb@gmail.com>\n+- Remove PDF version of manual from being build and installed\n+\n * Mon May 28 2007 Jakub Narebski <jnareb@gmail.com>\n - Initial tig spec file\n-- \n1.5.2\n"},{"id":"43768","messageId":"200706011827.31337.jnareb@gmail.com","threadId":"8339","inReplyTo":"20070531131615.GA27044@diku.dk","subject":"[PATCH 2/3] Include documentation sources for rpmbuild with '--without docs'","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-06-01T16:27:30Z","receivedAt":"2007-06-01T16:27:30Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"This includes _all_ documentation sources (and not only manual.txt) in\nthe rpm file build with '--without docs' option.\n\nSigned-off-by: Jakub Narebski <jnareb@gmail.com>\n---\nJakub Narebski <jnareb@gmail.com> wrote Wed, May 30, 2007:\n> On Tue, 29 May 2007, Jonas Fonseca wrote:\n>> Jakub Narebski <jnareb@gmail.com> wrote Mon, May 28, 2007:\n\n>> I don't know if manual.txt should perhaps be included if\n>> HTML and PDF files will not be generated.\n>> \n>>> +%{!?_without_docs: %{_mandir}/man1/*.1*}\n>>> +%{!?_without_docs: %{_mandir}/man5/*.5*}\n>>> +%{!?_without_docs: %doc *.html *.pdf}\n> \n> O.K. It would be as easy as %{?_without_docs: %doc *.txt}\n\nActually it does add more than manual.txt, it adds sources for\nall tig documentation (including manpages).\n\nThis patch textually depends on earlier patch, but in fact\nthic change is independent on previous one.\n\n tig.spec.in |    4 +++-\n 1 files changed, 3 insertions(+), 1 deletions(-)\n\ndiff --git a/tig.spec.in b/tig.spec.in\nindex b7753fd..2385fb8 100644\n--- a/tig.spec.in\n+++ b/tig.spec.in\n@@ -1,5 +1,5 @@\n # -*- mode: rpm-spec-mode; encoding: utf-8; -*-\n-# Pass '--without docs' to rpmbuild if you don't want the documentation\n+# Pass '--without docs' to rpmbuild if you don't want the documentation to be build\n \n Summary: \tTig: text-mode interface for git\n Name: \t\ttig\n@@ -50,9 +50,11 @@ CFLAGS=\"$RPM_OPT_FLAGS -DVERSION=tig-%{version}-%{release}\"\n %{!?_without_docs: %{_mandir}/man1/*.1*}\n %{!?_without_docs: %{_mandir}/man5/*.5*}\n %{!?_without_docs: %doc *.html}\n+%{?_without_docs:  %doc *.txt}\n \n %changelog\n * Fri Jun  1 2007 Jakub Narebski <jnareb@gmail.com>\n+- Include documentation sources for --without docs\n - Remove PDF version of manual from being build and installed\n \n * Mon May 28 2007 Jakub Narebski <jnareb@gmail.com>\n-- \n1.5.2\n"},{"id":"43767","messageId":"200706011834.28911.jnareb@gmail.com","threadId":"8339","inReplyTo":"20070531131615.GA27044@diku.dk","subject":"[PATCH 3/3] Refresh VERSION file when building distribution tarball in \"make dist\"","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-06-01T16:34:28Z","receivedAt":"2007-06-01T16:34:28Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Overwrite contents of VERSION file from the HEAD revision with the\ncurrent version (at the time of building), so VERSION file in the\ntarball generated by \"make dist\" (and which follows also rpm package\ngenerated by \"make rpm\") is up to date.\n\nOtherwise for example when building rpm it will be compiled with wrong\nversion string.\n\nSigned-off-by: Jakub Narebski <jnareb@gmail.com>\n---\nOn Thu, 31 May 2007, Jonas Fonseca wrote:\n\n> Maybe you can test the newly released tig 0.7 tarball?\n> \n> Your patch was added as commit 8cdf56913e7e486bb3f527c24ee4a4d19f2a4f61,\n> with a few minor adjustments.\n\nOne of those changes was using HEAD version of VERSION file in\n\"make dist\", instead of regenerating it and replacing it with the one\ncontaining _current_ version in the tar file.\n\n$ make rpm\nsed -e 's/@@VERSION@@/0.7.4.g1995120/g' < tig.spec.in > tig.spec\ngit-archive --format=tar --prefix=tig-0.7.4.g1995120/ HEAD > tig-0.7.4.g1995120.tar\ntar rf tig-0.7.4.g1995120.tar tig-0.7.4.g1995120/tig.spec\ngzip -f -9 tig-0.7.4.g1995120.tar\nrpmbuild -ta tig-0.7.4.g1995120.tar.gz\nExecuting(%prep): /bin/sh -e /var/tmp/rpm-tmp.72336\nExecuting(%build): /bin/sh -e /var/tmp/rpm-tmp.72336\nmake[1]: Entering directory `/home/local/builddir/BUILD/tig-0.7.4.g1995120'\ncc -Wall -O2 '-DVERSION=\"0.7.git\"'    tig.c  -lcurses -o tig\nasciidoc -b docbook -d manpage -aversion=0.7.git tig.1.txt\nxmlto -m manpage.xsl man tig.1.xml\n[...]\n\nNote the mismatch in the versions: 0.7.4.g1995120 vs 0.7.git\n(by the way, shouldn't it be 0.7.tig?), even when building from live\nrepo, and not from tarball.\n\n\nThis is 3rd patch in the series, but it is actually independent on\nthe rest, and can be applied in any order.\n\n Makefile |    5 ++++-\n 1 files changed, 4 insertions(+), 1 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 0e42de6..bc8086f 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -76,7 +76,10 @@ dist: tig.spec\n \tgit-archive --format=tar --prefix=$(TARNAME)/ HEAD > $(TARNAME).tar\n \t@mkdir -p $(TARNAME)\n \t@cp tig.spec $(TARNAME)\n-\ttar rf $(TARNAME).tar $(TARNAME)/tig.spec\n+\techo $(VERSION) > $(TARNAME)/VERSION\n+\ttar rf $(TARNAME).tar \\\n+\t       $(TARNAME)/tig.spec \\\n+\t       $(TARNAME)/VERSION\n \t@rm -rf $(TARNAME)\n \tgzip -f -9 $(TARNAME).tar\n \n-- \n1.5.2\n"},{"id":"43808","messageId":"20070602160816.GA13957@diku.dk","threadId":"8339","inReplyTo":"200706011824.08148.jnareb@gmail.com","subject":"Re: [PATCH 1/3] Remove PDF version of manual from being build and installed","fromName":"Jonas Fonseca","fromEmail":"fonseca@diku.dk","sentAt":"2007-06-02T16:08:16Z","receivedAt":"2007-06-02T16:08:16Z","isPatch":true,"sender":{"key":"fonseca@diku.dk","avatar":"https://gravatar.com/avatar/f82f3ad698717c51873b020c750a92438c820a24056dc39fe4d07baa10a92264?d=mp&s=160"},"body":"Jakub Narebski <jnareb@gmail.com> wrote Fri, Jun 01, 2007:\n> [...] \n> On Thu, 31 May 2007, Jonas Fonseca wrote:\n> > I will try to correct this together with the no-PDF doc-building.\n> \n> I hope we didn't end up duplicating our efforts.\n\nNope, it didn't. Again, thanks for doing this!\n\n-- \nJonas Fonseca\n"},{"id":"43809","messageId":"20070602161236.GB13957@diku.dk","threadId":"8339","inReplyTo":"200706011834.28911.jnareb@gmail.com","subject":"Re: [PATCH 3/3] Refresh VERSION file when building distribution tarball in \"make dist\"","fromName":"Jonas Fonseca","fromEmail":"fonseca@diku.dk","sentAt":"2007-06-02T16:12:36Z","receivedAt":"2007-06-02T16:12:36Z","isPatch":true,"sender":{"key":"fonseca@diku.dk","avatar":"https://gravatar.com/avatar/f82f3ad698717c51873b020c750a92438c820a24056dc39fe4d07baa10a92264?d=mp&s=160"},"body":"Jakub Narebski <jnareb@gmail.com> wrote Fri, Jun 01, 2007:\n> On Thu, 31 May 2007, Jonas Fonseca wrote:\n> \n> > Maybe you can test the newly released tig 0.7 tarball?\n> > \n> > Your patch was added as commit 8cdf56913e7e486bb3f527c24ee4a4d19f2a4f61,\n> > with a few minor adjustments.\n> \n> One of those changes was using HEAD version of VERSION file in\n> \"make dist\", instead of regenerating it and replacing it with the one\n> containing _current_ version in the tar file.\n> \n> $ make rpm\n> sed -e 's/@@VERSION@@/0.7.4.g1995120/g' < tig.spec.in > tig.spec\n> git-archive --format=tar --prefix=tig-0.7.4.g1995120/ HEAD > tig-0.7.4.g1995120.tar\n> tar rf tig-0.7.4.g1995120.tar tig-0.7.4.g1995120/tig.spec\n> gzip -f -9 tig-0.7.4.g1995120.tar\n> rpmbuild -ta tig-0.7.4.g1995120.tar.gz\n> Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.72336\n> Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.72336\n> make[1]: Entering directory `/home/local/builddir/BUILD/tig-0.7.4.g1995120'\n> cc -Wall -O2 '-DVERSION=\"0.7.git\"'    tig.c  -lcurses -o tig\n> asciidoc -b docbook -d manpage -aversion=0.7.git tig.1.txt\n> xmlto -m manpage.xsl man tig.1.xml\n> [...]\n> \n> Note the mismatch in the versions: 0.7.4.g1995120 vs 0.7.git\n> (by the way, shouldn't it be 0.7.tig?), even when building from live\n> repo, and not from tarball.\n\nGah, somehow I didn't realize the problems of not updating the VERSION\nfile. Beautiful, so now it should actually work even for non-RPM builds\nusing the 'make dist' result. :)\n\n-- \nJonas Fonseca\n"},{"id":"43833","messageId":"200706021952.28426.jnareb@gmail.com","threadId":"8339","inReplyTo":"20070531131615.GA27044@diku.dk","subject":"[RFC/PATCH 4/3] Simplify naming (versioning) of non-release tig tarball and rpm file","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-06-02T17:52:28Z","receivedAt":"2007-06-02T17:52:28Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Use the tag part of git-describe output, with `tig-' prefix stripped\noff, as version number. Use number of commits since given tag as\nrelease number, using 0 if we are at tagged version, and adding\n'.dirty' suffix if working directory is dirty. Do not use 'g<sha 1>'\npart of git-describe output.\n\nFor example, when git-describe output was tig-0.7-8-g26d0386, before\nthis commit tarball was named tig-0.7.8.g26d0386.tar.gz and rpm was\nnamed tig-0.7.8.g26d0386-1.src.rpm (for dirty tree tarball was\ntig-0.7.8.g26d0386.dirty.tar.gz), now tarball is named\ntig-0.7-8.tar.gz and rpm is named tig-0.7-8.src.rpm (for dirty tree\ntarball is tig-0.7-8.dirty.tar.gz).\n\nSigned-off-by: Jakub Narebski <jnareb@gmail.com>\n---\nThis is proposal to simplify naming of non-release tarballs and rpm file,\nboth for tig and also for git itself. Instead of using whole git-describe\noutput as version number in tarball/rpm name (BTW. it would be nice to\nhave command line switch to git-describe which would return old output,\nwithout number of commits since given tag) use tag part as version number,\nand number of commits since (plus optional marking dirty) as release\nnumber.\n\nWhat do you think about this?\n\n Makefile    |   13 ++++++++++---\n tig.spec.in |    2 +-\n 2 files changed, 11 insertions(+), 4 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex b49d7f8..1e67586 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -17,7 +17,13 @@ ifdef DIST_VERSION\n VERSION\t= $(DIST_VERSION)\n endif\n \n-RPM_VERSION = $(subst -,.,$(VERSION))\n+# $(GITDESC) looks like either x.y, or like x.y-z-g<sha1>\n+SPLIT_VERSION := $(shell echo $(GITDESC) | \\\n+                   sed -e 's/^\\(.*\\)-\\([0-9]\\+\\)-\\(g[0-9a-f]\\+\\)$$/\\1 \\2 \\3/g')\n+RPM_VERSION = $(subst -,.,$(word 1,$(SPLIT_VERSION)))\n+RPM_RELEASE = $(strip \\\n+              $(subst -,.,$(if $(word 2,$(SPLIT_VERSION)),\\\n+                               $(word 2,$(SPLIT_VERSION)),0)$(WTDIRTY)))\n \n LDLIBS\t= -lcurses\n CFLAGS\t= -Wall -O2 '-DVERSION=\"$(VERSION)\"'\n@@ -26,7 +32,7 @@ PROGS\t= tig\n MANDOC\t= tig.1 tigrc.5\n HTMLDOC\t= tig.1.html tigrc.5.html manual.html README.html\n ALLDOC\t= $(MANDOC) $(HTMLDOC) manual.html-chunked manual.pdf\n-TARNAME\t= tig-$(RPM_VERSION)\n+TARNAME\t= tig-$(RPM_VERSION)-$(RPM_RELEASE)\n \n all: $(PROGS)\n all-debug: $(PROGS)\n@@ -104,7 +110,8 @@ release-dist: release-doc\n \tinstall-doc-man install-doc-html clean spell-check dist rpm\n \n tig.spec: tig.spec.in\n-\tsed -e 's/@@VERSION@@/$(RPM_VERSION)/g' < $< > $@\n+\tsed -e 's/@@VERSION@@/$(RPM_VERSION)/g' \\\n+\t    -e 's/@@RELEASE@@/$(RPM_RELEASE)/g' < $< > $@\n \n tig: tig.c\n \ndiff --git a/tig.spec.in b/tig.spec.in\nindex 2385fb8..8606b23 100644\n--- a/tig.spec.in\n+++ b/tig.spec.in\n@@ -4,7 +4,7 @@\n Summary: \tTig: text-mode interface for git\n Name: \t\ttig\n Version: \t@@VERSION@@\n-Release: \t1%{?dist}\n+Release: \t@@RELEASE@@%{?dist}\n License: \tGPL\n Group: \t\tDevelopment/Tools\n Vendor: \tJonas Fonseca <fonseca@diku.dk>\n-- \n1.5.2\n"},{"id":"43854","messageId":"20070603091126.GA1419@diku.dk","threadId":"8339","inReplyTo":"200706021952.28426.jnareb@gmail.com","subject":"Re: [RFC/PATCH 4/3] Simplify naming (versioning) of non-release tig tarball and rpm file","fromName":"Jonas Fonseca","fromEmail":"fonseca@diku.dk","sentAt":"2007-06-03T09:11:26Z","receivedAt":"2007-06-03T09:11:26Z","isPatch":true,"sender":{"key":"fonseca@diku.dk","avatar":"https://gravatar.com/avatar/f82f3ad698717c51873b020c750a92438c820a24056dc39fe4d07baa10a92264?d=mp&s=160"},"body":"Jakub Narebski <jnareb@gmail.com> wrote Sat, Jun 02, 2007:\n> This is proposal to simplify naming of non-release tarballs and rpm file,\n> both for tig and also for git itself. Instead of using whole git-describe\n> output as version number in tarball/rpm name (BTW. it would be nice to\n> have command line switch to git-describe which would return old output,\n> without number of commits since given tag) use tag part as version number,\n> and number of commits since (plus optional marking dirty) as release\n> number.\n> \n> What do you think about this?\n\nI like the simpler and less confusing names. How about the simpler\nversion below?\n\nBTW, I also added `make dist DIST_VERSION=X.Y` to make it easy to force\na version. I used it when building the documentation in the release\nbranch.\n\n> diff --git a/Makefile b/Makefile\n> index b49d7f8..1e67586 100644\n> --- a/Makefile\n> +++ b/Makefile\n> @@ -17,7 +17,13 @@ ifdef DIST_VERSION\n>  VERSION\t= $(DIST_VERSION)\n>  endif\n>  \n> -RPM_VERSION = $(subst -,.,$(VERSION))\n> +# $(GITDESC) looks like either x.y, or like x.y-z-g<sha1>\n> +SPLIT_VERSION := $(shell echo $(GITDESC) | \\\n> +                   sed -e 's/^\\(.*\\)-\\([0-9]\\+\\)-\\(g[0-9a-f]\\+\\)$$/\\1 \\2 \\3/g')\n> +RPM_VERSION = $(subst -,.,$(word 1,$(SPLIT_VERSION)))\n> +RPM_RELEASE = $(strip \\\n> +              $(subst -,.,$(if $(word 2,$(SPLIT_VERSION)),\\\n> +                               $(word 2,$(SPLIT_VERSION)),0)$(WTDIRTY)))\n>  \n>  LDLIBS\t= -lcurses\n>  CFLAGS\t= -Wall -O2 '-DVERSION=\"$(VERSION)\"'\n\ndiff --git a/Makefile b/Makefile\nindex 91cb097..622a916 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -17,7 +17,11 @@ ifdef DIST_VERSION\n VERSION = $(DIST_VERSION)\n endif\n \n-RPM_VERSION = $(subst -,.,$(VERSION))\n+# Split the version \"TAG-OFFSET-gSHA1-DIRTY\" into \"TAG OFFSET\"\n+# and append 0 as a fallback offset for \"exact\" tagged versions.\n+RPM_VERLIST = $(filter-out g% dirty,$(subst -, ,$(VERSION))) 0\n+RPM_VERSION = $(word 1,$(RPM_VERLIST))\n+RPM_RELEASE = $(word 2,$(RPM_VERLIST))$(if $(WTDIRTY),.dirty)\n \n LDLIBS\t= -lcurses\n CFLAGS\t= -Wall -O2\n\n-- \nJonas Fonseca\n"},{"id":"43925","messageId":"200706032312.59756.jnareb@gmail.com","threadId":"8339","inReplyTo":"20070603091126.GA1419@diku.dk","subject":"Re: [RFC/PATCH 4/3] Simplify naming (versioning) of non-release tig tarball and rpm file","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-06-03T21:12:59Z","receivedAt":"2007-06-03T21:12:59Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"On Sun, 3 Jun 2007, Jonas Fonseca wrote:\n> Jakub Narebski <jnareb@gmail.com> wrote Sat, Jun 02, 2007:\n\n>> This is proposal to simplify naming of non-release tarballs and rpm file,\n>> both for tig and also for git itself. Instead of using whole git-describe\n>> output as version number in tarball/rpm name (BTW. it would be nice to\n>> have command line switch to git-describe which would return old output,\n>> without number of commits since given tag) use tag part as version number,\n>> and number of commits since (plus optional marking dirty) as release\n>> number.\n>> \n>> What do you think about this?\n> \n> I like the simpler and less confusing names. How about the simpler\n> version below?\n\nThis version would work for tig now, but is not very generic. See also\ncomments below.\n\n> BTW, I also added `make dist DIST_VERSION=X.Y` to make it easy to force\n> a version. I used it when building the documentation in the release\n> branch.\n\nNice idea.\n \n>> diff --git a/Makefile b/Makefile\n>> index b49d7f8..1e67586 100644\n>> --- a/Makefile\n>> +++ b/Makefile\n>> @@ -17,7 +17,13 @@ ifdef DIST_VERSION\n>>  VERSION\t= $(DIST_VERSION)\n>>  endif\n>>  \n>> -RPM_VERSION = $(subst -,.,$(VERSION))\n>> +# $(GITDESC) looks like either x.y, or like x.y-z-g<sha1>\n>> +SPLIT_VERSION := $(shell echo $(GITDESC) | \\\n>> +                   sed -e 's/^\\(.*\\)-\\([0-9]\\+\\)-\\(g[0-9a-f]\\+\\)$$/\\1 \\2 \\3/g')\n>> +RPM_VERSION = $(subst -,.,$(word 1,$(SPLIT_VERSION)))\n>> +RPM_RELEASE = $(strip \\\n>> +              $(subst -,.,$(if $(word 2,$(SPLIT_VERSION)),\\\n>> +                               $(word 2,$(SPLIT_VERSION)),0)$(WTDIRTY)))\n>>  \n>>  LDLIBS\t= -lcurses\n>>  CFLAGS\t= -Wall -O2 '-DVERSION=\"$(VERSION)\"'\n> \n> diff --git a/Makefile b/Makefile\n> index 91cb097..622a916 100644\n> --- a/Makefile\n> +++ b/Makefile\n> @@ -17,7 +17,11 @@ ifdef DIST_VERSION\n>  VERSION = $(DIST_VERSION)\n>  endif\n>  \n> -RPM_VERSION = $(subst -,.,$(VERSION))\n> +# Split the version \"TAG-OFFSET-gSHA1-DIRTY\" into \"TAG OFFSET\"\n> +# and append 0 as a fallback offset for \"exact\" tagged versions.\n> +RPM_VERLIST = $(filter-out g% dirty,$(subst -, ,$(VERSION))) 0\n> +RPM_VERSION = $(word 1,$(RPM_VERLIST))\n> +RPM_RELEASE = $(word 2,$(RPM_VERLIST))$(if $(WTDIRTY),.dirty)\n>  \n>  LDLIBS\t= -lcurses\n>  CFLAGS\t= -Wall -O2\n\nI'd like to note that I wanted to make _generic_ version of generating\nRPM_VERSION and RPM_RELEASE from the output of git-describe (also with\nmarking that working directory was in dirty state). Your simpler version\nworks for tags used in tig repository, but for example not necessarily\nso for git repository.\n\n\nI assume that \"version tags\" are of the form\n\n  [<prefix>]<version>\n\nwhere optional <prefix> is \"v\" for git and linux repositories, \"tig-\"\nfor tig repository, \"gitgui-\" for git-gui repository. <version> starts\nwith a number, and usually consists of numbers separated by dots, but\nit can contain also alphanumeric suffix, for example \"-rc1\", \"-pre7\",\n\"b\" (c.f. v0.99.9b tag in git repository), etc. I assume that <version>\nis the part that starts with the number.\n\nThis means that git-describe output is either of the form\n\n  [<prefix>]<version>\n\n(if there is exact match), or of the form\n\n  [<prefix>]<version>-<number of additional commits>-g<abbreviated sha-1>\n\n\nFor exact match (release tarball) I'd like to have\n\n  RPM_VERSION = $(subst -,.,<version>)\n  RPM_RELEASE = 0\n\nand for non-exact match to have\n\n  RPM_VERSION = $(subst -,.,<version>)\n  RPM_RELEASE = <number of additional commits>.g<abbreviated sha-1>\n\nThe \"g<abbreviated sha-1>\", which was missing from my (and yours)\nproposal is needed because we can have multiple branches, and the\npart before \"-g<abbreviated sha-1>\" could be the same for different\ncommits (on different branches, e.g. 'master' and 'next').\n\nFor \"make dist\" run from a dirty tree we want to have \".dirty\" suffix\nadded to RPM_RELEASE.\n\nExample: if git-describe returns v1.4.3-rc2-21-g0a7a9a1 in a dirty tree\n(with uncommitted changes) I'd like to have 1.4.3.rc2 as version number\nand 21.g0a7a9a1.dirty as release number, so tarball would be named\ngit-1.4.3.rc2-21.g0a7a9a1.dirty.tar.gz\n\n\nNow to the implementation. I wanted to do the above using only Makefile\nfunctions, if not for two complications. First I didn't know how to\nget second-to-last word, or how to remove last word from variable;\ntrick with filter-out could work there. Second in generic version is\nquite hard to distinguish using only make functions between exact and\nnon-exact match for arbitrary versioning (tagging versions) scheme.\n\n\nP.S. Perhaps instead of RPM_VERSION we should (re)use DIST_VERSION,\nand instead of RPM_RELEASE use DIST_RELEASE?\n\n-- \nJakub Narebski\nPoland\n"}]}