def _classify_dak_message(msg, package, keyword): package = msg.get('X-Debian-Package', package) subject = msg.get('Subject', '') xdak = msg.get('X-DAK', '') body = _get_message_body(msg) if re.search(r'^Accepted|ACCEPTED', subject): if re.search(r'^Accepted.*\(.*source.*\)', subject): mail_news.create_news(msg, package, create_package=True) if re.search(r'\.dsc\s*$', body, flags=re.MULTILINE): keyword = 'upload-source' else: keyword = 'upload-binary' else: keyword = 'archive' if xdak == 'dak rm': # Find all lines giving information about removed source packages re_rmline = re.compile(r"^\s*(\S+)\s*\|\s*(\S+)\s*\|.*source", re.M) source_removals = re_rmline.findall(body) pkglist = [] for pkgname, version in source_removals: pkglist.append(pkgname) create_dak_rm_news(msg, pkgname, version=version, body=body) package = _simplify_pkglist(pkglist, default=package) return (package, keyword)
def classify_message(msg, package, keyword): xloop = msg.get_all('X-Loop', ()) xdebian = msg.get_all('X-Debian', ()) testing_watch = msg.get('X-Testing-Watch-Package') bts_match = '*****@*****.**' in xloop dak_match = 'DAK' in xdebian if bts_match: # This is a mail of the Debian bug tracking system package, keyword = _classify_bts_message(msg, package, keyword) elif dak_match: package, keyword = _classify_dak_message(msg, package, keyword) elif testing_watch: package = testing_watch keyword = 'summary' mail_news.create_news(msg, package) # Converts old PTS keywords into new ones legacy_mapping = { 'katie-other': 'archive', 'buildd': 'build', 'ddtp': 'translation', 'cvs': 'vcs', } if keyword in legacy_mapping: keyword = legacy_mapping[keyword] return (package, keyword)
def create_dak_rm_news(message, package, body=None, version=''): """Create a :class:`News` out of a removal email sent by DAK.""" if not body: body = get_decoded_message_payload(message) suite = re.search(r"have been removed from (\S+):", body).group(1) title = "Removed {ver} from {suite}".format(ver=version, suite=suite) return mail_news.create_news(message, package, title=title)
def classify_message(msg, package, keyword): """Classify incoming email messages with a package and a keyword.""" # Default values for git commit notifications xgitrepo = msg.get('X-GitLab-Project', msg.get('X-Git-Repo')) if xgitrepo: if not package: if xgitrepo.endswith('.git'): xgitrepo = xgitrepo[:-4] package = os.path.basename(xgitrepo) if not keyword: keyword = 'vcs' xloop = msg.get_all('X-Loop', ()) xdebian = msg.get_all('X-Debian', ()) testing_watch = msg.get('X-Testing-Watch-Package') bts_match = '*****@*****.**' in xloop dak_match = 'DAK' in xdebian buildd_match = 'buildd.debian.org' in xdebian if bts_match: # This is a mail of the Debian bug tracking system package, keyword = _classify_bts_message(msg, package, keyword) elif dak_match: package, keyword = _classify_dak_message(msg, package, keyword) elif buildd_match: keyword = 'build' package = msg.get('X-Debian-Package', package) elif testing_watch: package = testing_watch keyword = 'summary' mail_news.create_news(msg, package) # Converts old PTS keywords into new ones legacy_mapping = { 'katie-other': 'archive', 'buildd': 'build', 'ddtp': 'translation', 'cvs': 'vcs', } if keyword in legacy_mapping: keyword = legacy_mapping[keyword] return (package, keyword)
def classify_message(msg, package, keyword): # Default values for git commit notifications xgitrepo = msg.get('X-Git-Repo') if xgitrepo: if not package: if xgitrepo.endswith('.git'): xgitrepo = xgitrepo[:-4] package = os.path.basename(xgitrepo) if not keyword: keyword = 'vcs' # Recognize build logs if msg.get('X-Rebuildd-Host'): match = re.search('build of (\S+)_', msg.get('Subject')) if match: keyword = 'build' package = match.group(1) # Store some messages as news if msg.get('X-Distro-Tracker-News', 'no') == 'yes' and package: mail_news.create_news(msg, package) return (package, keyword)