One-photon wavepacket interacting with a two-level atom in a waveguide: Constraint on the pulse shape