source: LMDZ6/branches/Amaury_dev/tools/fcm/sbin/fcm-backup-svn-repos

Last change on this file was 5129, checked in by abarral, 5 months ago

Re-add removed by mistake fcm

  • Property svn:executable set to *
File size: 3.3 KB
Line 
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    backup_svn_repository
28    filter_projects
29    get_projects_from_svn_live
30};
31use FCM::Admin::Util qw{option2config};
32use Getopt::Long qw{GetOptions};
33use Pod::Usage qw{pod2usage};
34
35main();
36
37sub main {
38    my %option;
39    my $result = GetOptions(
40        \%option,
41        q{help|usage|h},
42        q{no-housekeep-dumps},
43        q{no-pack},
44        q{no-verify-integrity},
45        q{svn-backup-dir=s},
46        q{svn-dump-dir=s},
47        q{svn-live-dir=s},
48        q{svn-project-suffix=s},
49    );
50    if (!$result) {
51        pod2usage(1);
52    }
53    if (exists($option{help})) {
54        pod2usage(q{-verbose} => 1);
55    }
56    option2config(\%option);
57    my @projects = filter_projects([get_projects_from_svn_live()], \@ARGV);
58    for my $project (@projects) {
59        backup_svn_repository(\%option, $project);
60    }
61}
62
63__END__
64
65=head1 NAME
66
67fcm-backup-svn-repos
68
69=head1 SYNOPSIS
70
71    fcm-backup-svn-repos [OPTIONS] [PROJECT ...]
72
73=head1 OPTIONS
74
75=over 4
76
77=item --help, -h, --usage
78
79Prints help and exits.
80
81=item --no-housekeep-dumps
82
83If this option is specified, the program will not housekeep the backup revision
84dumps of each repository.
85
86=item --no-pack
87
88If this option is specified, the program will not pack each repository before
89running the backup.
90
91=item --no-verify-integrity
92
93If this option is specified, the program will not verify the integrity of a
94repository before running the backup.
95
96=item --svn-backup-dir=DIR
97
98Specifies the root location of the backup directory. See
99L<FCM::Admin::Config|FCM::Admin::Config> for the current default.
100
101=item --svn-dump-dir=DIR
102
103Specifies the root location of the directory where revision dumps are kept. See
104L<FCM::Admin::Config|FCM::Admin::Config> for the current default.
105
106=item --svn-live-dir=DIR
107
108Specifies the root location of the live directory. See
109L<FCM::Admin::Config|FCM::Admin::Config> for the current default.
110
111=item --svn-project-suffix=NAME
112
113Specifies the suffix added to the project name. The default is "_svn".
114
115=back
116
117=head1 ARGUMENTS
118
119=over 4
120
121=item PROJECT
122
123Specifies one or more project to back up. If no project is specified, the
124program searches the live directory for projects to back up.
125
126=back
127
128=head1 DESCRIPTION
129
130This program archives Subversion repositories in the live directory to the
131backup directory.
132
133=head1 COPYRIGHT
134
135Copyright (C) 2006-2021 British Crown (Met Office) & Contributors.
136
137=cut
Note: See TracBrowser for help on using the repository browser.