/[debichem]/check_watch_files.pl
ViewVC logotype

Contents of /check_watch_files.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2251 - (show annotations) (download)
Sun Dec 6 16:25:55 2009 UTC (3 years, 5 months ago) by dleidert-guest
File MIME type: text/plain
File size: 2340 byte(s)
Minor updates/improvements.

1 #!/usr/bin/perl -w
2 #
3 # Written for the debichem project by Daniel Leidert <daniel.leidert@wgdd.de>,
4 # 2007, 2009.
5 #
6 # Released into public domain.
7
8 use strict;
9 use warnings;
10
11 # Only send a mail if there is some output!
12 our $send = 0;
13
14 # The following function simply parses an SVN tree and puts all top-level
15 # directories into an array, which is then returned.
16 sub fillPackageArray ($) {
17 my ($repository) = @_;
18
19 open (TREE, "/usr/bin/svnlook tree -N /svn/debichem $repository |");
20 my @array = map { $_ =~ /^ ([^\s]+)\/$/m ; } (grep { $_ =~ m/^ [^\s]+\/$/m ; } <TREE>);
21 close (TREE);
22
23 return @array;
24 }
25
26 # The following function greps the watch-file and the changelog-file. From the
27 # latter the version and package information is read and used for manually
28 # calling uscan.
29 sub checkWatchFile ($\@) {
30 my ($repository, $packages) = @_;
31 my $output = "Report for packages in $repository\n";
32 $output .= "**************************************************\n\n";
33
34 my $svncat = "/usr/bin/svnlook cat /svn/debichem";
35
36 foreach (@$packages) {
37 my $watchpath = $repository . "/" . "$_" . "/debian/watch";
38 my $chglgpath = $repository . "/" . "$_" . "/debian/changelog";
39 my $chglgfile = `$svncat $chglgpath | /usr/bin/dpkg-parsechangelog -l-`;
40 my ($package, $version) = ($chglgfile =~ /^Source: (.*?)$/m, $chglgfile =~ /^Version: ([^-]+)-.*$/m);
41
42 if ( ! system("$svncat $watchpath >> /dev/null 2>&1") ) {
43 my $watchfile = `$svncat $watchpath`;
44
45 open (USCAN, "$svncat $watchpath | /usr/bin/uscan --no-download --watchfile -" .
46 " --package $package --upstream-version $version 2>&1 |");
47
48 my @tmp = <USCAN>;
49 if (@tmp) {
50 $output .= "@tmp\n";
51 $send = 1; # We have some output!
52 }
53
54 close (USCAN);
55 } else {
56 $output .= "** Warning: $package has no watch file $watchpath. **\n\n";
57 }
58 }
59
60 $output .= "\n\n";
61 return $output;
62 }
63
64
65 my $packages = {'unstable' => [], 'wnpp' => []};
66 my $report;
67
68 foreach my $key (keys %$packages) {
69 @{$packages->{$key}} = fillPackageArray ($key);
70 $report .= checkWatchFile ($key, @{$packages->{$key}});
71 }
72
73 if ($send != 0) {
74 open (INFOMAIL, "| /usr/bin/mail -s 'Weekly infolist of updatable packages for the debichem project'" .
75 " 'Debichem Team <debichem-devel\@lists.alioth.debian.org>'");
76 print INFOMAIL $report;
77 close (INFOMAIL);
78 }
79
80 exit(0);

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.5