2004-05-14 14:35:20 +02:00
|
|
|
#!/usr/bin/perl -w
|
|
|
|
#
|
|
|
|
# Copyright (c) 2004 Oliver Eikemeier. All rights reserved.
|
|
|
|
#
|
|
|
|
# Redistribution and use in source and binary forms, with or without
|
|
|
|
# modification, are permitted provided that the following conditions are
|
|
|
|
# met:
|
|
|
|
#
|
|
|
|
# 1. Redistributions of source code must retain the above copyright notice
|
|
|
|
# this list of conditions and the following disclaimer.
|
|
|
|
#
|
|
|
|
# 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer in the
|
|
|
|
# documentation and/or other materials provided with the distribution.
|
|
|
|
#
|
|
|
|
# 3. Neither the name of the author nor the names of its contributors may be
|
|
|
|
# used to endorse or promote products derived from this software without
|
|
|
|
# specific prior written permission.
|
|
|
|
#
|
|
|
|
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
|
|
|
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
|
|
# AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
|
|
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
#
|
|
|
|
# $FreeBSD$
|
|
|
|
#
|
2006-11-23 13:16:59 +01:00
|
|
|
# MAINTAINER= erwin@FreeBSD.org
|
2004-05-14 14:35:20 +02:00
|
|
|
#
|
2004-05-17 02:04:56 +02:00
|
|
|
# PORTVERSION and PKGORIGIN auditing script
|
2004-05-14 14:35:20 +02:00
|
|
|
#
|
2004-05-17 02:04:56 +02:00
|
|
|
# This scripts compares version numbers with previously known ones, and
|
|
|
|
# checks ports for a correct PKGORIGIN. It is primarily intended to be run
|
|
|
|
# from a (non-root) cron job.
|
2004-05-14 14:35:20 +02:00
|
|
|
#
|
2004-05-17 02:04:56 +02:00
|
|
|
# If you just call it with no preparation, it will compare all port versions
|
|
|
|
# with their INDEX entries and complain if they have gone backwards. You need
|
|
|
|
# You need an old INDEX for this, of course. An up-to-date INDEX will accomplish
|
|
|
|
# nothing.
|
2004-05-14 14:35:20 +02:00
|
|
|
#
|
|
|
|
# To use the script as intended, do the following (assuming you want to
|
|
|
|
# run the script as user `ports'):
|
2004-05-19 16:30:25 +02:00
|
|
|
#
|
2004-05-14 14:35:20 +02:00
|
|
|
# install port sysutils/pkg_install-devel (optional)
|
|
|
|
# mkdir -p /var/db/chkversion
|
|
|
|
# touch /var/db/chkversion/VERSIONS
|
|
|
|
# chown -R ports /var/db/chkversion
|
2004-05-19 16:30:25 +02:00
|
|
|
# and enter something like
|
|
|
|
#
|
|
|
|
# CVSBLAME=yes
|
|
|
|
# ALLPORTS=yes
|
|
|
|
# RCPT_ORIGIN=you@domain.example
|
|
|
|
# RCPT_VERSION=you@domain.example
|
|
|
|
# 0 */2 * * * /usr/ports/Tools/scripts/chkversion.pl
|
|
|
|
#
|
|
|
|
# into `crontab -u ports -e', or run the script by hand if you can spare the time.
|
2004-05-14 14:35:20 +02:00
|
|
|
#
|
2004-05-17 02:04:56 +02:00
|
|
|
# If the environment variable CVSBLAME is set and the ports tree is checked
|
|
|
|
# out by CVS, every entry is listed with a record of the last CVS commit.
|
|
|
|
#
|
2004-05-14 14:35:20 +02:00
|
|
|
|
|
|
|
require 5.005;
|
|
|
|
use strict;
|
2006-11-23 15:04:52 +01:00
|
|
|
use POSIX;
|
2004-05-14 23:07:39 +02:00
|
|
|
use File::Find;
|
|
|
|
use Cwd 'abs_path';
|
2004-05-14 14:35:20 +02:00
|
|
|
|
2004-05-21 18:23:10 +02:00
|
|
|
my $portsdir = $ENV{PORTSDIR} ? $ENV{PORTSDIR} : '/usr/ports';
|
|
|
|
my $versiondir = $ENV{VERSIONDIR} ? $ENV{VERSIONDIR} : '/var/db/chkversion';
|
|
|
|
my $cvsblame = $ENV{CVSBLAME} ? 1 : 0;
|
|
|
|
my $allports = $ENV{ALLPORTS} ? 1 : 0;
|
|
|
|
|
|
|
|
my $watchre = $ENV{WATCH_REGEX} ? $ENV{WATCH_REGEX} : '';
|
|
|
|
my $watchmre = $ENV{WATCHM_REGEX} ? $ENV{WATCHM_REGEX} : '';
|
|
|
|
my $returnpath = $ENV{RETURNPATH} ? $ENV{RETURNPATH} : '';
|
|
|
|
my $h_from = $ENV{HEADER_FROM} ? $ENV{HEADER_FROM} : "$ENV{USER}\@$ENV{HOST}";
|
|
|
|
my $h_replyto = $ENV{HEADER_REPLYTO} ? $ENV{HEADER_REPLYTO} : $h_from;
|
|
|
|
my $rcpt_watch = $ENV{RCPT_WATCH} ? $ENV{RCPT_WATCH} : '';
|
|
|
|
my $rcpt_watchm = $ENV{RCPT_WATCHM} ? $ENV{RCPT_WATCHM} : '';
|
|
|
|
my $rcpt_orig = $ENV{RCPT_ORIGIN} ? $ENV{RCPT_ORIGIN} : '';
|
|
|
|
my $rcpt_vers = $ENV{RCPT_VERSION} ? $ENV{RCPT_VERSION} : '';
|
2004-05-30 12:44:51 +02:00
|
|
|
my $cc_author = $ENV{CC_AUTHOR} ? 1 : 0;
|
|
|
|
my $cc_mntnr = $ENV{CC_MAINTAINER} ? 1 : 0;
|
2004-05-14 14:35:20 +02:00
|
|
|
|
2004-05-17 02:04:56 +02:00
|
|
|
my $make = '/usr/bin/make';
|
|
|
|
my $cvs = '/usr/bin/cvs';
|
2004-05-14 14:35:20 +02:00
|
|
|
my $pkg_version =
|
2004-05-17 02:04:56 +02:00
|
|
|
$ENV{PKG_VERSION} && -x $ENV{PKG_VERSION} ? $ENV{PKG_VERSION}
|
|
|
|
: -x '/usr/local/sbin/pkg_version' ? '/usr/local/sbin/pkg_version'
|
|
|
|
: '/usr/sbin/pkg_version';
|
2004-05-19 16:30:25 +02:00
|
|
|
my $sendmail = '/usr/sbin/sendmail';
|
|
|
|
|
2004-05-21 18:23:10 +02:00
|
|
|
my $watch_re = join '|', split ' ', $watchre;
|
|
|
|
my $watchm_re = join '|', split ' ', $watchmre;
|
2004-05-14 14:35:20 +02:00
|
|
|
|
2004-05-17 02:04:56 +02:00
|
|
|
-d $portsdir or die "Can't find ports tree at $portsdir.\n";
|
2004-05-14 23:07:39 +02:00
|
|
|
$portsdir = abs_path($portsdir);
|
2004-05-14 14:35:20 +02:00
|
|
|
|
2004-05-17 02:04:56 +02:00
|
|
|
my $versionfile = "$versiondir/VERSIONS";
|
|
|
|
my $useindex = !-w $versiondir;
|
|
|
|
|
2006-11-23 15:04:52 +01:00
|
|
|
my $starttime = strftime("%a %b %e %G %k:%M:%S %Z",localtime);
|
2006-11-23 12:59:04 +01:00
|
|
|
|
2004-05-17 02:04:56 +02:00
|
|
|
sub readfrom {
|
|
|
|
my $dir = shift;
|
|
|
|
|
|
|
|
if (!open CHILD, '-|') {
|
|
|
|
open STDERR, '>/dev/null';
|
|
|
|
chdir $dir if $dir;
|
|
|
|
exec @_;
|
|
|
|
die;
|
|
|
|
}
|
|
|
|
my @childout = <CHILD>;
|
|
|
|
close CHILD;
|
|
|
|
|
2004-05-17 19:09:01 +02:00
|
|
|
map chomp, @childout;
|
2004-05-14 14:35:20 +02:00
|
|
|
|
2004-05-17 02:04:56 +02:00
|
|
|
return wantarray ? @childout : $childout[0];
|
|
|
|
}
|
2004-05-14 14:35:20 +02:00
|
|
|
|
2007-02-01 04:28:03 +01:00
|
|
|
foreach (qw(ARCH OPSYS OSREL OSVERSION PKGINSTALLVER UID)) {
|
2004-05-17 02:04:56 +02:00
|
|
|
my @cachedenv = readfrom $portsdir, $make, "-V$_";
|
|
|
|
$ENV{$_} = $cachedenv[0];
|
2004-05-16 12:46:47 +02:00
|
|
|
}
|
2004-05-17 02:04:56 +02:00
|
|
|
$ENV{WITH_OPENSSL_BASE} = 'yes';
|
2004-05-16 12:46:47 +02:00
|
|
|
|
2004-05-14 14:35:20 +02:00
|
|
|
my %pkgname;
|
2004-05-17 02:04:56 +02:00
|
|
|
my %pkgorigin;
|
2004-06-05 00:23:03 +02:00
|
|
|
my %masterdir;
|
2004-05-30 12:44:51 +02:00
|
|
|
my %pkgmntnr;
|
2004-05-14 14:35:20 +02:00
|
|
|
|
|
|
|
sub wanted {
|
2004-05-17 02:04:56 +02:00
|
|
|
return
|
|
|
|
if !-d;
|
|
|
|
|
|
|
|
if (/^CVS$/
|
2004-05-14 14:35:20 +02:00
|
|
|
|| $File::Find::name =~
|
|
|
|
m"^$portsdir/(?:Mk|Templates|Tools|distfiles|packages)$"os
|
2004-05-17 02:04:56 +02:00
|
|
|
|| $File::Find::name =~ m"^$portsdir/[^/]+/pkg$"os)
|
|
|
|
{
|
|
|
|
$File::Find::prune = 1;
|
|
|
|
}
|
|
|
|
elsif ($File::Find::name =~ m"^$portsdir/([^/]+/[^/]+)$"os) {
|
2004-05-19 16:30:25 +02:00
|
|
|
$File::Find::prune = 1;
|
2004-05-30 12:44:51 +02:00
|
|
|
if (-f "$File::Find::name/Makefile") {
|
|
|
|
my @makevar = readfrom $File::Find::name,
|
2004-06-05 00:23:03 +02:00
|
|
|
$make, '-VPKGORIGIN', '-VPKGNAME', '-VMAINTAINER', '-VMASTERDIR';
|
2004-05-30 12:44:51 +02:00
|
|
|
|
2004-06-05 00:23:03 +02:00
|
|
|
if ($#makevar == 3 && $makevar[1]) {
|
2004-05-30 12:44:51 +02:00
|
|
|
$pkgorigin{$1} = $makevar[0]
|
|
|
|
if $1 ne $makevar[0];
|
|
|
|
$pkgname{$1} = $makevar[1];
|
|
|
|
$pkgmntnr{$1} = $makevar[2];
|
2004-06-05 00:23:03 +02:00
|
|
|
$masterdir{$1} = $makevar[3];
|
2004-05-30 12:44:51 +02:00
|
|
|
}
|
2004-05-21 18:23:10 +02:00
|
|
|
}
|
2004-05-17 02:04:56 +02:00
|
|
|
}
|
2004-05-14 14:35:20 +02:00
|
|
|
}
|
|
|
|
|
2004-05-17 19:09:01 +02:00
|
|
|
if ($allports) {
|
|
|
|
find(\&wanted, $portsdir);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
my @categories = split ' ', readfrom $portsdir, $make, '-VSUBDIR';
|
|
|
|
|
|
|
|
foreach my $category (@categories) {
|
|
|
|
-f "$portsdir/$category/Makefile" || next;
|
|
|
|
my @ports = split ' ',
|
|
|
|
readfrom "$portsdir/$category", $make, '-VSUBDIR';
|
|
|
|
foreach (map "$category/$_", @ports) {
|
|
|
|
-f "$portsdir/$_/Makefile" || next;
|
2004-06-05 00:23:03 +02:00
|
|
|
|
2004-05-17 19:09:01 +02:00
|
|
|
my @makevar = readfrom "$portsdir/$_",
|
2004-06-05 00:23:03 +02:00
|
|
|
$make, '-VPKGORIGIN', '-VPKGNAME', '-VMAINTAINER', '-VMASTERDIR';
|
2004-05-19 16:30:25 +02:00
|
|
|
|
2004-06-05 00:23:03 +02:00
|
|
|
next if $#makevar != 3 || ! $makevar[1];
|
2004-05-17 19:09:01 +02:00
|
|
|
$pkgorigin{$_} = $makevar[0]
|
2004-05-21 18:23:10 +02:00
|
|
|
if $_ ne $makevar[0];
|
|
|
|
$pkgname{$_} = $makevar[1];
|
2004-05-30 12:44:51 +02:00
|
|
|
$pkgmntnr{$_} = $makevar[2];
|
2004-06-05 00:23:03 +02:00
|
|
|
$masterdir{$_} = $makevar[3];
|
2004-05-17 19:09:01 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2004-05-14 14:35:20 +02:00
|
|
|
|
|
|
|
my %backwards;
|
2004-05-19 16:30:25 +02:00
|
|
|
my %watched;
|
2004-05-21 18:23:10 +02:00
|
|
|
my %watchedm;
|
2004-05-14 14:35:20 +02:00
|
|
|
|
2004-05-17 02:04:56 +02:00
|
|
|
if ($useindex) {
|
|
|
|
my $indexname = readfrom $portsdir, $make, '-VINDEXFILE';
|
|
|
|
$versionfile = "$portsdir/$indexname";
|
|
|
|
}
|
|
|
|
|
2004-05-14 14:35:20 +02:00
|
|
|
open VERSIONS, "<$versionfile";
|
|
|
|
|
|
|
|
while (<VERSIONS>) {
|
|
|
|
chomp;
|
|
|
|
next if /^(#|$)/;
|
2004-05-21 18:23:10 +02:00
|
|
|
my ($origin, $version, $maintainer);
|
2004-05-14 14:35:20 +02:00
|
|
|
if ($useindex) {
|
2004-05-21 18:23:10 +02:00
|
|
|
($origin, $version, $maintainer) = (split /\|/)[1,0,5];
|
2004-05-14 14:35:20 +02:00
|
|
|
$origin =~ s,^.*/([^/]+/[^/]+)/?$,$1,;
|
|
|
|
}
|
|
|
|
else {
|
2004-05-21 18:23:10 +02:00
|
|
|
($origin, $version, $maintainer) = split /\t/;
|
2004-05-14 14:35:20 +02:00
|
|
|
}
|
|
|
|
if (defined $pkgname{$origin}) {
|
|
|
|
my $newversion = $pkgname{$origin};
|
|
|
|
my $oldversion = $version;
|
|
|
|
|
|
|
|
$newversion =~ s/^.*-//;
|
|
|
|
$oldversion =~ s/^.*-//;
|
|
|
|
|
2004-05-18 10:53:39 +02:00
|
|
|
my $result = $newversion eq $oldversion ? '=' : readfrom '',
|
2004-05-17 19:09:01 +02:00
|
|
|
$pkg_version, '-t', $newversion, $oldversion;
|
2004-05-19 16:30:25 +02:00
|
|
|
|
|
|
|
$watched{$origin} = "$version -> $pkgname{$origin}"
|
2004-05-21 18:23:10 +02:00
|
|
|
if ($watch_re && $result ne '=' && $origin =~ /^(?:$watch_re)$/o);
|
|
|
|
|
|
|
|
$watchedm{$origin} = "(was <$maintainer>) $version -> $pkgname{$origin}"
|
2004-05-30 12:44:51 +02:00
|
|
|
if ($watchm_re && $maintainer && $pkgmntnr{$origin}
|
|
|
|
&& $maintainer ne $pkgmntnr{$origin} && $origin =~ /^(?:$watchm_re)$/o);
|
2004-05-19 16:30:25 +02:00
|
|
|
|
2004-05-14 14:35:20 +02:00
|
|
|
if ($result eq '<') {
|
|
|
|
$backwards{$origin} = "$pkgname{$origin} < $version";
|
|
|
|
$pkgname{$origin} = $version;
|
|
|
|
}
|
|
|
|
}
|
2004-05-30 12:44:51 +02:00
|
|
|
elsif ($origin) {
|
2004-05-14 14:35:20 +02:00
|
|
|
$pkgname{$origin} = $version;
|
2004-05-30 12:44:51 +02:00
|
|
|
$pkgmntnr{$origin} = $maintainer;
|
2004-05-14 14:35:20 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
close VERSIONS;
|
|
|
|
|
|
|
|
if (!$useindex) {
|
2004-05-17 02:04:56 +02:00
|
|
|
system 'mv', '-f', $versionfile, "$versionfile.bak";
|
2004-05-14 14:35:20 +02:00
|
|
|
|
|
|
|
open VERSIONS, ">$versionfile";
|
2004-05-19 16:30:25 +02:00
|
|
|
foreach (sort keys %pkgname) {
|
2004-05-30 12:44:51 +02:00
|
|
|
print VERSIONS "$_\t$pkgname{$_}\t$pkgmntnr{$_}\n";
|
2004-05-19 16:30:25 +02:00
|
|
|
}
|
2004-05-14 14:35:20 +02:00
|
|
|
close VERSIONS;
|
|
|
|
}
|
|
|
|
|
2004-05-30 12:44:51 +02:00
|
|
|
my %revision;
|
2004-06-05 00:23:03 +02:00
|
|
|
|
|
|
|
sub parsemakefile {
|
|
|
|
my ($portdir) = @_;
|
|
|
|
my ($r, $d, $a);
|
|
|
|
|
|
|
|
open MAKEFILE, "<$portdir/Makefile";
|
|
|
|
while (<MAKEFILE>) {
|
|
|
|
if (m'\$FreeBSD\: [^\$ ]+,v (\d+(?:\.\d+)+) (\d{4}(?:[/-]\d{2}){2} \d{2}(?::\d{2}){2}) (\w+) [\w ]+\$') {
|
|
|
|
($r, $d, $a) = ($1, $2, $3);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
close MAKEFILE;
|
|
|
|
|
|
|
|
return ($r, $d, $a);
|
|
|
|
}
|
2004-05-30 12:44:51 +02:00
|
|
|
|
|
|
|
sub getauthors {
|
|
|
|
my ($ports) = @_;
|
2004-06-05 00:23:03 +02:00
|
|
|
|
|
|
|
my %author;
|
2004-05-30 12:44:51 +02:00
|
|
|
foreach my $origin (keys %{$ports}) {
|
|
|
|
if (!$revision{$origin}) {
|
2004-06-05 00:23:03 +02:00
|
|
|
my ($r, $d, $a) = parsemakefile "$portsdir/$origin";
|
|
|
|
push @{$revision{$origin}}, $r;
|
|
|
|
push @{$author{$origin}}, $a;
|
|
|
|
if ($masterdir{$origin} ne "$portsdir/$origin") {
|
|
|
|
($r, $d, $a) = parsemakefile $masterdir{$origin};
|
|
|
|
push @{$revision{$origin}}, $r;
|
|
|
|
push @{$author{$origin}}, $a;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return %author;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub printlog {
|
|
|
|
my ($fh, $portdir, $r) = @_;
|
|
|
|
|
|
|
|
if ($cvsblame && -d "$portsdir/CVS") {
|
|
|
|
my @cvslog = readfrom $portdir,
|
|
|
|
$cvs, '-R', 'log', '-N', '-r' . ($r ? $r : '.'), 'Makefile';
|
|
|
|
foreach (@cvslog) {
|
|
|
|
my $in_log = /^-{28}$/ ... /^(-{28}|={77})$/;
|
|
|
|
print $fh " | $_\n"
|
|
|
|
if ($in_log && $in_log != 1 && $in_log !~ /E0$/);
|
2004-05-30 12:44:51 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-05-17 02:04:56 +02:00
|
|
|
sub blame {
|
2004-05-19 16:30:25 +02:00
|
|
|
my ($fh, $ports) = @_;
|
2004-05-17 02:04:56 +02:00
|
|
|
|
|
|
|
if (%{$ports}) {
|
2004-05-19 16:30:25 +02:00
|
|
|
foreach my $origin (sort keys %{$ports}) {
|
2004-05-30 12:44:51 +02:00
|
|
|
print $fh "- *$origin* <$pkgmntnr{$origin}>: $ports->{$origin}\n";
|
2004-06-05 00:23:03 +02:00
|
|
|
printlog $fh, "$portsdir/$origin", $revision{$origin}[0];
|
|
|
|
if ($masterdir{$origin} ne "$portsdir/$origin") {
|
|
|
|
my $master = $masterdir{$origin};
|
|
|
|
$master =~ s/^$portsdir\///o;
|
|
|
|
while ($master =~ s/(^|\/)[^\/]+\/\.\.(?:\/|$)/$1/) {}
|
|
|
|
print $fh " (master: $master)\n";
|
|
|
|
printlog $fh, $masterdir{$origin}, $revision{$origin}[1];
|
2004-05-19 16:30:25 +02:00
|
|
|
}
|
2004-06-05 00:23:03 +02:00
|
|
|
print $fh "\n";
|
2004-05-19 16:30:25 +02:00
|
|
|
}
|
|
|
|
print $fh "\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sub template {
|
2006-11-23 12:59:04 +01:00
|
|
|
my ($from, $rcpt, $replyto, $starttime, $ports) = @_;
|
2004-05-30 12:44:51 +02:00
|
|
|
|
|
|
|
my $portlist = join ', ', sort keys %{$ports};
|
|
|
|
substr($portlist, 32) = '...'
|
|
|
|
if length $portlist > 35;
|
|
|
|
|
|
|
|
my %cclist;
|
2004-06-05 00:23:03 +02:00
|
|
|
my %author = getauthors $ports;
|
|
|
|
|
2004-05-30 12:44:51 +02:00
|
|
|
if ($cc_author) {
|
2004-06-05 00:23:03 +02:00
|
|
|
foreach (map @{$author{$_} ? $author{$_} : []}, keys %{$ports}) {
|
2004-05-30 12:44:51 +02:00
|
|
|
$cclist{"$_\@FreeBSD.org"} = 1
|
|
|
|
if $_;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ($cc_mntnr) {
|
|
|
|
foreach (map $pkgmntnr{$_}, keys %{$ports}) {
|
|
|
|
$cclist{$_} = 1
|
|
|
|
if $_;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
my $cc = join ', ', sort keys %cclist;
|
2004-05-19 16:30:25 +02:00
|
|
|
|
|
|
|
my $header = '';
|
|
|
|
while (<main::DATA>) {
|
|
|
|
last if /^\.\n?$/;
|
|
|
|
$_ =~ s/%%FROM%%/$from/og;
|
|
|
|
$_ =~ s/%%RCPT%%/$rcpt/og;
|
2004-05-30 12:44:51 +02:00
|
|
|
$_ =~ s/%%CC%%/$cc/og;
|
2004-05-19 16:30:25 +02:00
|
|
|
$_ =~ s/%%REPLYTO%%/$replyto/og;
|
2004-05-30 12:44:51 +02:00
|
|
|
$_ =~ s/%%SUBJECT%%/$portlist/og;
|
2006-11-23 12:59:04 +01:00
|
|
|
$_ =~ s/%%STARTTIME%%/$starttime/og;
|
2004-05-19 16:30:25 +02:00
|
|
|
$header .= $_;
|
|
|
|
}
|
|
|
|
return $header;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub mail {
|
|
|
|
my ($template, $rcpt, $ports) = @_;
|
|
|
|
|
|
|
|
if (%{$ports}) {
|
|
|
|
if ($rcpt) {
|
|
|
|
if (!open MAIL, '|-') {
|
|
|
|
exec $sendmail, '-oi', '-t', '-f', $returnpath;
|
|
|
|
die;
|
2004-05-17 02:04:56 +02:00
|
|
|
}
|
2004-05-19 16:30:25 +02:00
|
|
|
print MAIL $template;
|
|
|
|
blame *MAIL, $ports;
|
|
|
|
close MAIL;
|
|
|
|
} else {
|
|
|
|
$template =~ s/^.*?\n\n//os;
|
|
|
|
print $template;
|
|
|
|
blame *STDOUT, $ports;
|
2004-05-14 23:07:39 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2004-05-17 02:04:56 +02:00
|
|
|
|
2004-05-19 16:30:25 +02:00
|
|
|
my $tmpl;
|
|
|
|
|
2006-11-23 12:59:04 +01:00
|
|
|
$tmpl = template $h_from, $rcpt_orig, $h_replyto, $starttime, \%pkgorigin;
|
2004-05-19 16:30:25 +02:00
|
|
|
mail $tmpl, $rcpt_orig, \%pkgorigin;
|
|
|
|
|
2006-11-23 12:59:04 +01:00
|
|
|
$tmpl = template $h_from, $rcpt_vers, $h_replyto, $starttime, \%backwards;
|
2004-05-19 16:30:25 +02:00
|
|
|
mail $tmpl, $rcpt_vers, \%backwards;
|
|
|
|
|
2006-11-23 12:59:04 +01:00
|
|
|
$tmpl = template $h_from, $rcpt_watch, $h_replyto, $starttime, \%watched;
|
2004-05-19 16:30:25 +02:00
|
|
|
mail $tmpl, $rcpt_watch, \%watched;
|
2004-05-17 02:04:56 +02:00
|
|
|
|
2006-11-23 12:59:04 +01:00
|
|
|
$tmpl = template $h_from, $rcpt_watch, $h_replyto, $starttime, \%watchedm;
|
2004-05-21 18:23:10 +02:00
|
|
|
mail $tmpl, $rcpt_watchm, \%watchedm;
|
|
|
|
|
2004-05-17 02:04:56 +02:00
|
|
|
exit((%pkgorigin || %backwards) ? 1 : 0);
|
2004-05-19 16:30:25 +02:00
|
|
|
|
|
|
|
__END__
|
|
|
|
From: %%FROM%%
|
|
|
|
To: %%RCPT%%
|
2004-05-30 12:44:51 +02:00
|
|
|
CC: %%CC%%
|
2004-05-19 16:30:25 +02:00
|
|
|
Reply-To: %%REPLYTO%%
|
2004-05-30 12:44:51 +02:00
|
|
|
Subject: Ports with a broken PKGORIGIN: %%SUBJECT%%
|
2004-06-05 00:23:03 +02:00
|
|
|
X-FreeBSD-Chkversion: PKGORIGIN
|
2004-05-19 16:30:25 +02:00
|
|
|
|
2004-05-30 12:44:51 +02:00
|
|
|
** The following ports have an incorrect PKGORIGIN **
|
2004-05-19 16:30:25 +02:00
|
|
|
|
|
|
|
PKGORIGIN connects packaged or installed ports to the directory they
|
|
|
|
originated from. This is essential for tools like pkg_version or
|
|
|
|
portupgrade to work correctly. Wrong PKGORIGINs are often caused by a
|
|
|
|
wrong order of CATEGORIES after a repocopy.
|
|
|
|
|
2004-06-05 00:23:03 +02:00
|
|
|
Please fix any errors as soon as possible.
|
|
|
|
|
2006-11-23 12:59:04 +01:00
|
|
|
The ports tree was updated at %%STARTTIME%%.
|
|
|
|
|
2004-05-19 16:30:25 +02:00
|
|
|
.
|
|
|
|
From: %%FROM%%
|
|
|
|
To: %%RCPT%%
|
2004-05-30 12:44:51 +02:00
|
|
|
CC: %%CC%%
|
2004-05-19 16:30:25 +02:00
|
|
|
Reply-To: %%REPLYTO%%
|
2004-05-30 12:44:51 +02:00
|
|
|
Subject: Ports with version numbers going backwards: %%SUBJECT%%
|
2004-06-05 00:23:03 +02:00
|
|
|
X-FreeBSD-Chkversion: backwards
|
2004-05-19 16:30:25 +02:00
|
|
|
|
|
|
|
** The following ports have a version number that sorts before a previous one **
|
|
|
|
|
|
|
|
For many package tools to work correctly, it is of utmost importance that
|
|
|
|
version numbers of a port form a monotonic increasing sequence over time.
|
|
|
|
Refer to the FreeBSD Porter's Handbook, 'Package Naming Conventions' for
|
|
|
|
more information. Tools that won't work include pkg_version, portupgrade
|
2004-05-30 12:44:51 +02:00
|
|
|
and portaudit. A common error is an accidental deletion of PORTEPOCH.
|
2004-05-19 16:30:25 +02:00
|
|
|
|
2004-06-05 00:23:03 +02:00
|
|
|
Please fix any errors as soon as possible.
|
|
|
|
|
2006-11-23 12:59:04 +01:00
|
|
|
The ports tree was updated at %%STARTTIME%%.
|
|
|
|
|
2004-05-19 16:30:25 +02:00
|
|
|
.
|
|
|
|
From: %%FROM%%
|
|
|
|
To: %%RCPT%%
|
|
|
|
Reply-To: %%REPLYTO%%
|
2004-05-30 12:44:51 +02:00
|
|
|
Subject: Version changes in your watched ports: %%SUBJECT%%
|
2004-06-05 00:23:03 +02:00
|
|
|
X-FreeBSD-Chkversion: vwatch
|
2004-05-19 16:30:25 +02:00
|
|
|
|
|
|
|
** The following ports have changed version numbers **
|
|
|
|
|
|
|
|
You have requested to be notified of version changes in the following
|
|
|
|
ports:
|
|
|
|
|
2006-11-23 12:59:04 +01:00
|
|
|
The ports tree was updated at %%STARTTIME%%.
|
|
|
|
|
2004-05-19 16:30:25 +02:00
|
|
|
.
|
2004-05-21 18:23:10 +02:00
|
|
|
From: %%FROM%%
|
|
|
|
To: %%RCPT%%
|
|
|
|
Reply-To: %%REPLYTO%%
|
2004-05-30 12:44:51 +02:00
|
|
|
Subject: Maintainer changes in your watched ports: %%SUBJECT%%
|
2004-06-05 00:23:03 +02:00
|
|
|
X-FreeBSD-Chkversion: mwatch
|
2004-05-21 18:23:10 +02:00
|
|
|
|
|
|
|
** The following ports have changed maintainers **
|
|
|
|
|
|
|
|
You have requested to be notified of maintainer changes in the following
|
|
|
|
ports:
|
|
|
|
|
2006-11-23 12:59:04 +01:00
|
|
|
The ports tree was updated at %%STARTTIME%%.
|
|
|
|
|
2004-05-21 18:23:10 +02:00
|
|
|
.
|