-
Notifications
You must be signed in to change notification settings - Fork 218
/
buildutil.py
34 lines (27 loc) · 1.05 KB
/
buildutil.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
"""
buildutil.py provides utility functions for querying, editing, and adding
builds to Socorro.
"""
import logging
import psycopg2
logger = logging.getLogger("webapi")
def insert_build(cursor, product_name, version, platform, build_id, build_type,
beta_number, repository):
""" Insert a particular build into the database """
# As we use beta numbers, we don't want to keep the 'bX' in versions
if "b" in version:
version = version[:version.index("b")]
params = (str(product_name), version, build_type, int(build_id),
platform, int(beta_number), repository)
logger.info("Trying to insert new release: %s %s %s %s %s %s %s" % params)
sql = """/* socorro.lib.buildutil.insert_build */
SELECT add_new_release(%s, %s, %s, %s, %s, %s, %s)
"""
try:
cursor.execute(sql, params)
cursor.connection.commit()
except psycopg2.Error, e:
cursor.connection.rollback()
logger.error("Failed inserting new release: %s" % e,
exc_info=True)
raise