Do not add several stanzas of the same source package to Sources.gz

We support to upload the same (source) package several times, including the same version. However, we overwrite data in such cases. Yet we add serveral stanzas to the Source.gz file which causes problems like that:

[02:55] <pabs> daemonkeeper: hmm, I keep getting hash sum mismatches when trying to download minetest from mentors using apt-get source
[02:59] <daemonkeeper> Confirmed that, but dget works. 
[02:59] <pabs> aye
[02:59] <daemonkeeper> Did we miss some apt transition?
[02:59] <daemonkeeper> I remember something with MD5 recently.
[03:00] <pabs> I can download other packages fine, just minetest
[03:04] <daemonkeeper> I wonder what apt does if it finds the same source packages several times in a Sources.gz file
[03:06] <daemonkeeper> Ah, uh
[03:06] <daemonkeeper> I See
[03:06] <pabs> thats probably the issue
[03:06] <daemonkeeper> Yes
[03:07] <daemonkeeper> mentors.debian.net/debian/dists/unstable/main/source/Sources.gz - Michael uploaded a package with the same version several times, and we happily add it once to the Sources.gz
[03:07] <daemonkeeper> Apparently that confuses apt, since that's a non-existing state in a full suited repository.
[03:08] <pabs> yeah, I guess apt isn't smart enough to try all the entries
[03:08] <daemonkeeper> For the Sources.gz I guess we should only be adding the most recent version.
$ apt-get source minetest
Reading package lists... Done
Building dependency tree 
Reading state information... Done
NOTICE: 'minetest' packaging is maintained in the 'Git' version control system at:
git://git.debian.org/git/pkg-games/minetest.git
Need to get 490 kB of source archives.
Get:1 http://mentors.debian.net/debian/ unstable/main minetest 0.3.1+dfsg-1 (tar) [482 kB]
Get:2 http://mentors.debian.net/debian/ unstable/main minetest 0.3.1+dfsg-1 (diff) [6,111 B]
Get:3 http://mentors.debian.net/debian/ unstable/main minetest 0.3.1+dfsg-1 (dsc) [2,813 B]
Fetched 490 kB in 6s (81.6 kB/s) 
Failed to fetch http://mentors.debian.net/debian/pool/main/m/minetest/minetest_0.3.1+dfsg-1.dsc Hash Sum mismatch
E: Failed to fetch some archives.

Note: This happens for uploads of the same version only, i.e. those which have been replaced by a new upload.

Originally reported by @arno at https://alioth.debian.org/tracker/index.php?func=detail&aid=313456&group_id=100127&atid=413115

Edited by Baptiste Beauplat
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information