From: Mathieu Bridon <bochecha(a)daitauha.fr>
Currently, the CGI script is set to upload files:
- to the old path if the upload uses md5
- to the new path if the upload uses sha512
The old path is as follows:
The new path is:
This was meant to ensure compatibility with current fedpkg which
always downloads from the old path, but will eventually download from
the new path when we move to sha512.
However, working more on this, I now think it would make for a smoother
transition if we instead always stored the files at the new path, but
just hardlinked to the old path if the upload is using md5.
This is what this patch achieves.
With this deployed in production, fedpkg could be patched to try
downloading from the new path, and fallback to the old one if necessary,
which decouples the migration to the new path from the migration to the
roles/distgit/files/dist-git-upload.cgi | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/roles/distgit/files/dist-git-upload.cgi
index b4fda74..38c40db 100644
@@ -112,11 +112,6 @@ def main():
hash_dir = os.path.join(module_dir, filename, hash_type, checksum)
msgpath = os.path.join(name, module_dir, filename, hash_type, checksum, filename)
- if hash_type == "md5":
- # Preserve compatibility with the current folder hierarchy for md5
- hash_dir = os.path.join(module_dir, filename, checksum)
- msgpath = os.path.join(name, module_dir, filename, checksum, filename)
unwanted_prefix = '/srv/cache/lookaside/pkgs/'
msgpath = msgpath[len(unwanted_prefix):]
@@ -180,6 +175,11 @@ def main():
print >> sys.stderr, '[username=%s] Stored %s (%d bytes)' % (username,
print 'File %s size %d %s %s stored OK' % (filename, filesize,
+ # Add the file to the old path, where fedpkg is currently looking for it
+ if hash_type == "md5":
+ old_path = os.path.join(module_dir, filename, checksum, filename)
+ os.link(dest_file, old_path)
# Emit a fedmsg message. Load the config to talk to the fedmsg-relay.
config = fedmsg.config.load_config(, None)