| 1 | # -*- perl -*- | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | # | ||||||||||||||||||||||||||||||||||||||||||
| 4 | # $Id: Rdist.pm,v 1.8 2004/03/08 10:44:59 eserte Exp $ | ||||||||||||||||||||||||||||||||||||||||||
| 5 | # Author: Slaven Rezic | ||||||||||||||||||||||||||||||||||||||||||
| 6 | # | ||||||||||||||||||||||||||||||||||||||||||
| 7 | # Copyright (C) 2002 Online Office Berlin. All rights reserved. | ||||||||||||||||||||||||||||||||||||||||||
| 8 | # Copyright (C) 2002 Slaven Rezic. | ||||||||||||||||||||||||||||||||||||||||||
| 9 | # This is free software; you can redistribute it and/or modify it under the | ||||||||||||||||||||||||||||||||||||||||||
| 10 | # terms of the GNU General Public License, see the file COPYING. | ||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | # | ||||||||||||||||||||||||||||||||||||||||||
| 13 | # Mail: slaven@rezic.de | ||||||||||||||||||||||||||||||||||||||||||
| 14 | # WWW: http://we-framework.sourceforge.net | ||||||||||||||||||||||||||||||||||||||||||
| 15 | # | ||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||
| 17 | package WE_Frontend::Publish::Rdist; | ||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||
| 19 | 1 | ▶ | use vars qw($VERSION); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 20 | 1 | $VERSION = sprintf("%d.%02d", q$Revision: 1.8 $ =~ /(\d+)\.(\d+)/); | |||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||
| 22 | package WE_Frontend::Main; | ||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||
| 24 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | 1 | ▶ | use WE_Frontend::Publish; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||
| 28 | 1 | ▶ | use File::Basename; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||
| 30 | 0 | ▶ | sub publish_rdist { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
publish_rdist: not called CC=43 SCAR=75.5
| |||||||||||||||||||||||||||||||||||||||||||
| 31 | 0 | my($self, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | my $do_exec = !delete $args{-n}; | |||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | my $v = delete $args{-verbose}; | |||||||||||||||||||||||||||||||||||||||||
| 35 | 0 | my $since = delete $args{-since}; | |||||||||||||||||||||||||||||||||||||||||
| 36 | 0 | ▶ | if (defined $since) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | warn "The -since option is ignored with publish_rdist!"; | |||||||||||||||||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | my $liveuser = $self->Config->staging->user; | |||||||||||||||||||||||||||||||||||||||||
| 40 | 0 | ▶ | if ($liveuser eq '') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | undef $liveuser; | |||||||||||||||||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | my $livedirectory = $self->Config->staging->directory; | |||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | my $livecgidirectory = $self->Config->staging->cgidirectory; | |||||||||||||||||||||||||||||||||||||||||
| 45 | 0 | my $livehost = $self->Config->staging->host; | |||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | ▶ | if (!defined $livehost || $livehost eq '') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not defined $livehost or $livehost eq ""
MC/DC0%0/2
not defined $livehost or $livehost eq ""
not defined $livehost
$livehost eq ""
Truth table0%0/3
not(A) or B
A= not defined $livehostB= $livehost eq ""
| |||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | $livehost = "localhost"; | |||||||||||||||||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | my $pubhtmldir = $self->Config->paths->pubhtmldir; | |||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | my $cgidir = $self->Config->paths->cgidir; | |||||||||||||||||||||||||||||||||||||||||
| 51 | my @extracgi = (ref $self->Config->project->stagingextracgi eq 'ARRAY' | ||||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | ▶ | ? @{ $self->Config->project->stagingextracgi } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 53 | : () | ||||||||||||||||||||||||||||||||||||||||||
| 54 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 55 | my $distfile = ($self->Config->staging->stagingext && | ||||||||||||||||||||||||||||||||||||||||||
| 56 | $self->Config->staging->stagingext->{'distfile'} | ||||||||||||||||||||||||||||||||||||||||||
| 57 | 0 | ▶ | ? $self->Config->staging->stagingext->{'distfile'} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->Config->staging->stagingext and $self->Config->staging->stagingext->{"distfile"}
MC/DC0%0/2
$self->Config->staging->stagingext and $self->Config->staging->stagingext->{"distfile"}
$self->Config->staging->stagingext
$self->Config->staging->stagingext->{"distfile"}
Truth table0%0/3
A and B
A= $self->Config->staging->stagingextB= $self->Config->staging->stagingext->{"distfile"}
| |||||||||||||||||||||||||||||||||||||||||||
| 58 | : undef); | ||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | my @extra_args; | |||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | ▶ | if (exists $args{-transport}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | my $exec = is_in_path($args{-transport}); | |||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | ▶ | if (!defined $exec) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | die "Cannot find executable for $args{-transport} in $ENV{PATH}"; | |||||||||||||||||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | push @extra_args, "-P", $exec; | |||||||||||||||||||||||||||||||||||||||||
| 66 | 0 | delete $args{-transport}; | |||||||||||||||||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||||||||||||||||
| 68 | my $deleteold = ($self->Config->staging->stagingext && | ||||||||||||||||||||||||||||||||||||||||||
| 69 | $self->Config->staging->stagingext->{'deleteold'} | ||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | ▶ | ? $self->Config->staging->stagingext->{'deleteold'} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->Config->staging->stagingext and $self->Config->staging->stagingext->{"deleteold"}
MC/DC0%0/2
$self->Config->staging->stagingext and $self->Config->staging->stagingext->{"deleteold"}
$self->Config->staging->stagingext
$self->Config->staging->stagingext->{"deleteold"}
Truth table0%0/3
A and B
A= $self->Config->staging->stagingextB= $self->Config->staging->stagingext->{"deleteold"}
| |||||||||||||||||||||||||||||||||||||||||||
| 71 | : 0); | ||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | ▶ | if (!defined $distfile) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | ▶ | if (!defined $livedirectory) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | die "\$livedirectory is not defined"; | |||||||||||||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | ▶ | if (!defined $pubhtmldir || $pubhtmldir eq '') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not defined $pubhtmldir or $pubhtmldir eq ""
MC/DC0%0/2
not defined $pubhtmldir or $pubhtmldir eq ""
not defined $pubhtmldir
$pubhtmldir eq ""
Truth table0%0/3
not(A) or B
A= not defined $pubhtmldirB= $pubhtmldir eq ""
| |||||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | die "The publish html directory is missing (config member WEsiteinfo->paths->pubhtmldir)"; | |||||||||||||||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | ▶ | if (@extracgi && (!defined $livecgidirectory || $livecgidirectory eq '')) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
@extracgi and !defined($livecgidirectory) || $livecgidirectory eq ""
not defined $livecgidirectory or $livecgidirectory eq ""
MC/DC0%0/3
@extracgi and !defined($livecgidirectory) || $livecgidirectory eq ""
@extracgi
not defined $livecgidirectory
$livecgidirectory eq ""
Truth table0%0/4
A and not(B) or C
A= @extracgiB= not defined $livecgidirectoryC= $livecgidirectory eq ""
| |||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | die "Extra CGI scripts are defined (@extracgi), | |||||||||||||||||||||||||||||||||||||||||
| 82 | but the WEsiteinfo->staging->cgidirectory config is missing"; | ||||||||||||||||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||
| 86 | # XXX same as in Rsync.pm | ||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | my @cvs_exclude_pat = @{ WE_Frontend::Publish->_min_cvs_exclude }; # XXX! | |||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | my @we_exclude_pat = @{ WE_Frontend::Publish->we_exclude }; | |||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | my @exclude_pat = (@cvs_exclude_pat, @we_exclude_pat); | |||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | my @exclude; | |||||||||||||||||||||||||||||||||||||||||
| 91 | my %additional; | ||||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | ▶ | if ($self->Config->project->stagingexceptpat) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | push @exclude_pat, @{ $self->Config->project->stagingexceptpat }; | |||||||||||||||||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | ▶ | if ($self->Config->project->stagingexcept) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | push @exclude, @{ $self->Config->project->stagingexcept }; | |||||||||||||||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | ▶ | if ($self->Config->project->stagingadditional) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | %additional = %{ $self->Config->project->stagingadditional }; | |||||||||||||||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | ▶ | if ($v) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | print <<EOF; | |||||||||||||||||||||||||||||||||||||||||
| 104 | Using rdist. | ||||||||||||||||||||||||||||||||||||||||||
| 105 | Rdist remote host: $livehost | ||||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | ▶ | Rdist remote user: @{[ defined $liveuser ? $liveuser : "current" ]} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 107 | Rdist remote directory: $livedirectory | ||||||||||||||||||||||||||||||||||||||||||
| 108 | EOF | ||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | ▶ | if (@extracgi) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | print "Rdist remote CGI directory: $livecgidirectory\n"; | |||||||||||||||||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | ▶ | print ($deleteold ? "Delete unused remote files\n" : "Leave unused remote files\n"); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | ▶ | if (@exclude) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | print "Exclude files: @exclude\n"; | |||||||||||||||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | ▶ | if (@exclude_pat) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | print "Exclude patterns: @exclude_pat\n"; | |||||||||||||||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | ▶ | if (%additional) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 120 | print "Additional files: ", | ||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | join(", ", map { "$_ => $additional{$_}" } keys %additional), | |||||||||||||||||||||||||||||||||||||||||
| 122 | "\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | print "\n"; | |||||||||||||||||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | ▶ | my $dest = (defined $liveuser ? "$liveuser\@" : "") . $livehost; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | my @directories; | |||||||||||||||||||||||||||||||||||||||||
| 130 | my @files; | ||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | my $diststring; | |||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | my @additional_cmd; | |||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | ▶ | if (!$distfile) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | $distfile = "-"; | |||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | my $exclude_pat_string = ""; | |||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | my $exclude_string = ""; | |||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | my @additional_install_string = (); | |||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | ▶ | if (@exclude_pat) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 142 | $exclude_pat_string = "\texcept_pat (" . | ||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | join("\n", map { "\t\t " . glob2rx($_) } @exclude_pat) . | |||||||||||||||||||||||||||||||||||||||||
| 144 | "\n\t\t );\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | ▶ | if (@exclude) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 147 | $exclude_string = "\texcept (" . | ||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | join("\n", map { "\t\t " . "$pubhtmldir/$_" } @exclude) . | |||||||||||||||||||||||||||||||||||||||||
| 149 | "\n\t\t );\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | ▶ | if (%additional) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | my $i = 1; | |||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | ▶ | while(my($k, $v) = each %additional) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | my $label = "additional$i"; | |||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | push @additional_cmd, $label; | |||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | push @additional_install_string, <<EOF; | |||||||||||||||||||||||||||||||||||||||||
| 157 | $label: | ||||||||||||||||||||||||||||||||||||||||||
| 158 | $pubhtmldir/$k -> $dest | ||||||||||||||||||||||||||||||||||||||||||
| 159 | install ${livedirectory}/$v ; | ||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||
| 161 | EOF | ||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | $i++; | |||||||||||||||||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||
| 166 | # dump rdist bug? There have to be more than one file! | ||||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | ▶ | if (@extracgi == 1) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | push @extracgi, @extracgi; | |||||||||||||||||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | my $cgi_files = join(" ", map { "$cgidir/$_" } @extracgi); | |||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | $diststring = <<EOF; | |||||||||||||||||||||||||||||||||||||||||
| 174 | # distfile for publishing edit to www | ||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||
| 176 | HTDOCS = ( $pubhtmldir ) | ||||||||||||||||||||||||||||||||||||||||||
| 177 | CGIFILES = ( $cgi_files ) | ||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||
| 179 | # | ||||||||||||||||||||||||||||||||||||||||||
| 180 | # htdocs | ||||||||||||||||||||||||||||||||||||||||||
| 181 | # | ||||||||||||||||||||||||||||||||||||||||||
| 182 | htdocs: | ||||||||||||||||||||||||||||||||||||||||||
| 183 | \${HTDOCS} -> $dest | ||||||||||||||||||||||||||||||||||||||||||
| 184 | install ${livedirectory} ; | ||||||||||||||||||||||||||||||||||||||||||
| 185 | $exclude_pat_string | ||||||||||||||||||||||||||||||||||||||||||
| 186 | $exclude_string | ||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | @{[ join("\n", @additional_install_string) ]} | |||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||
| 190 | # | ||||||||||||||||||||||||||||||||||||||||||
| 191 | # cgi-bin | ||||||||||||||||||||||||||||||||||||||||||
| 192 | # | ||||||||||||||||||||||||||||||||||||||||||
| 193 | cgi: | ||||||||||||||||||||||||||||||||||||||||||
| 194 | \${CGIFILES} -> $dest | ||||||||||||||||||||||||||||||||||||||||||
| 195 | install ${livecgidirectory} ; | ||||||||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||||||||
| 197 | EOF | ||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | ▶ | if ($v) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | my $line = 1; | |||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | warn join("\n", map { $line++." ".$_} split /\n/, $diststring); | |||||||||||||||||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||||||||||||||||
| 203 | } | ||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | my $cmd = "rdist -f $distfile"; | |||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | ▶ | if (!$do_exec) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | $cmd .= " -n"; | |||||||||||||||||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | ▶ | if ($deleteold) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 210 | 0 | $cmd .= " -oremove"; | |||||||||||||||||||||||||||||||||||||||||
| 211 | } | ||||||||||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | $cmd .= " " . join(" ", qw(htdocs cgi), @additional_cmd); | |||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||
| 215 | 0 | ▶ | if ($distfile eq '-') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | ▶ | warn $cmd if $v; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | ▶ | open(RDIST, "| $cmd") or die $!; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | print RDIST $diststring; | |||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | close RDIST; | |||||||||||||||||||||||||||||||||||||||||
| 220 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 221 | 0 | system($cmd); | |||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | ▶ | die "Error while executing $cmd" if $?/256!=0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 223 | } | ||||||||||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||
| 228 | 0 | ▶ | sub glob2rx { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
glob2rx: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | my $glob = shift; | |||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | my %glob2rx = ("*" => ".*", | |||||||||||||||||||||||||||||||||||||||||
| 231 | "." => "\\.", | ||||||||||||||||||||||||||||||||||||||||||
| 232 | "#" => "\\#", | ||||||||||||||||||||||||||||||||||||||||||
| 233 | ); # XXX more to follow | ||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | $glob =~ s/([\.\*\#])/$glob2rx{$1}/g; | |||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | $glob = ".*/" . $glob . ".*"; | |||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | $glob =~ s/\Q.*.*/.*/g; | |||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | $glob; | |||||||||||||||||||||||||||||||||||||||||
| 238 | } | ||||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||
| 240 | # REPO BEGIN | ||||||||||||||||||||||||||||||||||||||||||
| 241 | # REPO NAME is_in_path /home/e/eserte/src/repository | ||||||||||||||||||||||||||||||||||||||||||
| 242 | # REPO MD5 1aa226739da7a8178372aa9520d85589 | ||||||||||||||||||||||||||||||||||||||||||
| 243 | 0 | ▶ | sub is_in_path { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_in_path: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||||||||||||||||
| 244 | 0 | my($prog) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | ▶ | return $prog if (file_name_is_absolute($prog) and -x $prog); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
file_name_is_absolute($prog) and -x $prog
MC/DC0%0/2
file_name_is_absolute($prog) and -x $prog
file_name_is_absolute($prog)
-x $prog
Truth table0%0/3
A and B
A= file_name_is_absolute($prog)B= -x $prog
| |||||||||||||||||||||||||||||||||||||||||||
| 246 | 0 | require Config; | |||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | ▶ | my $sep = $Config::Config{'path_sep'} || ':'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$Config::Config{'path_sep'} || ':'
MC/DC0%0/1
$Config::Config{'path_sep'} || ':'
$Config::Config{'path_sep'}
Truth table0%0/2
A
A= $Config::Config{'path_sep'}
| |||||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | foreach (split(/$sep/o, $ENV{PATH})) { | |||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | ▶ | return "$_/$prog" if -x "$_/$prog"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 250 | } | ||||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | undef; | |||||||||||||||||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||||||||||||||||
| 253 | # REPO END | ||||||||||||||||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||||||||||||||||
| 255 | # REPO BEGIN | ||||||||||||||||||||||||||||||||||||||||||
| 256 | # REPO NAME file_name_is_absolute /home/e/eserte/src/repository | ||||||||||||||||||||||||||||||||||||||||||
| 257 | # REPO MD5 a77759517bc00f13c52bb91d861d07d0 | ||||||||||||||||||||||||||||||||||||||||||
| 258 | 0 | ▶ | sub file_name_is_absolute { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
file_name_is_absolute: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 259 | 0 | my $file = shift; | |||||||||||||||||||||||||||||||||||||||||
| 260 | 0 | my $r; | |||||||||||||||||||||||||||||||||||||||||
| 261 | 0 | eval { | |||||||||||||||||||||||||||||||||||||||||
| 262 | 0 | require File::Spec; | |||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | $r = File::Spec->file_name_is_absolute($file); | |||||||||||||||||||||||||||||||||||||||||
| 264 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | ▶ | if ($@) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | ▶ | if ($^O eq 'MSWin32') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 267 | 0 | $r = ($file =~ m;^([a-z]:(/|\\)|\\\\|//);i); | |||||||||||||||||||||||||||||||||||||||||
| 268 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 269 | 0 | $r = ($file =~ m|^/|); | |||||||||||||||||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||||||||||||||||
| 271 | } | ||||||||||||||||||||||||||||||||||||||||||
| 272 | 0 | $r; | |||||||||||||||||||||||||||||||||||||||||
| 273 | } | ||||||||||||||||||||||||||||||||||||||||||
| 274 | # REPO END | ||||||||||||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||||||||||
| 276 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||||||||||||||
| 278 | __END__ | ||||||||||||||||||||||||||||||||||||||||||