def sle_workarounds_unneeded_check(self, package): # If SLE-workarounds project and package was not sourced from # SLE-workarounds, but it does exist in SLE-workarounds. if (self.sle_workarounds and not self.sle_workarounds_sourced and package in self.packages[self.sle_workarounds]): # Determine how recently the package was updated. root = ET.fromstringlist( get_commitlog(self.apiurl, self.sle_workarounds, package, None, format='xml')) updated_last = date_parse(root.find('logentry/date').text) age = datetime.now() - updated_last if age.total_seconds() < 3600 * 24: logger.debug( 'skip removal of {}/{} since updated within 24 hours'. format(self.sle_workarounds, package)) return requests = get_request_list(self.apiurl, self.sle_workarounds, package, req_type='submit') if len(requests): logger.debug('existing submit request involving {}/{}'.format( self.sle_workarounds, package)) return self.delete_request( self.sle_workarounds, package, 'sourced from {}'.format(self.lookup.get(package)))
def project_meta_revision(apiurl, project): root = ET.fromstringlist( get_commitlog(apiurl, project, '_project', None, format='xml', meta=True)) return int(root.find('logentry').get('revision'))
def revision_index(api): if not hasattr(revision_index, 'index'): root = ET.fromstring(''.join( get_commitlog(api.apiurl, api.cstaging, 'dashboard', None, format='xml'))) revision_index.index = {} for logentry in root.findall('logentry'): date = date_parse(logentry.find('date').text) revision_index.index[date] = logentry.get('revision') return revision_index.index
def revision_index(api): if not hasattr(revision_index, 'index'): revision_index.index = {} project, package = project_pseudometa_package(api.apiurl, api.project) try: root = ET.fromstringlist( get_commitlog(api.apiurl, project, package, None, format='xml')) except HTTPError as e: return revision_index.index for logentry in root.findall('logentry'): date = date_parse(logentry.find('date').text) revision_index.index[date] = logentry.get('revision') return revision_index.index
def package_source_hash_history(apiurl, project, package, limit=5, include_project_link=False): try: # get_commitlog() reverses the order so newest revisions are first. root = ETL.fromstringlist( get_commitlog(apiurl, project, package, None, format='xml')) except HTTPError as e: if e.code == 404: return raise e if include_project_link: source_hashes = [] source_md5s = root.xpath('logentry/@srcmd5') for source_md5 in source_md5s[:limit]: source_hash = package_source_hash(apiurl, project, package, source_md5) yield source_hash if include_project_link: source_hashes.append(source_hash) if include_project_link and (not limit or len(source_md5s) < limit): link = entity_source_link(apiurl, project) if link is None: return project = link.get('project') if limit: limit_remaining = limit - len(source_md5s) # Allow small margin for duplicates. for source_hash in package_source_hash_history(apiurl, project, package, None, True): if source_hash in source_hashes: continue yield source_hash if limit: limit_remaining += -1 if limit_remaining == 0: break
def sle_workarounds_unneeded_check(self, package): # If SLE-workarounds project and package was not sourced from # SLE-workarounds, but it does exist in SLE-workarounds. if (self.sle_workarounds and not self.sle_workarounds_sourced and package in self.packages[self.sle_workarounds]): # Determine how recently the package was updated. root = ET.fromstringlist( get_commitlog(self.apiurl, self.sle_workarounds, package, None, format='xml')) updated_last = date_parse(root.find('logentry/date').text) age = datetime.now() - updated_last if age.total_seconds() < 3600 * 24: logger.debug('skip removal of {}/{} since updated within 24 hours'.format( self.sle_workarounds, package)) return requests = get_request_list(self.apiurl, self.sle_workarounds, package, req_type='submit') if len(requests): logger.debug('existing submit request involving {}/{}'.format(self.sle_workarounds, package)) return self.delete_request(self.sle_workarounds, package, 'sourced from {}'.format(self.lookup.get(package)))
def project_meta_revision(apiurl, project): root = ET.fromstringlist(get_commitlog( apiurl, project, '_project', None, format='xml', meta=True)) return int(root.find('logentry').get('revision'))