diff options
author | Nicolas Vigier <boklm@mageia.org> | 2013-05-21 18:03:48 +0000 |
---|---|---|
committer | Nicolas Vigier <boklm@mageia.org> | 2013-05-21 18:03:48 +0000 |
commit | cb58bdf62649202bf35ea416ca42a525254372b6 (patch) | |
tree | 53b683d8bf3b8229154f4da362edf453ef9f039a /old | |
parent | bca06a9fdfc8f3793bbe4f9dcfc3bcbc905b64e2 (diff) | |
download | release-cb58bdf62649202bf35ea416ca42a525254372b6.tar release-cb58bdf62649202bf35ea416ca42a525254372b6.tar.gz release-cb58bdf62649202bf35ea416ca42a525254372b6.tar.bz2 release-cb58bdf62649202bf35ea416ca42a525254372b6.tar.xz release-cb58bdf62649202bf35ea416ca42a525254372b6.zip |
Move old script to old/ directory
Diffstat (limited to 'old')
-rwxr-xr-x | old/packages-svn | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/old/packages-svn b/old/packages-svn new file mode 100755 index 0000000..31d2368 --- /dev/null +++ b/old/packages-svn @@ -0,0 +1,111 @@ +#!/usr/bin/perl -w + +use strict; + +use SVN::Core; +use SVN::Ra; +use MDK::Common; +use Data::Dumper; + +# autoflush output +$| = 1; + +my $repo_url = 'file:///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; +} + +sub list_from_file +{ + my @res = cat_($_[0]); + chomp @res; + return @res; +} + +sub print_branch_packages +{ + my ($distrorelease, $pkglist) = @_; + my $ra = SVN::Ra->new($repo_url); + for my $pkgname (@$pkglist) { + my $rev = path_rev($ra, "cauldron/$pkgname/pristine"); + print "echo Branching package $pkgname\n"; + print "svn cp -m 'SILENT: Branching $pkgname at revision $rev for Mageia $distrorelease' $repo_url/cauldron/$pkgname\@$rev ", + "$repo_url/updates/$distrorelease/$pkgname \n", + + } +} + +sub print_modified_packages +{ + my ($pkglist) = @_; + + my $modpkg = modified_packages($pkglist); + + 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"; + } + } +} + +my $packages_list_file = $ARGV[0]; +my @packages_list = list_from_file($packages_list_file); +print_branch_packages('2', \@packages_list); +#print_modified_packages(\@packages_list); |