Here's an easier answer: don't ordain homosexuals. If one slips through, never, ever raise him to the episcopate.
To those who complain that there wouldn't be enough priests ... get rid of irreverent NO Masses and preach and do serious Catholicism. Problem solved.
I don’t totally disagree, but is a homosexual a homosexual if he doesn’t act on his urges? I have no idea what percentage of them are sexually active but some number aren’t. Everyone has their own weaknesses when it comes to sinning. You could make the argument that there problem has become so pervasive that anyone who has homosexual tendencies should leave the order, but frankly, that would probably bankrupt the church if it happened all at once.