summaryrefslogtreecommitdiff
path: root/what-to-build.pl
blob: 4c63cbaaa072c5e3632ecb2e64f5f7d322522484 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/perl

use strict;
use warnings;

my @dirs = @ARGV;

unless (@dirs) {
	@dirs = glob 'p/*/';
}

my @to_build;

my %tags;
open TAGS, '-|', 'git tag -l' or die @!;
while (<TAGS>) { chomp; $tags{$_}++ };
close TAGS or die @!;

for my $dir (@dirs) {
	my $changelog = "$dir/debian/changelog";
	next unless -r $changelog;
	open CHANGELOG, '<', $changelog or die @!;
	my $firstline = <CHANGELOG>;
	if ($firstline =~ m/([\w-]+) \(([\w:~.+-]+)\) (\w+);/) {
		my ($source, $version, $suite) = ($1, $2, $3);
		my $tag = sprintf "%s_v%s", $source, $version;
		next if ($suite eq "UNRELEASED");
		next if ($tags{$tag});
		printf "%s\n", $dir;
	} else {
		printf STDERR "Cannot parse %s:\n%s", $changelog, $firstline;
		next
	}
}