source: soft/build_system/build_system/upload/robot/trunk/changelog.test @ 1

Last change on this file since 1 was 1, checked in by fasma, 13 years ago

Initial Import from Mandriva's soft revision 224062 and package revision 45733

File size: 2.1 KB
Line 
1#!/usr/bin/perl
2# -*- Mode: cperl -*-
3# Send a changelog to $list
4
5use strict;
6use RPM::Header;
7use MIME::Words qw(encode_mimewords);
8use vars qw($contrib $debug $frozen);
9
10$debug=1;
11
12if ($ARGV[0] =~ /^-c/) {
13    $contrib++;
14    shift;
15}
16
17if ($ARGV[0] =~ /^-d/) {
18    $debug++;
19    shift;
20}
21
22if ($ARGV[0] =~ /^-f/) {
23    $frozen++;
24    shift;
25}
26
27my $rpm = shift or die "Give me a fuel for my aeroplane\n";
28my $list = "Changelog List <changelog\@linux-mandrake.com>";
29local *M;
30
31my $changelog = `~/robot/ch $rpm`;die "Can't ~/robot/ch $rpm: $!" if $?;chomp $changelog;
32my $maintain = `~/robot/ch -m $rpm`;die "Can't ~/robot/ch -m $rpm: $!" if $?;chomp $maintain;
33$maintain =~ s|<.*\@.*>||;
34
35my %header;
36my $description = `rpm -qpi $rpm`;die "Can't ~/robot/ch -m $rpm: $!" if $?;
37tie %header, "RPM::Header", $rpm or die "ERROR: $RPM::err\n";
38my ($name, $version, $release, $buildarchs, $exclusivearch, $excludearch) = @header{qw(NAME VERSION RELEASE BUILDARCHS EXCLUSIVEARCH EXCLUDEARCH)};
39
40$description .= "\n";
41$description .= "Buildarchs: @$buildarchs " if ref $buildarchs;
42$description .= "Exclusivearch: $exclusivearch " if $exclusivearch;
43$description .= "Excludearch: $excludearch" if $excludearch;
44
45unless ($debug) {
46    open M, "|/usr/sbin/sendmail -B8BITMIME -oi -t " or die "Can't fork for sendmail: $!\n";select M;
47}
48
49print "From: ", encode_mimewords($maintain), "<devel\@mandriva.com>\nTo: $list\nReply-To: cooker\@linux-mandrake.com\nSender: devel\@mandriva.com\n";
50
51my $srpms;
52
53if ($contrib) {
54    print "Subject: [Contrib-Rpm] $name-$version-$release\n\n[Contrib-RPM]\n\n";
55    $srpms = '/contrib/SRPMS';
56} else {
57  if ($frozen) {
58    print "Subject: [Frozen-CHRPM] $name-$version-$release\n\n";
59    $srpms = '/frozen/SRPMS';
60  } else {
61    print "Subject: [CHRPM] $name-$version-$release\n\n";
62    $srpms = '/SRPMS';
63  }
64}
65
66my $diff = `~/bin/diffsrcrpm $rpm $srpms`;
67my $rpmlint = `rpmlint $rpm`;
68
69print "--=-=-=\n$description\n--=-=-=\n\n";
70$changelog ? print $changelog, "\n" : print "Nothing :-( ......\n";
71print "--=-=-=\n$rpmlint\n--=-=-=\n";
72print "$diff\n--=-=-=\n\n";
73print "-- \nhttp://www.mandrake-linux.com/en/cookerdevel.php3\n";
74
75
76close M unless $debug;
77
Note: See TracBrowser for help on using the repository browser.