From 48a35fed91d557fd89eed4297d2516776434d837 Mon Sep 17 00:00:00 2001 From: Marcus Huewe Date: Tue, 15 Aug 2017 13:31:10 +0200 Subject: [PATCH] Add config option for the Package.status mtime heuristic By default, the "status_mtime_heuristic" config option is disabled. --- osc/conf.py | 8 ++++++-- osc/core.py | 9 +++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/osc/conf.py b/osc/conf.py index 2fd8e807..9829f9bd 100644 --- a/osc/conf.py +++ b/osc/conf.py @@ -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'] diff --git a/osc/core.py b/osc/core.py index d0dbe446..e1be523f 100644 --- a/osc/core.py +++ b/osc/core.py @@ -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: