MacPorts not working after power outage during build (sqlite disk I/O error)
The fix for this is actually quite simple, and is mentioned in this MacPorts issue. From a comment on the issue by "pixilla@…":

$ cd /opt/local/var/macports/registry
$ ls registry.db-journal                                                                                                                                                                             
$ sudo sqlite3 registry.db
sqlite&gt; .tables
sqlite&gt; SELECT id FROM ports;
sqlite&gt; .quit


Based on another comment by "ecronin@…", I conclude that, had I run any port command as root, it would have been fixed automatically and saved me all this trouble. But I always forget to use sudo...

EDIT Wait, I did run a port command with sudo. Weird. Oh, well, at least it works now.