axxo says: callig sed in global scope is evil, you can replace those with bash ${var//./_}
Fixed in portage.