First make the tomato sauce. Heat a glug of olive oil and gently sweat the onion in it for a few minutes until soft, then add the tomatoes and cook over a low heat for about 30 minutes.
Heat the red wine vinegar in a pan with the sugar and cook until it thickens slightly, then add this to the tomatoes and season to taste. Break the mix up with a whisk or spoon until it’s smooth. Set aside.
Preheat the oven to 200C/400F/gas mark 6.
Cut the aubergines into 1cm-thick slices and drizzle with oil, making sure they’re thinly coated. Oil an oven tray and lay the slices on it. Roast in the oven for 20 minutes, turning once half way through, until soft and well browned. Leave to cool, then slice into strips.
Cook the pasta in boiling salted water, as per the packet instructions, and then drain, reserving a little of the cooking water.
Heat 500ml of the tomato sauce (save any leftovers for next time – it’ll keep in a container in the fridge for a couple of days, or you can freeze it) with the vegetable stock, add the garlic and aubergine and season. Simmer gently.
Add the basil, parsley and butter and simmer until the sauce becomes glossy and quite thick. Check the seasoning, then toss with the spaghetti, adding a little of the reserved pasta water if it needs loosening. Serve topped with a grating of ricotta and a basil leaf.