..and reinstall them all one-by-one or write a silly script to handle them all. Well, here's a simple solution:
Save currently installed packages:
# dpkg --get-selections > packages.installed
Save this off and then copy to new machine or back to re-installed, then do:
# dpkg --set-selections < packages.installed
(* Note: You may want to prune the list of software that you don't want to install or is incompatible if newer version of OS, before doing import above.)
Also, don't forget to save and copy over your /etc/apt/sources.list of course.
That's it! Simple, eh?