Shaping of tube ends