All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonas Fonseca <fonseca@diku.dk>
To: Jakub Narebski <jnareb@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH (tig)] Infrastructure for tig rpm builds.
Date: Tue, 29 May 2007 22:29:23 +0200	[thread overview]
Message-ID: <20070529202923.GA6358@diku.dk> (raw)
In-Reply-To: <200705281054.05376.jnareb@gmail.com>

Hej Jakub,

Jakub Narebski <jnareb@gmail.com> wrote Mon, May 28, 2007:
> 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.

Thank you. :)

> 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.

> 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.

> Signed-off-by: Jakub Narebski <jnareb@gmail.com>
> ---
> '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. ;)
 
> 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.

> 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.

Looks like some problems with the SGML catalogs info.
 
>   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.

Good idea, PDF is not essential and probably suboptimal to either of the
HTML versions of the manual.

> 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.

>  .gitignore  |    2 ++
>  Makefile    |   34 ++++++++++++++++++++++++++++++++--
>  tig.spec.in |   56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 90 insertions(+), 2 deletions(-)
>  create mode 100644 tig.spec.in
> 
> diff --git a/.gitignore b/.gitignore
> index 8f6aa93..f7ab840 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -2,3 +2,5 @@ manual.html-chunked
>  manual.pdf
>  manual.toc
>  tig
> +tig.spec
> +tig-*.tar.gz
> diff --git a/Makefile b/Makefile
> index 06a5d6a..45c833b 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -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))

I will probably try to simplify and clean this up a bit. 

> +
> +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

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?

> +rpm: dist
> +	rpmbuild -ta $(TARNAME).tar.gz
> diff --git a/tig.spec.in b/tig.spec.in
> new file mode 100644
> index 0000000..2ce6cdb
> --- /dev/null
> +++ b/tig.spec.in
> @@ -0,0 +1,56 @@
> +# -*- mode: rpm-spec-mode; encoding: utf-8; -*-
> +# Pass '--without docs' to rpmbuild if you don't want the documentation
> +
> +Summary: 	Tig: text-mode interface for git
> +Name: 		tig
> +Version: 	@@VERSION@@
> +Release: 	1%{?dist}
> +License: 	GPL
> +Group: 		Development/Tools
> +Vendor: 	Jonas Fonseca <fonseca@diku.dk>
> +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?

> +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 \
> +	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.

> +%{!?_without_docs: %{_mandir}/man1/*.1*}
> +%{!?_without_docs: %{_mandir}/man5/*.5*}
> +%{!?_without_docs: %doc *.html *.pdf}
> +
> +%changelog
> +* Mon May 28 2007 Jakub Narebski <jnareb@gmail.com>
> +- Initial tig spec file

-- 
Jonas Fonseca

  reply	other threads:[~2007-05-29 20:29 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-28  8:54 [PATCH (tig)] Infrastructure for tig rpm builds Jakub Narebski
2007-05-29 20:29 ` Jonas Fonseca [this message]
2007-05-29 23:31   ` Jakub Narebski
2007-05-31 13:16     ` Jonas Fonseca
2007-06-01 16:24       ` [PATCH 1/3] Remove PDF version of manual from being build and installed Jakub Narebski
2007-06-02 16:08         ` Jonas Fonseca
2007-06-01 16:27       ` [PATCH 2/3] Include documentation sources for rpmbuild with '--without docs' Jakub Narebski
2007-06-01 16:34       ` [PATCH 3/3] Refresh VERSION file when building distribution tarball in "make dist" Jakub Narebski
2007-06-02 16:12         ` Jonas Fonseca
2007-06-02 17:52       ` [RFC/PATCH 4/3] Simplify naming (versioning) of non-release tig tarball and rpm file Jakub Narebski
2007-06-03  9:11         ` Jonas Fonseca
2007-06-03 21:12           ` Jakub Narebski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070529202923.GA6358@diku.dk \
    --to=fonseca@diku.dk \
    --cc=git@vger.kernel.org \
    --cc=jnareb@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.