I'm a member of the OpenVZ Project community and I've been involved with building OS Templates of various Linux distributions. Why do I mention this and how is it relevant? Because building an OpenVZ OS Template is similar to building a customer spin of a distro. Stick with me for a few paragraphs.
A fellow by the name of Robert Nelson took a package from Debian named apt-cacher and rewrote it to be more general purpose for use with OpenVZ vzpkgcache. vzpkgcache is a utility that uses an OS Template Metadata package to build an OS Template. What's a metadata package? Basically it is a small package that contains information about three things:
1) Where on the internet are the package repositories found for whatever distro you are working with - for example the metadata package for Fedora includes information about repos for Fedora 7, 8, 9 and 10... for i386 and x86_64
2) What packages you to make up your OS Template - for example there are definitions for "small", "minimal" and "default". These definitions are just text files with a list of desired packages
3) A list of OpenVZ dummy packages that replace distro specific packages for the small handful of packages that aren't compatible with OpenVZ. For example, udev didn't work well in a container so there is often a dummy package to replace it named vzdev
pkg-cacher is used as a general purpose package caching system for use with vzpkgcache. It runs on a port of your choosing and after setup it can grab packages needed for building CentOS, Debian, Fedora and Ubuntu.
Not only can pkg-cacher be used for building OS Templates with vzpkgcache... it can also be used by package managers (yum and apt-get) on client machines and/or OpenVZ containers. The package caching system will appear to be a local repo copy when in reality if it doesn't already have the package you are looking for it'll grab it on demand. OS Templates made with Robert's modified vzpkgcache are configured to use the package caching system... so when you create a container from the OS Template, it'll use the cache. This works with CentOS, Debian, Fedora, and Ubuntu clients. He moves existing repo definitions (.repos and source.lists) to .disabled and supplies a new repo definition that refers to the caching systems simulated repos.
I'm thinking that pkg-cacher could be used for what you want and if not, it could be modified to do what you want. I think pkg-cacher is a package that a lot of Fedora and CentOS users would be interested in. Anyone who rsyncs one or more distro mirrors for local use would love to be able to replace a full copy of the mirror with a smart caching system like pkg-cacher. Considering the huge size of some distros these days (all of Fedora 10 is between 11,500 [i386] and 14,500 [x86_64] packages), I'm surprised everyone isn't using pkg-cacher.
You can find its homepage here:http://gforge.opensource-sw.net/projects/pkg_cacher/
You can Fedora 10 packages for it here:http://repo.opensource-sw.net/fedora/10/i386/
pkg-cacher has made it really easy to build over 54 different OS Templates for OpenVZ. For a screencast on it, see:http://montanalinux.org/vzpkg2-screencast.html
If you have any questions, feel free to email me.
704 Church Street
Belgrade, MT 59714