Fry onions in olive oil to transparent. Ensure that the onions don't burn.
Add lots of chopped garlic. Again, ensure they don't burn.
Add a large amount of sugar. Don't caramelise.
Chop tomatoes and remove any hard parts.
Add tomatoes to onions and garlic, excess olive oil.
Simmer for approximately 4 hours. Lose as much water as possible. (This order isn't logical as the oil prevents evaporation. It would be interesting to simmer and then add the oil at the end, but I've never tried that. )
Add Salt, pepper, herbes de Provence. Also add Vinegar if you feel like it, but not much.
Should keep even without refrigeration if you've lost enough water. Traditionally you keep it in unsealed jars and just scoop and throw away any mould on the surface.