/usr/share/perl5/Rex/SCM/Subversion.pm is in rex 1.4.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | package Rex::SCM::Subversion;
use strict;
use warnings;
our $VERSION = '1.4.1'; # VERSION
use Cwd qw(getcwd);
use Rex::Commands::Fs;
use Rex::Commands::Run;
use vars qw($CHECKOUT_COMMAND);
BEGIN {
my $version = qx{svn --version --quiet 2>/dev/null};
if ($version) {
my @parts = split( /\./, $version );
if ( $parts[1] <= 5 ) {
$CHECKOUT_COMMAND = "svn --non-interactive %s checkout %s %s";
}
else {
$CHECKOUT_COMMAND =
"svn --non-interactive --trust-server-cert %s checkout %s %s";
}
}
}
sub new {
my $that = shift;
my $proto = ref($that) || $that;
my $self = {@_};
bless( $self, $proto );
return $self;
}
sub checkout {
my ( $self, $repo_info, $checkout_to, $checkout_opt ) = @_;
my $special_opts = "";
if ( exists $repo_info->{"username"} ) {
$special_opts = " --username '" . $repo_info->{"username"} . "'";
}
if ( exists $repo_info->{"password"} ) {
$special_opts .= " --password '" . $repo_info->{"password"} . "'";
}
my $checkout_cmd;
if ( !is_dir($checkout_to) ) {
$checkout_cmd = sprintf( $CHECKOUT_COMMAND,
$special_opts, $repo_info->{"url"}, $checkout_to );
}
elsif ( is_dir("$checkout_to/.svn") ) {
$checkout_cmd = "svn up $checkout_to";
}
else {
Rex::Logger::info( "Error checking out repository.", "warn" );
die("Error checking out repository.");
}
Rex::Logger::debug("checkout_cmd: $checkout_cmd");
Rex::Logger::info( "Cloning "
. $repo_info->{"url"} . " to "
. ( $checkout_to ? $checkout_to : "." ) );
my $out = run "$checkout_cmd";
unless ( $? == 0 ) {
Rex::Logger::info( "Error checking out repository.", "warn" );
Rex::Logger::info($out);
die("Error checking out repository.");
}
}
1;
|