The current Portage Tree is over several hundret megabytes in size, so syncing, especially with a low-speed internet connections takes forever.

A solution would be, to reduce your Portage Tree. With rsync_excludes you cann tell portage to only copy ebuilds for packages which are installed on your system. So, here's what we do.

Install Gentoolkit

The gentoolkit package is a prerequisite. Install it.

emerge gentoolkit -av

Now we have to edit our /etc/make.conf file. We're loocking for PORTAGE_RSYNC_EXTRA_OPTS and modify it:

# PORTAGE_RSYNC_EXTRA_OPTS can be used to feed additional options to the rsync
#     command used by `emerge --sync`. This will not change the default options
#     which are set by PORTAGE_RSYNC_OPTS (don't change those unless you know
#     exactly what you're doing).
PORTAGE_RSYNC_EXTRA_OPTS="--exclude-from=/etc/portage/rsync_excludes
 --delete-excluded --delete-before"

Save and close your editor

DamnSmallPortage Script

The next step is to create a adapted version of our /etc/portage/rsync_excludes. To do this, we use our little script:

nano /root/damnsmallportage.sh
Copy&Paste:
#!/bin/sh
#
#    Copyright (c) 2006-2007 by Michael Hampicke
#    This program is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

if [ ! -f /usr/bin/equery ]
  then
    /bin/echo "/usr/bin/equery does NOT exist!"
    /bin/echo " Please emerge app-portage/gentoolkit"
    exit 1
fi

/bin/echo ""
/bin/echo "creating list of installed packages..."

/usr/bin/equery list | \
  /bin/sed -e 's/-[0-9].*$//' \
           -e '/* installed packages/d' \
> .damnsmallportage.tmp

/bin/echo "building rsync_excludes..."

cat .damnsmallportage.tmp | sed -e 's/^/+ /' > rsync_excludes

/bin/echo "- /*-*/*" >> rsync_excludes

cat .damnsmallportage.tmp | \
  sed -e 's/^/+ metadata\/cache\//' \
      -e 's/$/*/' \
>> rsync_excludes

/bin/echo "- licenses**"          >> rsync_excludes
/bin/echo "- metadata/cache/*/*"  >> rsync_excludes
/bin/echo "- metadata/timestamp*" >> rsync_excludes
/bin/echo "- virtual/*"           >> rsync_excludes

rm -f .damnsmallportage.tmp

/bin/echo "done"
Now it's time to run damnsmallportage:
sh ./damnsmallportage.sh
and copy the created rsync_excludes to /etc/portage
mv rsync_excludes /etc/portage/
Reduce Portage Tree

Only thing left is syncing

emerge --sync
In this step, all unnecessary ebuilds are going to be erased. After that, our tree is extremly small
This is my Damn Smapp Portage Tree
du -sh /usr/portage/
39M /usr/portage/
Known problems

If you wan't to emerge a package, which is not in your small Portage tree, e.g. nano, you'll get this error:

emerge nano
Calculating dependencies
emerge: there are no ebuilds to satisfy "nano".
What we have todo, is to edit /etc/portage/rsync_excludes and add the missing package at the very top of the file.
+ app-editors/nano
+ metadata/cache/app-editors/nano
A list of all current ebuilds in the official tree can be found on http://www.gentoo-portage.com/
Now do another emerge --sync and let's try it again:
# emerge nano -v

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild R ] app-editors/nano-1.3.11-r2

Total size of downloads: 1,145 kB
If for some reason you need the complete tree an your system, just comment out the PORTAGE_RSYNC_EXTRA_OPTS part in /etc/make.conf:
#PORTAGE_RSYNC_EXTRA_OPTS="--exclude-from=/etc/portage/rsync_excludes
 --delete-excluded"
an re-run emerge --sync

mh@g+