Are there any specific rules about how to prepare spells?

[This question is related to my Dwarven Cleric character.]

In the Player’s Handbook, it says that all spells need to be prepared in advance before they can be used. I get that this is done while resting but does it matter how long the rest is (i.e. long or short) as it doesn’t seem to say how long each spell takes to prepare.

Also, are there any specific mechanisms for preparing spells, other than telling my DM "In this rest I will prepare X spells"?