Fix run-mirror writing wrong project directory

When run-mirror downloads a package whose download files have a
different base name to the download directory, run-mirror ends up
writing the wrong directory name, which causes 404's on the mirror.

In this patch we use the actual upstream parent dir name exactly.

Change-Id: I90ca0e280dc59d26e5cfc70c8c02feeb734d1ae9
Closes-Bug: #1294522
This commit is contained in:
Clint Byrum 2014-03-19 00:47:21 -07:00
parent 0de0e10e75
commit 63dfccb6cf
1 changed files with 2 additions and 6 deletions

View File

@ -356,8 +356,6 @@ class Mirror(object):
'pip', mirror['name'])
destination_mirror = mirror['output']
PACKAGE_VERSION_RE = re.compile(r'(.*)-[0-9]')
packages = {}
package_count = 0
@ -368,11 +366,9 @@ class Mirror(object):
realname = urllib.unquote(filename)
# The ? accounts for sourceforge downloads
tarball = os.path.basename(realname).split("?")[0]
name_match = PACKAGE_VERSION_RE.search(tarball)
if name_match is None:
package_name = os.path.basename(os.path.dirname(realname))
if not package_name:
continue
package_name = name_match.group(1)
version_list = packages.get(package_name, {})
version_list[tarball] = os.path.join(pip_cache_dir, filename)