Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: Simon Marchi <simon.marchi@polymtl.ca>
Cc: gdb-patches@sourceware.org, Joel Brobecker <brobecker@adacore.com>
Subject: Re: ANNOUNCEMENT: ChangeLog policy change after GDB 11
Date: Mon, 28 Jun 2021 10:28:16 -0700	[thread overview]
Message-ID: <20210628172816.GC550682@adacore.com> (raw)
In-Reply-To: <0a45d93b-a293-0a2e-91ad-0ad88cb1747e@polymtl.ca>

[-- Attachment #1: Type: text/plain, Size: 1359 bytes --]

> On 2021-06-13 11:10 a.m., Joel Brobecker wrote:
> >     - For patches with multiple authors, we ask that commits with
> >       multiple authors have a...
> > 
> >           Co-Authored-By: xxx
> > 
> >       ... git-trailer, so that complete author information be kept.
> 
> Similar to that, I was wondering if we should define a standard method
> to refer to a bug/PR number in a git trailer.  For example, for a commit
> fixing an issue:
> 
>   Fixes: PR gdb/1234
> 
> Sometimes, you make a commit that is related to a PR but does not fix it
> (for example, add a KFAIL-ed test).  In that case, it should be
> something else than "Fixes".

What about...

    Bug: PR gdb/1234

... or...

    Xref: PR gdb/1234

?

> What do people use normally for thse things?  Is it necessary, or just
> mentioning "PR gdb/1234" somewhere in the commit message's free text
> will be enough to automatically link the commit to the PR?

I believe so. FTAOD, here is the sequence in the script which
extracts the references to bugzilla PR numbers:

    while ($log_txt =~ m/\s(?:bug|PR|BZ)\s+\#?\s*(?:[a-z0-9+-]+\/)?(?:\/)?(\d+)(.*)$/si) {

Let me also attach a copy of the entire script, just in case I missed
something.

Regardless of the above, I think it would be nice if we used Git
trailers for this as it makes it easier to find that kind of information.

-- 
Joel

[-- Attachment #2: email-to-bugzilla --]
[-- Type: text/plain, Size: 3411 bytes --]

#!/usr/bin/perl
# -*-Perl-*-
#
# Perl filter to handle the log messages from the checkin of files in
# a directory.  This script will group the lists of files by log
# message, and mail a single consolidated log message at the end of
# the commit.
#
# This file assumes a pre-commit checking program that leaves the
# names of the first and last commit directories in a temporary file.
#
# Contributed by David Hampton <hampton@cisco.com>
#
# hacked greatly by Greg A. Woods <woods@web.net>
#
# Then chopped down just to send bugzilla email, for git.
use strict;

use POSIX;
use DBI;
use Mail::Header;
use Mail::Internet;

my $bugzillaproduct;

#
#	Subroutines
#
sub see_if_bugzilla_bug_exists {    
  my ($dbh, $product, $id) = @_;

  # Split $PRODUCT and SQL-ify.
  my $sql_product = '';
  for my $i (split (/\s+/, $product)) {
      if ($sql_product ne '') {
	  $sql_product .= ', ';
      }
      $sql_product .= "'" . $i . "'";
  }

  my $sth2 = $dbh->prepare ("SELECT COUNT(*) from bugs where bug_id = $id and product_id = any (select products.id from products where name in ($sql_product))") or return 0;
  $sth2->execute() or return 0;
  my $count = $sth2->fetchrow_array ();
  return $count > 0;
}

sub mail_bug_notification {
    my $name = shift;
    my $subject = shift;
    my $head = Mail::Header->new;
    $head->add('From', 'cvs-commit@gcc.gnu.org');
    $head->add('Subject', $subject);
    $head->add('To', $name);
    my $mail = Mail::Internet->new(Header => $head, Body => \@_);
    die "email send failed\n" if !$mail->send;
}

#
#	Main Body
#

# Initialize basic variables
#
my $debug = 0;

# Parse command line arguments.

while (my $arg = shift @ARGV) {
    if ($arg eq '-d') {
	$debug = 1;
	print STDERR "Debug turned on...\n";
    } elsif ($arg eq '-G') {
	die "Too many '-G' args\n" if $bugzillaproduct;
	$bugzillaproduct = shift @ARGV;
    }
}

# Used with sprintf to form name of Gnats notification mailing list.
# %s argument comse from -G option.
my $MAIL_FORMAT = '%s-bugzilla@localhost';

# Collect the body of the commit message.
binmode STDIN, ":utf8";
my @text = ();
while (<STDIN>) {
    push (@text, $_);
}

my $log_txt = join ('', @text);
my %done_ids = {};

# fche/jakub 2020-04-01 ... this following matches "Apr" and spams PR1
#while ($log_txt =~ m/[^Aa]?(?:bug|PR|BZ)\s+\#?\s*(?:[a-z+-]+\/)?(?:\/)?(\d+)(.*)$/si) {

while ($log_txt =~ m/\s(?:bug|PR|BZ)\s+\#?\s*(?:[a-z0-9+-]+\/)?(?:\/)?(\d+)(.*)$/si) {
    my $bug_id = $1;
    $log_txt = $2;
    if (!defined $done_ids{$bug_id}) {
	$done_ids{$bug_id} = 1;
	# Send mail to Bugzilla, if required.
	if ($bugzillaproduct ne '') {
	    my $dbh = undef;
	    if ($bugzillaproduct eq 'gcc') {
		$dbh = DBI->connect ("dbi:mysql:bugs", "swbugz", "everythingroses");
	    } else  {# elsif ($bugzillaproduct eq 'glibc')
		$dbh = DBI->connect ("dbi:mysql:sourcesbugs", "swbugz", "everythingroses");
	    }
	    if ($debug) {
		print STDERR "Attempting to see if bug $bug_id exists\n";
	    }
	    if (defined $dbh & see_if_bugzilla_bug_exists ($dbh, $bugzillaproduct, $bug_id)) {
		if ($debug) { print STDERR "It does\n"; }
		if ($bugzillaproduct ne 'gcc') {
		    mail_bug_notification( sprintf ($MAIL_FORMAT, "sourceware"), "[Bug $bug_id]", @text);
		} else { 
		    mail_bug_notification( sprintf ($MAIL_FORMAT, $bugzillaproduct), "[Bug $bug_id]", @text);
		}
	    }
	    $dbh->disconnect if defined $dbh;
	}
    }
}

exit 0;

  reply	other threads:[~2021-06-28 17:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-13 15:10 Joel Brobecker
2021-06-14  1:25 ` Mike Frysinger via Gdb-patches
2021-06-14 12:26   ` Pedro Alves
2021-06-27  2:42 ` Simon Marchi via Gdb-patches
2021-06-28 17:28   ` Joel Brobecker [this message]
2021-06-28 17:41     ` Simon Marchi via Gdb-patches
2021-06-28 20:59       ` Luis Machado via Gdb-patches
2021-06-29  1:10       ` Mike Frysinger via Gdb-patches
2021-06-29 10:07         ` Hannes Domani via Gdb-patches
2021-07-02  4:50           ` Mike Frysinger via Gdb-patches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210628172816.GC550682@adacore.com \
    --to=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@polymtl.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox