• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2010, Google Inc. All rights reserved.
2#
3# Redistribution and use in source and binary forms, with or without
4# modification, are permitted provided that the following conditions are
5# met:
6#
7#     * Redistributions of source code must retain the above copyright
8# notice, this list of conditions and the following disclaimer.
9#     * Redistributions in binary form must reproduce the above
10# copyright notice, this list of conditions and the following disclaimer
11# in the documentation and/or other materials provided with the
12# distribution.
13#     * Neither the name of Google Inc. nor the names of its
14# contributors may be used to endorse or promote products derived from
15# this software without specific prior written permission.
16#
17# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
29import re
30
31
32def view_source_url(local_path):
33    return "http://trac.webkit.org/browser/trunk/%s" % local_path
34
35
36def view_revision_url(revision_number):
37    return "http://trac.webkit.org/changeset/%s" % revision_number
38
39
40def chromium_results_url_base():
41    return 'https://storage.googleapis.com/chromium-layout-test-archives'
42
43
44def chromium_results_url_base_for_builder(builder_name):
45    return '%s/%s' % (chromium_results_url_base(), re.sub('[ .()]', '_', builder_name))
46
47
48def chromium_results_zip_url(builder_name):
49    return chromium_results_url_base_for_builder(builder_name) + '/results/layout-test-results.zip'
50
51
52def chromium_accumulated_results_url_base_for_builder(builder_name):
53    return chromium_results_url_base_for_builder(builder_name) + "/results/layout-test-results"
54
55
56chromium_lkgr_url = "http://chromium-status.appspot.com/lkgr"
57contribution_guidelines = "http://webkit.org/coding/contributing.html"
58
59bug_server_domain = "webkit.org"
60bug_server_host = "bugs." + bug_server_domain
61_bug_server_regex = "https?://%s/" % re.sub('\.', '\\.', bug_server_host)
62bug_server_url = "https://%s/" % bug_server_host
63bug_url_long = _bug_server_regex + r"show_bug\.cgi\?id=(?P<bug_id>\d+)(&ctype=xml|&excludefield=attachmentdata)*"
64bug_url_short = r"https?\://%s/b/(?P<bug_id>\d+)" % bug_server_domain
65
66attachment_url = _bug_server_regex + r"attachment\.cgi\?id=(?P<attachment_id>\d+)(&action=(?P<action>\w+))?"
67direct_attachment_url = r"https?://bug-(?P<bug_id>\d+)-attachments.%s/attachment\.cgi\?id=(?P<attachment_id>\d+)" % bug_server_domain
68
69buildbot_url = "http://build.webkit.org"
70chromium_buildbot_url = "http://build.chromium.org/p/chromium.webkit"
71
72chromium_webkit_sheriff_url = "http://build.chromium.org/p/chromium.webkit/sheriff_webkit.js"
73
74omahaproxy_url = "http://omahaproxy.appspot.com/"
75
76def parse_bug_id(string):
77    if not string:
78        return None
79    match = re.search(bug_url_short, string)
80    if match:
81        return int(match.group('bug_id'))
82    match = re.search(bug_url_long, string)
83    if match:
84        return int(match.group('bug_id'))
85    return None
86
87
88def parse_attachment_id(string):
89    if not string:
90        return None
91    match = re.search(attachment_url, string)
92    if match:
93        return int(match.group('attachment_id'))
94    match = re.search(direct_attachment_url, string)
95    if match:
96        return int(match.group('attachment_id'))
97    return None
98