2In a large frying pan, put onions, garlic and add enough olive oil to just cover. Cook over moderate heat until onions are tender. Put tomatoes in a roasting pan large enough to hold them in one layer. Add cooked onions, garlic, basil, salt, red pepper flakes and sugar. Toss well. Add enough oil to come halfway up to the tomatoes. Roast for 3 hours, uncovered, until tomatoes are tender but not falling apart. Stir once during roasting. This can be made 1 -2 days in advance.