本文整理汇总了Python中osclib.stagingapi.StagingAPI.days_since_last_freeze方法的典型用法代码示例。如果您正苦于以下问题:Python StagingAPI.days_since_last_freeze方法的具体用法?Python StagingAPI.days_since_last_freeze怎么用?Python StagingAPI.days_since_last_freeze使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osclib.stagingapi.StagingAPI
的用法示例。
在下文中一共展示了StagingAPI.days_since_last_freeze方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestApiCalls
# 需要导入模块: from osclib.stagingapi import StagingAPI [as 别名]
# 或者: from osclib.stagingapi.StagingAPI import days_since_last_freeze [as 别名]
#.........这里部分代码省略.........
# Get rq number
num = self.api.get_request_id_for_package(prj, pkg)
# Delete the package
self.api.rm_from_prj(prj, request_id=num)
# Verify package is not there
self.assertTrue(full_name not in self.obs.links)
# RQ is gone
self.assertEqual(None, self.api.get_request_id_for_package(prj, pkg))
self.assertEqual(None, self.api.get_package_for_request_id(prj, num))
# Verify that review is closed
self.assertEqual('accepted', self.obs.requests[str(num)]['review'])
self.assertEqual('new', self.obs.requests[str(num)]['request'])
def test_add_sr(self):
prj = 'openSUSE:Factory:Staging:A'
rq = '123'
# Running it twice shouldn't change anything
for i in range(2):
# Add rq to the project
self.api.rq_to_prj(rq, prj)
# Verify that review is there
self.assertEqual('new', self.obs.requests[rq]['review'])
self.assertEqual('review', self.obs.requests[rq]['request'])
self.assertEqual(self.api.get_prj_pseudometa('openSUSE:Factory:Staging:A'),
{'requests': [{'id': 123, 'package': 'gcc', 'author': 'Admin'}]})
def test_create_package_container(self):
"""Test if the uploaded _meta is correct."""
self.api.create_package_container('openSUSE:Factory:Staging:B', 'wine')
self.assertEqual(httpretty.last_request().method, 'PUT')
self.assertEqual(httpretty.last_request().body, '<package name="wine"><title/><description/></package>')
self.assertEqual(httpretty.last_request().path, '/source/openSUSE:Factory:Staging:B/wine/_meta')
self.api.create_package_container('openSUSE:Factory:Staging:B', 'wine', disable_build=True)
self.assertEqual(httpretty.last_request().method, 'PUT')
self.assertEqual(httpretty.last_request().body, '<package name="wine"><title /><description /><build><disable /></build></package>')
self.assertEqual(httpretty.last_request().path, '/source/openSUSE:Factory:Staging:B/wine/_meta')
def test_review_handling(self):
"""Test whether accepting/creating reviews behaves correctly."""
# Add review
self.api.add_review('123', by_project='openSUSE:Factory:Staging:A')
self.assertEqual(httpretty.last_request().method, 'POST')
self.assertEqual(httpretty.last_request().querystring[u'cmd'], [u'addreview'])
# Try to readd, should do anything
self.api.add_review('123', by_project='openSUSE:Factory:Staging:A')
self.assertEqual(httpretty.last_request().method, 'GET')
# Accept review
self.api.set_review('123', 'openSUSE:Factory:Staging:A')
self.assertEqual(httpretty.last_request().method, 'POST')
self.assertEqual(httpretty.last_request().querystring[u'cmd'], [u'changereviewstate'])
# Try to accept it again should do anything
self.api.set_review('123', 'openSUSE:Factory:Staging:A')
self.assertEqual(httpretty.last_request().method, 'GET')
# But we should be able to reopen it
self.api.add_review('123', by_project='openSUSE:Factory:Staging:A')
self.assertEqual(httpretty.last_request().method, 'POST')
self.assertEqual(httpretty.last_request().querystring[u'cmd'], [u'addreview'])
def test_prj_from_letter(self):
# Verify it works
self.assertEqual(self.api.prj_from_letter('openSUSE:Factory'), 'openSUSE:Factory')
self.assertEqual(self.api.prj_from_letter('A'), 'openSUSE:Factory:Staging:A')
def test_frozen_mtime(self):
"""Test frozen mtime."""
# Testing frozen mtime
self.assertTrue(self.api.days_since_last_freeze('openSUSE:Factory:Staging:A') > 8)
self.assertTrue(self.api.days_since_last_freeze('openSUSE:Factory:Staging:B') < 1)
# U == unfrozen
self.assertTrue(self.api.days_since_last_freeze('openSUSE:Factory:Staging:U') > 1000)
def test_frozen_enough(self):
"""Test frozen enough."""
# Testing frozen mtime
self.assertEqual(self.api.prj_frozen_enough('openSUSE:Factory:Staging:B'), True)
self.assertEqual(self.api.prj_frozen_enough('openSUSE:Factory:Staging:A'), False)
# U == unfrozen
self.assertEqual(self.api.prj_frozen_enough('openSUSE:Factory:Staging:U'), False)
def test_move(self):
"""Test package movement."""
init_data = self.api.get_package_information('openSUSE:Factory:Staging:B', 'wine')
self.api.move_between_project('openSUSE:Factory:Staging:B', 333, 'openSUSE:Factory:Staging:A')
test_data = self.api.get_package_information('openSUSE:Factory:Staging:A', 'wine')
self.assertEqual(init_data, test_data)
示例2: TestApiCalls
# 需要导入模块: from osclib.stagingapi import StagingAPI [as 别名]
# 或者: from osclib.stagingapi.StagingAPI import days_since_last_freeze [as 别名]
#.........这里部分代码省略.........
self.api.rm_from_prj(prj, request_id=num)
# Verify package is not there
self.assertTrue(full_name not in self.obs.links)
# RQ is gone
self.assertEqual(None, self.api.get_request_id_for_package(prj, pkg))
self.assertEqual(None, self.api.get_package_for_request_id(prj, num))
# Verify that review is closed
self.assertEqual("accepted", self.obs.requests[str(num)]["review"])
self.assertEqual("new", self.obs.requests[str(num)]["request"])
def test_add_sr(self):
prj = "openSUSE:Factory:Staging:A"
rq = "123"
# Running it twice shouldn't change anything
for i in range(2):
# Add rq to the project
self.api.rq_to_prj(rq, prj)
# Verify that review is there
self.assertEqual("new", self.obs.requests[rq]["review"])
self.assertEqual("review", self.obs.requests[rq]["request"])
self.assertEqual(
self.api.get_prj_pseudometa("openSUSE:Factory:Staging:A"),
{"requests": [{"id": 123, "package": "gcc", "author": "Admin"}]},
)
def test_create_package_container(self):
"""Test if the uploaded _meta is correct."""
self.api.create_package_container("openSUSE:Factory:Staging:B", "wine")
self.assertEqual(httpretty.last_request().method, "PUT")
self.assertEqual(httpretty.last_request().body, '<package name="wine"><title/><description/></package>')
self.assertEqual(httpretty.last_request().path, "/source/openSUSE:Factory:Staging:B/wine/_meta")
self.api.create_package_container("openSUSE:Factory:Staging:B", "wine", disable_build=True)
self.assertEqual(httpretty.last_request().method, "PUT")
self.assertEqual(
httpretty.last_request().body,
'<package name="wine"><title /><description /><build><disable /></build></package>',
)
self.assertEqual(httpretty.last_request().path, "/source/openSUSE:Factory:Staging:B/wine/_meta")
def test_review_handling(self):
"""Test whether accepting/creating reviews behaves correctly."""
# Add review
self.api.add_review("123", by_project="openSUSE:Factory:Staging:A")
self.assertEqual(httpretty.last_request().method, "POST")
self.assertEqual(httpretty.last_request().querystring[u"cmd"], [u"addreview"])
# Try to readd, should do anything
self.api.add_review("123", by_project="openSUSE:Factory:Staging:A")
self.assertEqual(httpretty.last_request().method, "GET")
# Accept review
self.api.set_review("123", "openSUSE:Factory:Staging:A")
self.assertEqual(httpretty.last_request().method, "POST")
self.assertEqual(httpretty.last_request().querystring[u"cmd"], [u"changereviewstate"])
# Try to accept it again should do anything
self.api.set_review("123", "openSUSE:Factory:Staging:A")
self.assertEqual(httpretty.last_request().method, "GET")
# But we should be able to reopen it
self.api.add_review("123", by_project="openSUSE:Factory:Staging:A")
self.assertEqual(httpretty.last_request().method, "POST")
self.assertEqual(httpretty.last_request().querystring[u"cmd"], [u"addreview"])
def test_prj_from_letter(self):
# Verify it works
self.assertEqual(self.api.prj_from_letter("openSUSE:Factory"), "openSUSE:Factory")
self.assertEqual(self.api.prj_from_letter("A"), "openSUSE:Factory:Staging:A")
def test_frozen_mtime(self):
"""Test frozen mtime."""
# Testing frozen mtime
self.assertTrue(self.api.days_since_last_freeze("openSUSE:Factory:Staging:A") > 8)
self.assertTrue(self.api.days_since_last_freeze("openSUSE:Factory:Staging:B") < 1)
# U == unfrozen
self.assertTrue(self.api.days_since_last_freeze("openSUSE:Factory:Staging:U") > 1000)
def test_frozen_enough(self):
"""Test frozen enough."""
# Testing frozen mtime
self.assertEqual(self.api.prj_frozen_enough("openSUSE:Factory:Staging:B"), True)
self.assertEqual(self.api.prj_frozen_enough("openSUSE:Factory:Staging:A"), False)
# U == unfrozen
self.assertEqual(self.api.prj_frozen_enough("openSUSE:Factory:Staging:U"), False)
def test_move(self):
"""Test package movement."""
init_data = self.api.get_package_information("openSUSE:Factory:Staging:B", "wine")
self.api.move_between_project("openSUSE:Factory:Staging:B", 333, "openSUSE:Factory:Staging:A")
test_data = self.api.get_package_information("openSUSE:Factory:Staging:A", "wine")
self.assertEqual(init_data, test_data)
示例3: do_staging
# 需要导入模块: from osclib.stagingapi import StagingAPI [as 别名]
# 或者: from osclib.stagingapi.StagingAPI import days_since_last_freeze [as 别名]
#.........这里部分代码省略.........
elif cmd == 'check_duplicate_binaries':
CheckDuplicateBinariesCommand(api).perform(opts.save)
elif cmd == 'config':
projects = set()
key = value = None
stagings = api.get_staging_projects_short(None) + \
api.get_staging_projects()
for arg in args[1:]:
if arg in stagings:
projects.add(api.prj_from_short(arg))
elif key is None:
key = arg
elif value is None:
value = arg
else:
value += ' ' + arg
if not len(projects):
projects = api.get_staging_projects()
ConfigCommand(api).perform(projects, key, value, opts.append, opts.clear)
elif cmd == 'freeze':
for prj in args[1:]:
prj = api.prj_from_short(prj)
print(Fore.YELLOW + prj)
FreezeCommand(api).perform(prj, copy_bootstrap=opts.bootstrap)
elif cmd == 'frozenage':
projects = api.get_staging_projects_short() if len(args) == 1 else args[1:]
for prj in projects:
prj = api.prj_from_letter(prj)
print('{} last frozen {}{:.1f} days ago'.format(
Fore.YELLOW + prj + Fore.RESET,
Fore.GREEN if api.prj_frozen_enough(prj) else Fore.RED,
api.days_since_last_freeze(prj)))
elif cmd == 'acheck':
# Is it safe to accept? Meaning: /totest contains what it should and is not dirty
version_totest = api.get_binary_version(api.project, "openSUSE-release.rpm", repository="totest", arch="x86_64")
if version_totest:
version_openqa = api.pseudometa_file_load('version_totest')
totest_dirty = api.is_repo_dirty(api.project, 'totest')
print("version_openqa: %s / version_totest: %s / totest_dirty: %s\n" % (version_openqa, version_totest, totest_dirty))
else:
print("acheck is unavailable in %s!\n" % (api.project))
elif cmd == 'accept':
# Is it safe to accept? Meaning: /totest contains what it should and is not dirty
version_totest = api.get_binary_version(api.project, "openSUSE-release.rpm", repository="totest", arch="x86_64")
if version_totest is None or opts.force:
# SLE does not have a totest_version or openqa_version - ignore it
version_openqa = version_totest
totest_dirty = False
else:
version_openqa = api.pseudometa_file_load('version_totest')
totest_dirty = api.is_repo_dirty(api.project, 'totest')
if version_openqa == version_totest and not totest_dirty:
cmd = AcceptCommand(api)
for prj in args[1:]:
if cmd.perform(api.prj_from_letter(prj), opts.force):
cmd.reset_rebuild_data(prj)
else:
return
if not opts.no_cleanup:
if api.item_exists(api.prj_from_letter(prj)):
cmd.cleanup(api.prj_from_letter(prj))
cmd.accept_other_new()
示例4: do_staging
# 需要导入模块: from osclib.stagingapi import StagingAPI [as 别名]
# 或者: from osclib.stagingapi.StagingAPI import days_since_last_freeze [as 别名]
def do_staging(self, subcmd, opts, *args):
"""${cmd_name}: Commands to work with staging projects
${cmd_option_list}
"accept" will accept all requests in
openSUSE:Factory:Staging:<LETTER> (into Factory)
"acheck" will check if it's safe to accept new staging projects
As openSUSE:Factory is syncing the right package versions between
/standard, /totest and /snapshot, it's important that the projects
are clean prior to a checkin round.
"check" will check if all packages are links without changes
"cleanup_rings" will try to cleanup rings content and print
out problems
"freeze" will freeze the sources of the project's links (not
affecting the packages actually in)
"frozenage" will show when the respective staging project was last frozen
"list" will pick the requests not in rings
"select" will add requests to the project
"unselect" will remove from the project - pushing them back to the backlog
Usage:
osc staging accept [--force] [LETTER...]
osc staging check [--old] REPO
osc staging cleanup_rings
osc staging freeze [--no-boostrap] PROJECT...
osc staging frozenage PROJECT...
osc staging list [--supersede]
osc staging select [--no-freeze] [--move [--from PROJECT]] LETTER REQUEST...
osc staging unselect REQUEST...
osc staging repair REQUEST...
"""
if opts.version:
self._print_version()
# verify the argument counts match the commands
if len(args) == 0:
raise oscerr.WrongArgs('No command given, see "osc help staging"!')
cmd = args[0]
if cmd in ("freeze", "frozenage", "repair"):
min_args, max_args = 1, None
elif cmd == "check":
min_args, max_args = 0, 2
elif cmd == "select":
min_args, max_args = 1, None
if not opts.add:
min_args = 2
elif cmd == "unselect":
min_args, max_args = 1, None
elif cmd == "adi":
min_args, max_args = None, None
elif cmd in ("list", "accept"):
min_args, max_args = 0, None
elif cmd in ("cleanup_rings", "acheck"):
min_args, max_args = 0, 0
else:
raise oscerr.WrongArgs("Unknown command: %s" % cmd)
if len(args) - 1 < min_args:
raise oscerr.WrongArgs("Too few arguments.")
if max_args is not None and len(args) - 1 > max_args:
raise oscerr.WrongArgs("Too many arguments.")
# Init the OBS access and configuration
opts.project = self._full_project_name(opts.project)
opts.apiurl = self.get_api_url()
opts.verbose = False
Config(opts.project)
with OBSLock(opts.apiurl, opts.project):
api = StagingAPI(opts.apiurl, opts.project)
# call the respective command and parse args by need
if cmd == "check":
prj = args[1] if len(args) > 1 else None
CheckCommand(api).perform(prj, opts.old)
elif cmd == "freeze":
for prj in args[1:]:
FreezeCommand(api).perform(api.prj_from_letter(prj), copy_bootstrap=opts.bootstrap)
elif cmd == "frozenage":
for prj in args[1:]:
print "%s last frozen %0.1f days ago" % (
api.prj_from_letter(prj),
api.days_since_last_freeze(api.prj_from_letter(prj)),
)
elif cmd == "acheck":
# Is it safe to accept? Meaning: /totest contains what it should and is not dirty
version_totest = api.get_binary_version(
api.project, "openSUSE-release.rpm", repository="totest", arch="x86_64"
)
if version_totest:
version_openqa = api.load_file_content("%s:Staging" % api.project, "dashboard", "version_totest")
totest_dirty = api.is_repo_dirty(api.project, "totest")
#.........这里部分代码省略.........