aboutsummaryrefslogtreecommitdiffstats
path: root/packages-svn
blob: e3fc1f7b6db2530947901b217366f9467c644a35 (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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/usr/bin/perl -w

use strict;

use SVN::Core;
use SVN::Ra;
use Data::Dumper;

# autoflush output
$| = 1;

my $repo_url = 'svn://svn.mageia.org/svn/packages';

sub path_rev
{
    my ($ra, $path) = @_;
    if ($ra->check_path($path, $SVN::Core::INVALID_REVNUM)
	== $SVN::Node::none) {
	return 0;
    } else {
	return ($ra->get_dir($path,
	    $SVN::Core::INVALID_REVNUM))[2]{'svn:entry:committed-rev'};
    }
}

sub package_revs
{
    my ($ra, $pkgname) = @_;

    (
	path_rev($ra, "cauldron/$pkgname/current"),
	path_rev($ra, "cauldron/$pkgname/pristine"),
    )
}

sub package_diff
{
    my $pkgname = shift;
    my $ctx = SVN::Client->new();
    print '-' x 67, "\n";
    print "- $pkgname -", '-' x (63 - length $pkgname), "\n";
    print '-' x 67, "\n\n";
    print "svn diff $pkgname/pristine $pkgname/current\n";
    $ctx->diff([], "$repo_url/cauldron/$pkgname/pristine", 'HEAD', 
	"$repo_url/cauldron/$pkgname/current", 'HEAD', 1, 0, 0,
	\*STDOUT, \*STDOUT);
}

sub modified_packages
{
    my ($pkg_list) = @_;
    my $ra = SVN::Ra->new($repo_url);
    my %modpkg;

    for my $pkg (@$pkg_list) {
	my @revs = package_revs($ra, $pkg);
	if ($revs[0] > $revs[1]) {
	    $modpkg{$pkg} = \@revs;
	}
    }
    \%modpkg;
}

sub list_cauldron_packages
{
    my $ctx = SVN::Client->new();
    my @l = keys $ctx->ls("$repo_url/cauldron", 'HEAD', 0);
    \@l;
}

my $modpkg = modified_packages(list_cauldron_packages());

print join "\n", sort keys %$modpkg;
print "\n\n";
for my $pkg (sort keys %$modpkg) {
    if ($modpkg->{$pkg}[0] && $modpkg->{$pkg}[1]) {
	package_diff($pkg);
	print "\n\n\n";
    }
}