Genetics and ecology of Drosophila melanogaster larval foraging and pupation behaviour