aboutsummaryrefslogtreecommitdiff
blob: 88e9bb39176f3dcc71e396da7dae8b3edf032f78 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# vim: set sw=4 sts=4 et :
# Copyright: 2008 Gentoo Foundation
# Author(s): Nirbheek Chauhan <nirbheek.chauhan@gmail.com>
# License: GPL-2
#
# Immortal lh!
#

import random
from ..models import Mirror

def generate_stage_url(job):
    mirror = random.choice(Mirror.objects.filter(owner=job.provider))
    url = mirror.server+mirror.prefix+mirror.structure
    data = {}
    data['owner'] = mirror.owner.name
    data['stage'] = job.stage.name
    data['arch'] = job.arch.specific
    data['gen_arch'] = job.arch.generic
    data['release'] = job.release.name
    url = url % data
    return url