fedora cvs->git package metadata conversion available

Lennert Buytenhek buytenh at wantstofly.org
Thu Dec 6 02:20:53 UTC 2007


Hi all,

For some time now, I've been working on a git conversion of the
Fedora package metadata (which lives in CVS.)  I've made the results
of that effort available via git:// at:

	git://fedora.gitbits.net/$pkgname

And also via gitweb at:

	http://fedora.gitbits.net/

Since there are so many packages, only the ones starting with [0-9a]
are displayed on the gitweb front page.  All other packages' gitwebs
can be accessed at URLs with the following format:

	http://fedora.gitbits.net/?p=$pkgname;a=summary


There are two basic reasons why I've been working on this.

0. [ It provides a nice (changeset-based rather than per-file) way
     of viewing package history, and a couple of other nice features
     (see below.)    ]

1. I have a need to maintain a set of patches to Fedora packages
   (for adding support for things such as cross-compilation) that
   will likely not soon or not ever be merged back into Fedora.
   To me, the most natural and easiest way of maintaining patches
   of that nature is to maintain them in a VCS that understands
   distributed operation and remote branches.

2. Over time, I would like to see the possibility for Fedora package
   metadata to be maintained in something other than CVS.  I see this
   cvs->git conversion as a proof of concept, a way of allowing
   packagers to experiment with and gradually become familiar with a
   distributed VCS, and a way of demonstrating the advantages of this
   approach.


Even if you are not interested in switching to a distributed VCS,
and would like to keep maintaining your package with CVS, there are
a couple of nice things you can do with this:

- View package history as a series of commits:

	http://fedora.gitbits.net/?p=rpm;a=shortlog;h=devel

- Viewing package history graphically:

	$ git clone git://fedora.gitbits.net/rpm
	$ cd rpm/
	$ gitk origin/F-7 origin/F-8 origin/devel

  This gives you something a la (slightly outdated):

	http://www.wantstofly.org/~buytenh/fedora-git-rpm.png

- Easily extract any random version of any package's metadata as
  a tar archive:

	$ git-archive --remote=git://fedora.gitbits.net/rpm rpm-4_4_2-14 > rpm-4_4_2-14.tar


An example package maintainer workflow looks something like this:

- Clone fedora rpm package:

	$ git clone git://fedora.gitbits.net/rpm
	Initialized empty Git repository in /home/buytenh/test/rpm/.git/
	remote: Generating pack...
	remote: Done counting 1399 objects.
	remote: Deltifying 1399 objects...
	remote:  100% (1399/1399) done
	Indexing 1399 objects...
	remote: Total 1399 (delta 477), reused 1399 (delta 477)
	 100% (1399/1399) done
	Resolving 477 deltas...
	 100% (477/477) done
	$

  (Note that at this point, you have a full copy of the package
  history on your local disk.)

- Create your own branch based on the rawhide branch:

	$ cd rpm
	$ git-checkout -b mybranch origin/devel
	warning: You appear to be on a branch yet to be born.
	warning: Forcing checkout of origin/devel.
	Switched to a new branch "mybranch"
	$ 

- Make some local modification (e.g. require a newer version of patch):

	$ vi rpm.spec
	$ git diff
	diff --git a/rpm.spec b/rpm.spec
	index 3495e8a..ab289b2 100644
	--- a/rpm.spec
	+++ b/rpm.spec
	@@ -6,7 +6,7 @@
	 Summary: The RPM package management system
	 Name: rpm
	 Version: 4.4.2.2
	-Release: 11%{?dist}
	+Release: 12%{?dist}
	 Group: System Environment/Base
	 Url: http://www.rpm.org/
	 Source: http://rpm.org/releases/rpm-4.4.x/%{name}-%{version}.tar.gz
	@@ -107,7 +107,7 @@ Summary: Scripts and executable programs used to build packa
	 Group: Development/Tools
	 Requires: rpm = %{version}-%{release}
	 Requires: elfutils >= 0.128 binutils
	-Requires: findutils sed grep gawk diffutils file patch >= 2.5
	+Requires: findutils sed grep gawk diffutils file patch >= 4.5
	 Requires: zip gzip bzip2 cpio
	 
	 %description build
	$

- Commit changes to local branch:

	$ git add rpm.spec
	$ git commit
	Created commit bcd347c: Yo ho ho.
	 1 files changed, 2 insertions(+), 2 deletions(-)
	$

- Build SRPM from local branch (e.g. to build in mock):

	$ build-srpm
	01:26:54 URL:http://cvs.fedora.redhat.com/repo/pkgs/rpm/rpm-4.4.2.2.tar.gz/15faa7ebd9791ade1a2f8181821ac259/rpm-4.4.2.2.tar.gz [11031970/11031970] -> "rpm-4.4.2.2.tar.gz" [1]
	Wrote: /home/buytenh/test/rpm/rpm-4.4.2.2-12.src.rpm
	$ 

- Decide that your modifications were crap, and throw everything
  you've done so far away and start from a fresh rawhide checkout:

	$ git-checkout -b mybranch2 origin/devel
	Switched to a new branch "mybranch2"
	$ git-branch -D mybranch
	Deleted branch mybranch.
	$

- Once you're happy with the result, generate a set of patches to
  commit back into the CVS tree:

	$ git-format-patch origin/devel
	0001-Yo-ho-ho.patch
	$ 

(If the Fedora CVS server is ever switched over to git, all of the
above steps would still look the same, except the last one
(committing your changes back to the server), which would become a
call to 'git-push'.)


Since the git conversion is currently hosted on my ADSL line, please
don't hammer it too hard -- although the git protocol _is_ pretty
efficient, and the size of the entire set of git repositories is only
about 550 megabytes and fits nicely in the RAM of the server it runs
on, there's only about one megabit/s of upstream bandwidth available.

Feedback appreciated!


thanks,
Lennert




More information about the fedora-devel-list mailing list