dolweb/downloads/views.py
def new(request):
    """Callback used by the buildbot to register a new build"""

    if request.method != 'POST':
        raise Http404

    # Check the message signature
    branch = request.POST['branch']
    shortrev = request.POST['shortrev']
    hash = request.POST['hash']
    author = request.POST['author']
    description = request.POST['description']
    build_type = request.POST['build_type']
    build_url = request.POST['build_url']
    builder_ver = request.POST['builder_ver']
    msg = "%d|%d|%d|%d|%d|%d|%d|%d|%s|%s|%s|%s|%s|%s|%s|%s" % (
        len(branch), len(shortrev), len(hash), len(author), len(description),
        len(build_type), len(build_url), len(builder_ver),

        branch, shortrev, hash, author, description, build_type, build_url,
        builder_ver
    )
    hm = hmac.new(settings.DOWNLOADS_CREATE_KEY, msg, hashlib.sha1)
    if hm.hexdigest() != request.POST['hmac']:
        return HttpResponse('Invalid HMAC', status=403)

    # Lock to avoid race conditions
    try:
        _addbuild_lock.acquire()
        # Check if we already have a commit with the same hash
        try:
            build_obj = DevVersion.objects.get(hash=hash)
        except DevVersion.DoesNotExist:
            build_obj = DevVersion()
            build_obj.branch = branch
            build_obj.shortrev = shortrev
            build_obj.hash = hash
            build_obj.author = author
            build_obj.description = description

        if build_type == 'win32':
            build_obj.win32_url = build_url
        elif build_type == 'win64':
            build_obj.win64_url = build_url
        elif build_type == 'osx':
            build_obj.osx_url = build_url
        elif build_type == 'ubu':
            build_obj.ubu_url = build_url
            build_obj.ubu_ver = builder_ver
        else:
            return HttpResponse('Wrong build type', status=400)

        build_obj.save()
        return HttpResponse('OK')
    finally:
        _addbuild_lock.release()
Callback used by the buildbot to register a new build
Callback used by the buildbot to register a new build
Callback used by the buildbot to register a new build
def new(request):
    if request.method != 'POST':
        raise Http404
    branch = request.POST['branch']
    shortrev = request.POST['shortrev']
    hash = request.POST['hash']
    author = request.POST['author']
    description = request.POST['description']
    build_type = request.POST['build_type']
    build_url = request.POST['build_url']
    builder_ver = request.POST['builder_ver']
    msg = "%d|%d|%d|%d|%d|%d|%d|%d|%s|%s|%s|%s|%s|%s|%s|%s" % (
        len(branch), len(shortrev), len(hash), len(author), len(description),
        len(build_type), len(build_url), len(builder_ver),
        branch, shortrev, hash, author, description, build_type, build_url,
        builder_ver
    )
    hm = hmac.new(settings.DOWNLOADS_CREATE_KEY, msg, hashlib.sha1)
    if hm.hexdigest() != request.POST['hmac']:
        return HttpResponse('Invalid HMAC', status=403)
    try:
        _addbuild_lock.acquire()
        try:
            build_obj = DevVersion.objects.get(hash=hash)
        except DevVersion.DoesNotExist:
            build_obj = DevVersion()
            build_obj.branch = branch
            build_obj.shortrev = shortrev
            build_obj.hash = hash
            build_obj.author = author
            build_obj.description = description
        if build_type == 'win32':
            build_obj.win32_url = build_url
        elif build_type == 'win64':
            build_obj.win64_url = build_url
        elif build_type == 'osx':
            build_obj.osx_url = build_url
        elif build_type == 'ubu':
            build_obj.ubu_url = build_url
            build_obj.ubu_ver = builder_ver
        else:
            return HttpResponse('Wrong build type', status=400)
        build_obj.save()
        return HttpResponse('OK')
    finally:
        _addbuild_lock.release()
def new ( request ) : if request . method != 'POST' : raise Http404 branch = request . POST [ 'branch' ] shortrev = request . POST [ 'shortrev' ] hash = request . POST [ 'hash' ] author = request . POST [ 'author' ] description = request . POST [ 'description' ] build_type = request . POST [ 'build_type' ] build_url = request . POST [ 'build_url' ] builder_ver = request . POST [ 'builder_ver' ] msg = "%d|%d|%d|%d|%d|%d|%d|%d|%s|%s|%s|%s|%s|%s|%s|%s" % ( len ( branch ) , len ( shortrev ) , len ( hash ) , len ( author ) , len ( description ) , len ( build_type ) , len ( build_url ) , len ( builder_ver ) , branch , shortrev , hash , author , description , build_type , build_url , builder_ver ) hm = hmac . new ( settings . DOWNLOADS_CREATE_KEY , msg , hashlib . sha1 ) if hm . hexdigest ( ) != request . POST [ 'hmac' ] : return HttpResponse ( 'Invalid HMAC' , status = 403 ) try : _addbuild_lock . acquire ( ) try : build_obj = DevVersion . objects . get ( hash = hash ) except DevVersion . DoesNotExist : build_obj = DevVersion ( ) build_obj . branch = branch build_obj . shortrev = shortrev build_obj . hash = hash build_obj . author = author build_obj . description = description if build_type == 'win32' : build_obj . win32_url = build_url elif build_type == 'win64' : build_obj . win64_url = build_url elif build_type == 'osx' : build_obj . osx_url = build_url elif build_type == 'ubu' : build_obj . ubu_url = build_url build_obj . ubu_ver = builder_ver else : return HttpResponse ( 'Wrong build type' , status = 400 ) build_obj . save ( ) return HttpResponse ( 'OK' ) finally : _addbuild_lock . release ( )
Callback used by the buildbot to register a new build
Callback used by the buildbot to register a new build
"""Callback used by the buildbot to register a new build""" # Check the message signature # Lock to avoid race conditions # Check if we already have a commit with the same hash
request