The Background:

The situation is strange to begin with. A while back I was RARing a whole bunch of media for my roommate, watching a video, making 2 apps, compiling my project for school, and surfing a good 5 sites at once. Needless to say, my machine was occupied. Suddenly everything was black. Crap. Power outage. When it got back on I tried to boot into linux and was met with a bunch of errors when XFS auto self-checked. It couldn't mount as a result and I got a kernel panic. Ah well...fixable with the right tools. So I booted into windows to finish my project and resume my work. I was busy in a bad way that week so I didn't get around to fixing it. About half way through the week I tried starting linux to see the exact errors I was getting, and the same problem was still there. Then Saturday comes. I wake up around 10:30 feeling like whatever the hell was on my shirt from the night before, and figure it's a good time to fix linux. So I get all the XFS fixing utilities ready, have my bootdisk, and figure I'd better give it one last startup to see if I can't pinpoint exactly what's wrong. Linux starts up. Apparently the filesystem healed itself. Goes through the check without issue. Strange, no? Ah well..far be it for me to complain.

The Problem:

Yes, the filesystem healed itself, but apparently not without scar tissue. I'm running Gentoo, and every single time I try to emerge ANYTHING...be it installing, pretending, upgrading....I get this:

Code:
root@boxeroo conor # emerge --update kde
Calculating dependencies   !!! Name error in : category or package part missing.
Traceback (most recent call last):
  File "/usr/bin/emerge", line 1220, in ?
    mykey=portage.db[portage.root]["porttree"].dep_bestmatch(mypkg)
  File "/usr/lib/python2.2/site-packages/portage.py", line 2094, in dep_bestmatch
    mypkgdep=self.dep_pkgcat(mypkgdep)
  File "/usr/lib/python2.2/site-packages/portage.py", line 2077, in dep_pkgcat
    if self.hasnode(cat+"/"+mypkgdep_packagename):
  File "/usr/lib/python2.2/site-packages/portage.py", line 1893, in hasnode
    myreskey=self.resolve_key(mykey)
  File "/usr/lib/python2.2/site-packages/portage.py", line 1842, in resolve_key
    self.load(mykey)
  File "/usr/lib/python2.2/site-packages/portage.py", line 1801, in load
    self.populate()
  File "/usr/lib/python2.2/site-packages/portage.py", line 2498, in populate
    self.domask()
  File "/usr/lib/python2.2/site-packages/portage.py", line 2506, in domask
    self.zap(y)
  File "/usr/lib/python2.2/site-packages/portage.py", line 1813, in zap
    mykey=cps[0]+"/"+cps[1]
TypeError: unsubscriptable object
root@boxeroo conor #
So unless anyone can provide some insight as to what's wrong, it's my belief that emerge, or perhaps portage itself, is hosed. No problem. I'll just replace it. If only I could find it. Does anyone know where I can find it? I REALLY hope it's not built into gentoo, cause I don't want to have to reinstall just for portage, but if it comes to that I will. I like my portage
So can anyone point me in the right direction here?