1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-12-27 10:16:14 +01:00

Add config option for the Package.status mtime heuristic

By default, the "status_mtime_heuristic" config option is disabled.
This commit is contained in:
Marcus Huewe 2017-08-15 13:31:10 +02:00
parent 0f820e1fd5
commit 48a35fed91
2 changed files with 11 additions and 6 deletions

View File

@ -180,7 +180,10 @@ DEFAULTS = {'apiurl': 'https://api.opensuse.org',
'maintained_update_project_attribute': 'OBS:UpdateProject',
'show_download_progress': '0',
# path to the vc script
'vc-cmd': '/usr/lib/build/vc'
'vc-cmd': '/usr/lib/build/vc',
# heuristic to speedup Package.status
'status_mtime_heuristic': '0'
}
# some distros like Debian rename and move build to obs-build
@ -196,7 +199,8 @@ config = DEFAULTS.copy()
boolean_opts = ['debug', 'do_package_tracking', 'http_debug', 'post_mortem', 'traceback', 'check_filelist', 'plaintext_passwd',
'checkout_no_colon', 'checkout_rooted', 'check_for_request_on_action', 'linkcontrol', 'show_download_progress', 'request_show_interactive',
'request_show_source_buildstatus', 'review_inherit_group', 'use_keyring', 'gnome_keyring', 'no_verify', 'builtin_signature_check',
'http_full_debug', 'include_request_from_project', 'local_service_run', 'buildlog_strip_time', 'no_preinstallimage']
'http_full_debug', 'include_request_from_project', 'local_service_run', 'buildlog_strip_time', 'no_preinstallimage',
'status_mtime_heuristic']
api_host_options = ['user', 'pass', 'passx', 'aliases', 'http_headers', 'email', 'sslcertck', 'cafile', 'capath', 'trusted_prj']

View File

@ -1843,7 +1843,6 @@ class Package:
"""
alwaysdigest = False
known_by_meta = False
exists = False
exists_in_store = False
@ -1867,10 +1866,12 @@ class Package:
state = 'A'
elif exists and exists_in_store and known_by_meta:
filemeta = self.findfilebyname(n)
if (alwaysdigest or os.path.getmtime(localfile) != filemeta.mtime) and dgst(localfile) != filemeta.md5:
state = ' '
if conf.config['status_mtime_heuristic']:
if os.path.getmtime(localfile) != filemeta.mtime:
state = 'M'
elif dgst(localfile) != filemeta.md5:
state = 'M'
else:
state = ' '
elif n in self.to_be_added and not exists:
state = '!'
elif not exists and exists_in_store and known_by_meta and not n in self.to_be_deleted: