[5129] | 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 | |
---|
| 21 | use strict; |
---|
| 22 | use warnings; |
---|
| 23 | |
---|
| 24 | use FindBin; |
---|
| 25 | use lib "$FindBin::Bin/../lib"; |
---|
| 26 | use FCM::Admin::System qw{ |
---|
| 27 | backup_svn_repository |
---|
| 28 | filter_projects |
---|
| 29 | get_projects_from_svn_live |
---|
| 30 | }; |
---|
| 31 | use FCM::Admin::Util qw{option2config}; |
---|
| 32 | use Getopt::Long qw{GetOptions}; |
---|
| 33 | use Pod::Usage qw{pod2usage}; |
---|
| 34 | |
---|
| 35 | main(); |
---|
| 36 | |
---|
| 37 | sub 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 | |
---|
| 67 | fcm-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 | |
---|
| 79 | Prints help and exits. |
---|
| 80 | |
---|
| 81 | =item --no-housekeep-dumps |
---|
| 82 | |
---|
| 83 | If this option is specified, the program will not housekeep the backup revision |
---|
| 84 | dumps of each repository. |
---|
| 85 | |
---|
| 86 | =item --no-pack |
---|
| 87 | |
---|
| 88 | If this option is specified, the program will not pack each repository before |
---|
| 89 | running the backup. |
---|
| 90 | |
---|
| 91 | =item --no-verify-integrity |
---|
| 92 | |
---|
| 93 | If this option is specified, the program will not verify the integrity of a |
---|
| 94 | repository before running the backup. |
---|
| 95 | |
---|
| 96 | =item --svn-backup-dir=DIR |
---|
| 97 | |
---|
| 98 | Specifies the root location of the backup directory. See |
---|
| 99 | L<FCM::Admin::Config|FCM::Admin::Config> for the current default. |
---|
| 100 | |
---|
| 101 | =item --svn-dump-dir=DIR |
---|
| 102 | |
---|
| 103 | Specifies the root location of the directory where revision dumps are kept. See |
---|
| 104 | L<FCM::Admin::Config|FCM::Admin::Config> for the current default. |
---|
| 105 | |
---|
| 106 | =item --svn-live-dir=DIR |
---|
| 107 | |
---|
| 108 | Specifies the root location of the live directory. See |
---|
| 109 | L<FCM::Admin::Config|FCM::Admin::Config> for the current default. |
---|
| 110 | |
---|
| 111 | =item --svn-project-suffix=NAME |
---|
| 112 | |
---|
| 113 | Specifies 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 | |
---|
| 123 | Specifies one or more project to back up. If no project is specified, the |
---|
| 124 | program searches the live directory for projects to back up. |
---|
| 125 | |
---|
| 126 | =back |
---|
| 127 | |
---|
| 128 | =head1 DESCRIPTION |
---|
| 129 | |
---|
| 130 | This program archives Subversion repositories in the live directory to the |
---|
| 131 | backup directory. |
---|
| 132 | |
---|
| 133 | =head1 COPYRIGHT |
---|
| 134 | |
---|
| 135 | Copyright (C) 2006-2021 British Crown (Met Office) & Contributors. |
---|
| 136 | |
---|
| 137 | =cut |
---|