I recently updated the topgit rpm package from opensuse such that it works with centos/scientificlinux. To do this, I needed to get the version numbers and export a tree of files for my tarball and spec file.
I cloned the topgit git repo, and inside the repo i did the following
[jtang@duo topgit]$ git archive --prefix topgit/ HEAD --output $(git describe).tar
or alternatively
[jtang@duo topgit]$ git archive --prefix topgit/ HEAD | bzip2 > $(git describe).tar.bz2
which should give you either
topgit-0.7-17-g78e14da.tar
or
topgit-0.7-17-g78e14da.tar.bz2
These are really just notes for myself since I keep forgetting these little magic commands. In the process of doing this, I also found that the default behaviour of git tag doesn't do what I expect, especially after reading this post http://www.rockstarprogrammer.org/post/2008/oct/16/git-tag-does-wrong-thing-default/
This should do the right thing
git tag -a TAGNAME
or
git tag -s TAGNAME
The above two should make git describe and its friends happy, but the following doesn't quite do what you would expect
git tag TAGNAME
It's probably also useful to find out the changes made between the tags and or HEAD of the repo, doing the following will give you some nicely formatted change log
[jtang@duo topgit]$ git rev-list --pretty=short "topgit-0.7..HEAD" | git shortlog
It's all useful stuff if want to use tags in your own git repo.
Here's the spec file
#
# spec file for package topgit (Version 0.5)
#
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# norootforbuild
%define checkout_version 0.7-17-g78e14da
Name: topgit
BuildRequires: sed
Version: 0.7
Release: 2
Summary: TopGit - A different patch queue manager
License: GPL v2
Group: Development/Tools/Version Control
Url: http://git.or.cz
Source0: topgit-%{checkout_version}.tar.bz2
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Requires: git-core
Requires: coreutils
Requires: /bin/sed /bin/grep /bin/awk
BuildArch: noarch
%description
TopGit aims to make handling of large amount of interdependent topic
branches easier. In fact, it is designed especially for the case
when you maintain a queue of third-party patches on top of another
(perhaps Git-controlled) project and want to easily organize, maintain
and submit them - TopGit achieves that by keeping a separate topic
branch for each patch and providing few tools to maintain the branches.
%prep
%setup -q -n topgit
%build
make prefix=%{_prefix} \
mandir=%{_mandir} \
cmddir=%{_prefix}/lib/topgit \
sharedir=%{_datadir}/topgit
%install
make install \
prefix=%{_prefix} \
mandir=%{_mandir} \
cmddir=%{_prefix}/lib/topgit \
sharedir=%{_datadir}/topgit \
DESTDIR=$RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/etc/bash_completion.d
install -c -m 0644 contrib/tg-completion.bash $RPM_BUILD_ROOT/etc/bash_completion.d/tg-completion.sh
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
%doc README
%{_bindir}/*
%{_prefix}/lib/topgit
%{_datadir}/topgit
/etc/bash_completion.d/*
%changelog
* Thu May 28 2009 jtang@tchpc.tcd.ie 0.7-2
- update to 0.7-17-g78e14da
* Mon Mar 9 2009 jtang@tchpc.tcd.ie 0.7-1
- update to 0.7-3-gd145a7b8
- made spec file work on centos5 based systems
* Thu Dec 18 2008 tiwai@suse.de
- updated to HEAD a062d4f8ef8e7d3174b5a572e1002b6c4b2273e7
* Change tg help exit code to 0
* Check for cmddir earlier
* Print help output when no command is given
* Require an argument to tg -r
* Print help message when command is not proper
* Note that do_help is used when short messages might be wanted
* Add Vim modelines for consistent spacing
* Pass -- to rev-list for branch/filename disambiguation
* tg-export: implement skipping empty patches for quilt mode
* tg-summary: -t and --graphviz are mutual exclusive
* README: spelling fixes
* Wed Nov 19 2008 tiwai@suse.de
- updated to version 0.5
as of HEAD 9f5917da92ab8c32ab765a331ebcaf227b3e2f85
* Mon Sep 29 2008 tiwai@suse.de
- updated to version 0.4
* Wed Sep 10 2008 tiwai@suse.de
- updated to version 0.3
* Tue Sep 9 2008 tiwai@suse.de
- initial version