From owner-freebsd-cvsweb Mon Mar 24 14:45:28 2003 Delivered-To: freebsd-cvsweb@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 63A6637B401 for ; Mon, 24 Mar 2003 14:45:22 -0800 (PST) Received: from fapdns01.systor.com (fapdns01.systor.com [193.192.230.116]) by mx1.FreeBSD.org (Postfix) with SMTP id 6F0A643F93 for ; Mon, 24 Mar 2003 14:45:16 -0800 (PST) (envelope-from peter.klausner@systor.com) Received: (qmail 6966 invoked from network); 24 Mar 2003 22:33:37 -0000 Received: from unknown (HELO henderson.systor.com) (172.17.247.196) by fapdns01.systor.com with SMTP; 24 Mar 2003 22:33:37 -0000 MIME-Version: 1.0 To: freebsd-cvsweb@FreeBSD.org From: "Peter Klausner" Subject: More complex links to PR database Date: Mon, 24 Mar 2003 23:45:13 +0100 Message-ID: X-MIMETrack: Serialize by Router on HENDERSON/SYSTOR(Release 5.0.11 |July 24, 2002) at 24.03.2003 23:45:14 Content-type: text/plain; charset=us-ascii X-Spam-Status: No, hits=-1.6 required=5.0 tests=HTML_00_10,HTML_MESSAGE,PATCH_CONTEXT_DIFF version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) Sender: owner-freebsd-cvsweb@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Cvsweb has a feature to link the comment text to a (web-based) problem report database like GNAT. Below is a small patch, which allows you to configure a _routine_ to link to your PR/CR/MR/whatever system. The example pr_link() implements the existing behaviour plus links to T-Wiki pages. Of course, it is more difficult to configure such a routine, than the existing variables. But I guess, that admins, who actually use this feature, will appreciate the flexibility. HTH + Bye Peter Klausner Index: cvsweb.conf =================================================================== RCS file: /var/cvs/cgi-bin/cvsweb.conf,v retrieving revision 1.3 diff -c -r1.3 cvsweb.conf *** cvsweb.conf 2003/03/14 13:55:56 1.3 --- cvsweb.conf 2003/03/17 17:42:37 *************** *** 9,15 **** # based on work by Bill Fenner # # $FreeBSD: projects/cvsweb/cvsweb.conf,v 1.43 2002/11/16 00:01:01 scop Exp $ ! # $Id: cvsweb.conf,v 1.3 2003/03/14 13:55:56 peter Exp $ # $Idaemons: /home/cvs/cvsweb/cvsweb.conf,v 1.27 2001/08/01 09:48:39 knu Exp $ # ### --- 9,15 ---- # based on work by Bill Fenner # # $FreeBSD: projects/cvsweb/cvsweb.conf,v 1.43 2002/11/16 00:01:01 scop Exp $ ! # $Id: cvsweb.conf,v 1.4 2003/03/14 18:01:40 peter Exp $ # $Idaemons: /home/cvs/cvsweb/cvsweb.conf,v 1.27 2001/08/01 09:48:39 knu Exp $ # ### *************** *** 66,94 **** # you enter the page $cvstreedefault = $CVSrepositories[2 * 0]; # The first one - ############## - # Bug tracking system options - # ("PR" means Problem Report, as in GNATS) - ############## - #@prcategories = qw( - # advocacy - # alpha - # bin - # conf - # docs - # gnu - # i386 - # kern - # misc - # pending - # ports - # sparc - #); ! # ! #$prcgi = "http://www.FreeBSD.org/cgi/query-pr.cgi?pr=%s"; # ! #$prkeyword = "PR"; ############## # Manual gateway --- 66,90 ---- # you enter the page $cvstreedefault = $CVSrepositories[2 * 0]; # The first one ! # Bug tracking system options: ! # Define a subroutine to scan cvs comment for linkable patterns. # ! sub pr_link ! { ! my $comment = $_[0]; # return this comment with links ! ! $comment =~ s|\bPR[#: ]*(\d+)\b|PR#$1|g; ! $comment =~ s(\b(advocacy|alpha|bin|conf|docs|gnu|i386)/(\d+)\b) ! ($1/$2)g; ! ! $comment =~ m/^(.*?)([A-Z][A-Za-z0-9_-]+)(.*)$/s; # a wiki word? ! return "$1$2$3" ! if -f "/var/twiki/data/Aproject/$2.txt"; ! return "$1$2$3" ! if -f "/var/twiki/data/Bproject/$2.txt"; ! return $comment; ! } ! ############## # Manual gateway Index: cvsweb.cgi =================================================================== RCS file: /var/cvs/cgi-bin/cvsweb.cgi,v retrieving revision 1.4 retrieving revision 1.5 diff -c -r1.4 -r1.5 *** cvsweb.cgi 2003/03/14 13:55:56 1.4 --- cvsweb.cgi 2003/03/14 18:01:40 1.5 *************** *** 47,53 **** # # $Zeller: cvsweb.cgi,v 1.112 2001/07/24 13:03:16 hzeller Exp $ # $FreeBSD: projects/cvsweb/cvsweb.cgi,v 1.137 2002/11/24 16:29:13 scop Exp $ ! # @(#)$Id: cvsweb.cgi,v 1.4 2003/03/14 13:55:56 peter Exp $ # ### --- 47,53 ---- # # $Zeller: cvsweb.cgi,v 1.112 2001/07/24 13:03:16 hzeller Exp $ # $FreeBSD: projects/cvsweb/cvsweb.cgi,v 1.137 2002/11/24 16:29:13 scop Exp $ ! # @(#)$Id: cvsweb.cgi,v 1.5 2003/03/14 18:01:40 peter Exp $ # ### *************** *** 498,506 **** } undef $config_cvstree; - $re_prcategories = '(?:' . join ('|', @prcategories) . ')' if @prcategories; - $re_prkeyword = quotemeta($prkeyword) if defined($prkeyword); - $prcgi .= '%s' if defined($prcgi) && $prcgi !~ /%s/; $fullname = "$cvsroot/$where"; $mimetype = &getMimeTypeFromSuffix($fullname); --- 498,503 ---- *************** *** 1256,1295 **** >egix; } $_; ! if ($extra) { ! # get PR #'s as link: "PR#nnnn" "PR: nnnn, ..." "PR nnnn, ..." "bin/nnnn" ! if (defined($prcgi) && defined($re_prkeyword)) { ! my $prev; ! ! do { ! $prev = $_; ! ! $_ = htmlify_sub { ! s{ ! (\b$re_prkeyword[:\#]?\s* ! (?: ! \#? ! \d+[,\s]\s* ! )* ! \#?) ! (\d+)\b ! }{ ! $1 . &link($2, sprintf($prcgi, $2)) ! }egix; ! } $_; ! } while ($_ ne $prev); ! ! if (defined($re_prcategories)) { ! $_ = htmlify_sub { ! s{ ! (\b$re_prcategories/(\d+)\b) ! }{ ! &link($1, sprintf($prcgi, $2)) ! }egox; ! } $_; ! } ! } # get manpage specs as link: "foo.1" "foo(1)" if (defined($mancgi)) { --- 1253,1261 ---- >egix; } $_; ! $_ = pr_link($_) or die "pr_link fehlt!?"; ! if ($extra) { # get manpage specs as link: "foo.1" "foo(1)" if (defined($mancgi)) { To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-cvsweb" in the body of the message