source: LMDZ6/branches/Amaury_dev/tools/fcm/sbin/fcm-install-svn-hook @ 5095

Last change on this file since 5095 was 5095, checked in by abarral, 4 months ago

Revert cosp*/ from the trunk, as it's external code
Add missing bits from FCM2 source

  • Property svn:executable set to *
File size: 2.8 KB
RevLine 
[5095]1#!/usr/bin/perl
2# ------------------------------------------------------------------------------
3# Copyright (C) 2006-2021 British Crown (Met Office) & Contributors.
4#
5# This file is part of FCM, tools for managing and building source code.
6#
7# FCM is free software: you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation, either version 3 of the License, or
10# (at your option) any later version.
11#
12# FCM is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with FCM. If not, see <http://www.gnu.org/licenses/>.
19# ------------------------------------------------------------------------------
20
21use strict;
22use warnings;
23
24use FindBin;
25use lib "$FindBin::Bin/../lib";
26use FCM::Admin::System qw{
27    filter_projects
28    get_projects_from_svn_live
29    housekeep_svn_hook_logs
30    install_svn_hook
31};
32use FCM::Admin::Util qw{option2config};
33use Getopt::Long qw{GetOptions};
34use Pod::Usage qw{pod2usage};
35
36main();
37
38sub main {
39    my %option;
40    my $result = GetOptions(
41        \%option,
42        q{clean},
43        q{help|usage|h},
44        q{svn-live-dir=s},
45        q{svn-project-suffix=s},
46    );
47    if (!$result) {
48        pod2usage(1);
49    }
50    if (exists($option{help})) {
51        pod2usage(q{-verbose} => 1);
52    }
53    option2config(\%option);
54    my @projects = filter_projects([get_projects_from_svn_live()], \@ARGV);
55    for my $project (sort {$a->get_name() cmp $b->get_name()} @projects) {
56        install_svn_hook($project, $option{clean});
57        housekeep_svn_hook_logs($project);
58    }
59}
60
61__END__
62
63=head1 NAME
64
65fcm-install-svn-hook
66
67=head1 SYNOPSIS
68
69    fcm-install-svn-hook [OPTIONS] [PROJECT ...]
70
71=head1 OPTIONS
72
73=over 4
74
75=item --clean
76
77Removes items (except logs) that are not in the install sources.
78
79=item --help, -h, --usage
80
81Prints help and exits.
82
83=item --svn-live-dir=DIR
84
85Specifies the root location of the live directory. See
86L<FCM::Admin::Config|FCM::Admin::Config> for the current default.
87
88=item --svn-project-suffix=NAME
89
90Specifies the suffix added to the project name. The default is "_svn".
91
92=back
93
94=head1 ARGUMENTS
95
96=over 4
97
98=item PROJECT
99
100Specifies one or more project requiring hooks scripts to be installed. If no
101project is specified, the program install the hook scripts to all projects in
102the live directory.
103
104=back
105
106=head1 DESCRIPTION
107
108This program install hook scripts for Subversion repositories in the live
109directory, and install/housekeep the log files for the hook scripts.
110
111=head1 COPYRIGHT
112
113Copyright (C) 2006-2021 British Crown (Met Office) & Contributors.
114
115=cut
Note: See TracBrowser for help on using the repository browser.