From patchwork Tue Aug 16 12:16:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Martin_Li=C5=A1ka?= X-Patchwork-Id: 659697 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3sDBDc2jVmz9s3T for ; Tue, 16 Aug 2016 22:16:47 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=BeeLAfOi; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:to:references:cc:from:message-id:date:mime-version :in-reply-to:content-type; q=dns; s=default; b=avJ0VxaV/J3D+xaRB 8Igu+vnFOyhJCnUqzNdUcJR384ZRzf5H+Zl9093Mn66+YMqqO7pfrzlMmGxg5TBx iGrPhvL+ns+DE21LXjlI5kb2/z53ved/HY+wjvX6idHvlQ6JmbcN73uVSVOmupvh +oowAhMiqkyDwIMqpz5TjJubnM= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:to:references:cc:from:message-id:date:mime-version :in-reply-to:content-type; s=default; bh=E6vNNkT3l+1pFVjImXHKXpa 3UI4=; b=BeeLAfOi7VUKJNgX5AYMh3bHDpz+WnueNtXR5puIJ11nL1MK6E13FuL dLcTPqK/kjZqrCdZAgJtZxH60HySaLdZFJjrqgV764W+Tex7uTITayZFDa3Vwy1T SI1xaBHKSQyfSD5Il0v/tnS7VxVGssGGKqwrB0nxh16WrVPX8pH8= Received: (qmail 105277 invoked by alias); 16 Aug 2016 12:16:39 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 105245 invoked by uid 89); 16 Aug 2016 12:16:38 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00, SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:2420 X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 16 Aug 2016 12:16:28 +0000 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 07ACDAD54; Tue, 16 Aug 2016 12:16:25 +0000 (UTC) Subject: Re: [PATCH] Add mark_spam.py script To: Joseph Myers References: <638988ed-6829-48da-bd2f-fa9b08d3d264@suse.cz> <4d5881ab-e4c0-d3e7-ae11-f580bbd19074@suse.cz> <20160815093720.GK14857@tucnak.redhat.com> <7612362f-79c9-69e8-de44-0fe352513768@suse.cz> <20160815094856.GL14857@tucnak.redhat.com> <0e7ba8a7-ad1a-76a7-a4ac-07400474c33b@suse.cz> Cc: Jakub Jelinek , GCC Patches From: =?UTF-8?Q?Martin_Li=c5=a1ka?= Message-ID: Date: Tue, 16 Aug 2016 14:16:25 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2 MIME-Version: 1.0 In-Reply-To: X-IsSubscribed: yes On 08/16/2016 12:02 AM, Joseph Myers wrote: > On Mon, 15 Aug 2016, Martin Liška wrote: > >> It can, currently we mark as spam just the first comment. If there's a spam PR >> which contains multiple comments, I'll extend the script. > > There certainly are spam bugs where the spammer pasted their spam in a > comment after creating the bug, rather than putting it in the initial bug > description; see bug 76607, for example. Maybe all comments created by > the original bug submitter should be considered as spam, not just the > initial bug description? > Hi. Looks the bug has been already removed (which is good). Script improvement does exactly what Joseph suggested. If there's no objection, I'll commit it tomorrow. Martin From 98309a80a08b1d9e5f51c1e28f35322aaca8a52c Mon Sep 17 00:00:00 2001 From: marxin Date: Tue, 16 Aug 2016 14:14:07 +0200 Subject: [PATCH] mark_spam.py: Mark as spam all comments done by a creator contrib/ChangeLog: 2016-08-16 Martin Liska * mark_spam.py: Mark as spam all comments done by a creator. --- contrib/mark_spam.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/contrib/mark_spam.py b/contrib/mark_spam.py index f206356..86f46a1 100755 --- a/contrib/mark_spam.py +++ b/contrib/mark_spam.py @@ -39,7 +39,9 @@ def mark_as_spam(id, api_key, verbose): return # 2) mark the bug as spam - cc_list = response['bugs'][0]['cc'] + bug = response['bugs'][0] + creator = bug['creator'] + cc_list = bug['cc'] data = { 'status': 'RESOLVED', 'resolution': 'INVALID', @@ -64,13 +66,15 @@ def mark_as_spam(id, api_key, verbose): # 3) mark the first comment as spam r = requests.get(u + '/comment') response = json.loads(r.text) - comment_id = response['bugs'][str(id)]['comments'][0]['id'] - - u2 = '%sbug/comment/%d/tags' % (base_url, comment_id) - r = requests.put(u2, json = {'comment_id': comment_id, 'add': ['spam'], 'api_key': api_key}) - if verbose: - print(r) - print(r.text) + for c in response['bugs'][str(id)]['comments']: + if c['creator'] == creator: + comment_id = c['id'] + u2 = '%sbug/comment/%d/tags' % (base_url, comment_id) + print(u2) + r = requests.put(u2, json = {'comment_id': comment_id, 'add': ['spam'], 'api_key': api_key}) + if verbose: + print(r) + print(r.text) # 4) mark all attachments as spam r = requests.get(u + '/attachment') -- 2.9.2