diff --git a/src/mio/filecache.py b/src/mio/filecache.py index a47cf3106587c668af332316015bd392e16dfb2d..4706f80712b3aeddfc25c118cfd6d5fc2338fcde 100755 --- a/src/mio/filecache.py +++ b/src/mio/filecache.py @@ -122,9 +122,25 @@ class Mirror: def expand_mirror(path): + def unique_id(path): + all = set(path) + N = 0 + while True: + N = N + 1 + result = {} + test = set() + for p in all: + name = '__'.join(p[0].split('/')[-N:]) + if name in test: + break + test.update(name) + result[p] = name + break + return result + class Info: def __init__(self, id, path, urls): - self.id = 'repo_%d' % id + self.id = id self.path = path self.urls = urls pass @@ -134,8 +150,10 @@ def expand_mirror(path): self.urls) pass result = [] - for p,i in zip(path, range(len(path))): - result.append(Info(i, p, mirror[p].urls)) + id = unique_id(path) + for p in path: + result.append(Info(id[p], p, mirror[p].urls)) + return result def cleanup():