本文整理汇总了Python中bodhi.model.PackageUpdate.addBugzilla方法的典型用法代码示例。如果您正苦于以下问题:Python PackageUpdate.addBugzilla方法的具体用法?Python PackageUpdate.addBugzilla怎么用?Python PackageUpdate.addBugzilla使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bodhi.model.PackageUpdate
的用法示例。
在下文中一共展示了PackageUpdate.addBugzilla方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: load_db
# 需要导入模块: from bodhi.model import PackageUpdate [as 别名]
# 或者: from bodhi.model.PackageUpdate import addBugzilla [as 别名]
def load_db():
print "\nLoading pickled database %s" % sys.argv[2]
db = file(sys.argv[2], "r")
data = pickle.load(db)
# Legacy format was just a list of update dictionaries
# Now we'll pull things out into an organized dictionary:
# {'updates': [], 'releases': []}
if isinstance(data, dict):
for release in data["releases"]:
try:
Release.byName(release["name"])
except SQLObjectNotFound:
Release(**release)
data = data["updates"]
progress = ProgressBar(maxValue=len(data))
for u in data:
try:
release = Release.byName(u["release"][0])
except SQLObjectNotFound:
release = Release(
name=u["release"][0], long_name=u["release"][1], id_prefix=u["release"][2], dist_tag=u["release"][3]
)
## Backwards compatbility
request = u["request"]
if u["request"] == "move":
request = "stable"
elif u["request"] == "push":
request = "testing"
elif u["request"] == "unpush":
request = "obsolete"
if u["approved"] in (True, False):
u["approved"] = None
if u.has_key("update_id"):
u["updateid"] = u["update_id"]
if not u.has_key("date_modified"):
u["date_modified"] = None
try:
update = PackageUpdate.byTitle(u["title"])
except SQLObjectNotFound:
update = PackageUpdate(
title=u["title"],
date_submitted=u["date_submitted"],
date_pushed=u["date_pushed"],
date_modified=u["date_modified"],
release=release,
submitter=u["submitter"],
updateid=u["updateid"],
type=u["type"],
status=u["status"],
pushed=u["pushed"],
notes=u["notes"],
karma=u["karma"],
request=request,
approved=u["approved"],
)
## Create Package and PackageBuild objects
for pkg, nvr in u["builds"]:
try:
package = Package.byName(pkg)
except SQLObjectNotFound:
package = Package(name=pkg)
try:
build = PackageBuild.byNvr(nvr)
except SQLObjectNotFound:
build = PackageBuild(nvr=nvr, package=package)
update.addPackageBuild(build)
## Create all Bugzilla objects for this update
for bug_num, bug_title, security, parent in u["bugs"]:
try:
bug = Bugzilla.byBz_id(bug_num)
except SQLObjectNotFound:
bug = Bugzilla(bz_id=bug_num, security=security, parent=parent)
bug.title = bug_title
update.addBugzilla(bug)
## Create all CVE objects for this update
for cve_id in u["cves"]:
try:
cve = CVE.byCve_id(cve_id)
except SQLObjectNotFound:
cve = CVE(cve_id=cve_id)
update.addCVE(cve)
for timestamp, author, text, karma, anonymous in u["comments"]:
comment = Comment(
timestamp=timestamp, author=author, text=text, karma=karma, update=update, anonymous=anonymous
)
progress()
示例2: test_extended_metadata
# 需要导入模块: from bodhi.model import PackageUpdate [as 别名]
# 或者: from bodhi.model.PackageUpdate import addBugzilla [as 别名]
def test_extended_metadata(self):
# grab the name of a build in updates-testing, and create it in our db
koji = get_session()
builds = koji.listTagged('dist-f13-updates-testing', latest=True)
# Create all of the necessary database entries
release = Release(name='F13', long_name='Fedora 13',
id_prefix='FEDORA', dist_tag='dist-f13')
package = Package(name=builds[0]['package_name'])
update = PackageUpdate(title=builds[0]['nvr'],
release=release,
submitter=builds[0]['owner_name'],
status='testing',
notes='foobar',
type='bugfix')
build = PackageBuild(nvr=builds[0]['nvr'], package=package)
update.addPackageBuild(build)
bug = Bugzilla(bz_id=1)
update.addBugzilla(bug)
cve = CVE(cve_id="CVE-2007-0000")
update.addCVE(cve)
update.assign_id()
print update
## Initialize our temporary repo
temprepo = join(tempfile.mkdtemp('bodhi'), 'f13-updates-testing')
print "Inserting updateinfo into temprepo: %s" % temprepo
mkmetadatadir(join(temprepo, 'i386'))
repodata = join(temprepo, 'i386', 'repodata')
assert exists(join(repodata, 'repomd.xml'))
## Generate the XML
md = ExtendedMetadata(temprepo)
## Insert the updateinfo.xml into the repository
md.insert_updateinfo()
updateinfo = self.__verify_updateinfo(repodata)
## Read an verify the updateinfo.xml.gz
uinfo = UpdateMetadata()
uinfo.add(updateinfo)
notice = uinfo.get_notice(('mutt', '1.5.14', '1.fc13'))
assert not notice
notice = uinfo.get_notice(get_nvr(update.title))
assert notice
assert notice['status'] == update.status
assert notice['updated'] == update.date_modified
assert notice['from'] == str(config.get('bodhi_email'))
assert notice['description'] == update.notes
assert notice['issued'] is not None
assert notice['update_id'] == update.updateid
assert notice['epoch'] is None
cve = notice['references'][0]
assert cve['type'] == 'cve'
assert cve['href'] == update.cves[0].get_url()
assert cve['id'] == update.cves[0].cve_id
bug = notice['references'][1]
assert bug['href'] == update.bugs[0].get_url()
assert bug['id'] == '1'
assert bug['type'] == 'bugzilla'
# FC6's yum update metadata parser doesn't know about some stuff
from yum import __version__
if __version__ >= '3.0.6':
assert notice['title'] == update.title
assert notice['release'] == update.release.long_name
assert cve['title'] is None
## Clean up
shutil.rmtree(temprepo)
示例3: load_db
# 需要导入模块: from bodhi.model import PackageUpdate [as 别名]
# 或者: from bodhi.model.PackageUpdate import addBugzilla [as 别名]
def load_db():
print "\nLoading pickled database %s" % sys.argv[2]
db = file(sys.argv[2], 'r')
data = pickle.load(db)
# Load up all of the overrides
for override in data.get('overrides', []):
try:
BuildRootOverride.byBuild(override['build'])
except SQLObjectNotFound:
BuildRootOverride(**override)
# Legacy format was just a list of update dictionaries
# Now we'll pull things out into an organized dictionary:
# {'updates': [], 'releases': []}
if isinstance(data, dict):
for release in data['releases']:
try:
Release.byName(release['name'])
except SQLObjectNotFound:
Release(**release)
data = data['updates']
progress = ProgressBar(maxValue=len(data))
for u in data:
try:
release = Release.byName(u['release'][0])
except SQLObjectNotFound:
release = Release(name=u['release'][0], long_name=u['release'][1],
id_prefix=u['release'][2], dist_tag=u['release'][3])
## Backwards compatbility
request = u['request']
if u['request'] == 'move':
request = 'stable'
elif u['request'] == 'push':
request = 'testing'
elif u['request'] == 'unpush':
request = 'obsolete'
if u['approved'] in (True, False):
u['approved'] = None
if 'update_id' in u:
u['updateid'] = u['update_id']
if not 'date_modified' in u:
u['date_modified'] = None
try:
update = PackageUpdate.byTitle(u['title'])
except SQLObjectNotFound:
update = PackageUpdate(title=u['title'],
date_submitted=u['date_submitted'],
date_pushed=u['date_pushed'],
date_modified=u['date_modified'],
release=release,
submitter=u['submitter'],
updateid=u['updateid'],
type=u['type'],
status=u['status'],
pushed=u['pushed'],
notes=u['notes'],
karma=u['karma'],
request=request,
approved=u['approved'])
## Create Package and PackageBuild objects
for pkg, nvr in u['builds']:
try:
package = Package.byName(pkg)
except SQLObjectNotFound:
package = Package(name=pkg)
try:
build = PackageBuild.byNvr(nvr)
except SQLObjectNotFound:
build = PackageBuild(nvr=nvr, package=package)
update.addPackageBuild(build)
## Create all Bugzilla objects for this update
for bug_num, bug_title, security, parent in u['bugs']:
try:
bug = Bugzilla.byBz_id(bug_num)
except SQLObjectNotFound:
bug = Bugzilla(bz_id=bug_num, security=security, parent=parent)
bug.title = bug_title
update.addBugzilla(bug)
## Create all CVE objects for this update
for cve_id in u['cves']:
try:
cve = CVE.byCve_id(cve_id)
except SQLObjectNotFound:
cve = CVE(cve_id=cve_id)
update.addCVE(cve)
for timestamp, author, text, karma, anonymous in u['comments']:
comment = Comment(timestamp=timestamp, author=author, text=text,
karma=karma, update=update, anonymous=anonymous)
progress()