[1469] | 1 | #!/usr/bin/perl -w
|
---|
| 2 | #
|
---|
| 3 | # Project Builder VCS module
|
---|
| 4 | # VCS subroutines brought by the the Project-Builder project
|
---|
| 5 | # which can be easily used across projects needing to perform
|
---|
| 6 | # VCS related operations
|
---|
| 7 | #
|
---|
| 8 | # $Id$
|
---|
| 9 | #
|
---|
[2202] | 10 | # Copyright B. Cornec 2007-today
|
---|
[1560] | 11 | # Eric Anderson's changes are (c) Copyright 2012 Hewlett Packard
|
---|
[1469] | 12 | # Provided under the GPL v2
|
---|
| 13 |
|
---|
| 14 | package ProjectBuilder::VCS;
|
---|
| 15 |
|
---|
| 16 | use strict 'vars';
|
---|
[1535] | 17 | use Carp 'confess';
|
---|
[1800] | 18 | use Cwd 'abs_path';
|
---|
[1469] | 19 | use Data::Dumper;
|
---|
| 20 | use English;
|
---|
| 21 | use File::Basename;
|
---|
| 22 | use File::Copy;
|
---|
| 23 | use POSIX qw(strftime);
|
---|
| 24 | use lib qw (lib);
|
---|
| 25 | use ProjectBuilder::Version;
|
---|
| 26 | use ProjectBuilder::Base;
|
---|
| 27 | use ProjectBuilder::Conf;
|
---|
| 28 |
|
---|
| 29 | # Inherit from the "Exporter" module which handles exporting functions.
|
---|
| 30 |
|
---|
| 31 | use vars qw($VERSION $REVISION @ISA @EXPORT);
|
---|
| 32 | use Exporter;
|
---|
| 33 |
|
---|
| 34 | # Export, by default, all the functions into the namespace of
|
---|
| 35 | # any code which uses this module.
|
---|
| 36 |
|
---|
| 37 | our @ISA = qw(Exporter);
|
---|
[2267] | 38 | our @EXPORT = qw(pb_vcs_export pb_vcs_get_uri pb_vcs_copy pb_vcs_checkout pb_vcs_up pb_vcs_checkin pb_vcs_isdiff pb_vcs_add pb_vcs_add_if_not_in pb_vcs_cmd pb_vcs_compliant pb_vcs_conf_update_v0);
|
---|
[1469] | 39 | ($VERSION,$REVISION) = pb_version_init();
|
---|
| 40 |
|
---|
| 41 | =pod
|
---|
| 42 |
|
---|
| 43 | =head1 NAME
|
---|
| 44 |
|
---|
[2268] | 45 | ProjectBuilder::VCS, part of project-builder.org
|
---|
[1469] | 46 |
|
---|
| 47 | =head1 DESCRIPTION
|
---|
| 48 |
|
---|
| 49 | This modules provides version control system functions.
|
---|
| 50 |
|
---|
| 51 | =head1 USAGE
|
---|
| 52 |
|
---|
| 53 | =over 4
|
---|
| 54 |
|
---|
| 55 | =item B<pb_vcs_export>
|
---|
| 56 |
|
---|
| 57 | This function exports a VCS content to a directory.
|
---|
| 58 | The first parameter is the URL of the VCS content.
|
---|
| 59 | The second parameter is the directory in which it is locally exposed (result of a checkout). If undef, then use the original VCS content.
|
---|
| 60 | The third parameter is the directory where we want to deliver it (result of export).
|
---|
| 61 | It returns the original tar file if we need to preserve it and undef if we use the produced one.
|
---|
| 62 |
|
---|
| 63 | =cut
|
---|
| 64 |
|
---|
| 65 | sub pb_vcs_export {
|
---|
| 66 |
|
---|
| 67 | my $uri = shift;
|
---|
| 68 | my $source = shift;
|
---|
| 69 | my $destdir = shift;
|
---|
| 70 | my $tmp;
|
---|
| 71 | my $tmp1;
|
---|
| 72 |
|
---|
| 73 | pb_log(1,"pb_vcs_export uri: $uri - destdir: $destdir\n");
|
---|
| 74 | pb_log(1,"pb_vcs_export source: $source\n") if (defined $source);
|
---|
| 75 | my @date = pb_get_date();
|
---|
| 76 | # If it's not flat, then we have a real uri as source
|
---|
| 77 | my ($scheme, $account, $host, $port, $path) = pb_get_uri($uri);
|
---|
| 78 | my $vcscmd = pb_vcs_cmd($scheme);
|
---|
| 79 | $uri = pb_vcs_mod_socks($uri);
|
---|
| 80 |
|
---|
| 81 | if ($scheme =~ /^svn/) {
|
---|
| 82 | if (defined $source) {
|
---|
| 83 | if (-d $source) {
|
---|
| 84 | $tmp = $destdir;
|
---|
| 85 | } else {
|
---|
| 86 | $tmp = "$destdir/".basename($source);
|
---|
| 87 | }
|
---|
| 88 | $source = pb_vcs_mod_htftp($source,"svn");
|
---|
| 89 | pb_system("$vcscmd export $source $tmp","Exporting $source from $scheme to $tmp ");
|
---|
| 90 | } else {
|
---|
| 91 | $uri = pb_vcs_mod_htftp($uri,"svn");
|
---|
| 92 | pb_system("$vcscmd export $uri $destdir","Exporting $uri from $scheme to $destdir ");
|
---|
| 93 | }
|
---|
| 94 | } elsif ($scheme eq "svk") {
|
---|
| 95 | my $src = $source;
|
---|
| 96 | if (defined $source) {
|
---|
| 97 | if (-d $source) {
|
---|
| 98 | $tmp = $destdir;
|
---|
| 99 | } else {
|
---|
| 100 | $tmp = "$destdir/".basename($source);
|
---|
| 101 | $src = dirname($source);
|
---|
| 102 | }
|
---|
| 103 | $source = pb_vcs_mod_htftp($source,"svk");
|
---|
| 104 | # This doesn't exist !
|
---|
| 105 | # pb_system("$vcscmd export $path $tmp","Exporting $path from $scheme to $tmp ");
|
---|
| 106 | pb_log(4,"$uri,$source,$destdir,$scheme, $account, $host, $port, $path,$tmp");
|
---|
| 107 | if (-d $source) {
|
---|
| 108 | pb_system("mkdir -p $tmp ; cd $tmp; tar -cf - -C $source . | tar xf -","Exporting $source from $scheme to $tmp ");
|
---|
| 109 | } else {
|
---|
| 110 | # If source is file do not use -C with source
|
---|
| 111 | pb_system("mkdir -p ".dirname($tmp)." ; cd ".dirname($tmp)."; tar -cf - -C $src ".basename($source)." | tar xf -","Exporting $src/".basename($source)." from $scheme to $tmp ");
|
---|
| 112 | }
|
---|
| 113 | } else {
|
---|
| 114 | # Look at svk admin hotcopy
|
---|
[1678] | 115 | confess "Unable to export from svk without a source defined";
|
---|
[1469] | 116 | }
|
---|
| 117 | } elsif ($scheme eq "dir") {
|
---|
| 118 | pb_system("cp -r $path $destdir","Copying $uri from DIR to $destdir ");
|
---|
| 119 | } elsif ($scheme =~ /^file/) {
|
---|
| 120 | eval
|
---|
| 121 | {
|
---|
| 122 | require File::MimeInfo;
|
---|
| 123 | File::MimeInfo->import();
|
---|
| 124 | };
|
---|
| 125 | if ($@) {
|
---|
| 126 | # File::MimeInfo not found
|
---|
[1678] | 127 | confess("ERROR: Install File::MimeInfo to handle scheme $scheme\n");
|
---|
[1469] | 128 | }
|
---|
| 129 |
|
---|
| 130 | my $mm = mimetype($path);
|
---|
| 131 | pb_log(2,"mimetype: $mm\n");
|
---|
| 132 |
|
---|
| 133 | # Check whether the file is well formed
|
---|
| 134 | # (containing already a directory with the project-version name)
|
---|
| 135 | #
|
---|
| 136 | # If it's not the case, we try to adapt, but distro needing
|
---|
| 137 | # to verify the checksum will have issues (Fedora)
|
---|
| 138 | # Then upstream should be notified that they need to change their rules
|
---|
| 139 | # This doesn't apply to patches or additional sources of course.
|
---|
| 140 | my ($pbwf) = pb_conf_get_if("pbwf");
|
---|
| 141 | if ((defined $pbwf) && (defined $pbwf->{$ENV{'PBPROJ'}}) && ($path !~ /\/pbpatch\//) && ($path !~ /\/pbsrc\//)) {
|
---|
| 142 | $destdir = dirname($destdir);
|
---|
| 143 | pb_log(2,"This is a well-formed file so destdir is now $destdir\n");
|
---|
| 144 | }
|
---|
| 145 | pb_mkdir_p($destdir);
|
---|
| 146 |
|
---|
| 147 | if ($mm =~ /\/x-bzip-compressed-tar$/) {
|
---|
| 148 | # tar+bzip2
|
---|
| 149 | pb_system("cd $destdir ; tar xfj $path","Extracting $path in $destdir ");
|
---|
| 150 | } elsif ($mm =~ /\/x-lzma-compressed-tar$/) {
|
---|
| 151 | # tar+lzma
|
---|
| 152 | pb_system("cd $destdir ; tar xfY $path","Extracting $path in $destdir ");
|
---|
| 153 | } elsif ($mm =~ /\/x-compressed-tar$/) {
|
---|
| 154 | # tar+gzip
|
---|
| 155 | pb_system("cd $destdir ; tar xfz $path","Extracting $path in $destdir ");
|
---|
| 156 | } elsif ($mm =~ /\/x-tar$/) {
|
---|
| 157 | # tar
|
---|
| 158 | pb_system("cd $destdir ; tar xf $path","Extracting $path in $destdir ");
|
---|
| 159 | } elsif ($mm =~ /\/zip$/) {
|
---|
| 160 | # zip
|
---|
| 161 | pb_system("cd $destdir ; unzip $path","Extracting $path in $destdir ");
|
---|
| 162 | } else {
|
---|
| 163 | # simple file: copy it (patch e.g.)
|
---|
| 164 | copy($path,$destdir);
|
---|
| 165 | }
|
---|
| 166 | } elsif ($scheme =~ /^hg/) {
|
---|
| 167 | if (defined $source) {
|
---|
| 168 | if (-d $source) {
|
---|
| 169 | $tmp = $destdir;
|
---|
| 170 | } else {
|
---|
| 171 | $tmp = "$destdir/".basename($source);
|
---|
| 172 | }
|
---|
| 173 | $source = pb_vcs_mod_htftp($source,"hg");
|
---|
| 174 | pb_system("cd $source ; $vcscmd archive $tmp","Exporting $source from Mercurial to $tmp ");
|
---|
| 175 | } else {
|
---|
| 176 | $uri = pb_vcs_mod_htftp($uri,"hg");
|
---|
| 177 | pb_system("$vcscmd clone $uri $destdir","Exporting $uri from Mercurial to $destdir ");
|
---|
| 178 | }
|
---|
| 179 | } elsif ($scheme =~ /^git/) {
|
---|
[1800] | 180 | if ($scheme =~ /svn/) {
|
---|
| 181 | if (defined $source) {
|
---|
| 182 | if (-d $source) {
|
---|
| 183 | $tmp = $destdir;
|
---|
| 184 | } else {
|
---|
| 185 | $tmp = "$destdir/".basename($source);
|
---|
| 186 | }
|
---|
| 187 | $source = pb_vcs_mod_htftp($source,"git");
|
---|
[1801] | 188 | pb_system("cp -a $source $tmp","Exporting $source from $scheme to $tmp ");
|
---|
[1469] | 189 | } else {
|
---|
[1800] | 190 | $uri = pb_vcs_mod_htftp($uri,"git");
|
---|
| 191 | pb_system("$vcscmd clone $uri $destdir","Exporting $uri from $scheme to $destdir ");
|
---|
[1469] | 192 | }
|
---|
| 193 | } else {
|
---|
[1800] | 194 | if (defined $source) {
|
---|
| 195 | if (-d $source) {
|
---|
| 196 | $tmp = $destdir;
|
---|
| 197 | } else {
|
---|
| 198 | $tmp = "$destdir/".basename($source);
|
---|
| 199 | }
|
---|
| 200 | $source = pb_vcs_mod_htftp($source,"git");
|
---|
[2079] | 201 | my ($pbpbr) = pb_conf_get_if("pbpbr");
|
---|
| 202 | if ((defined $pbpbr) && (defined $pbpbr->{$ENV{'PBPROJ'}})) {
|
---|
[2086] | 203 | # The project uses pbr so benefit from it to export data
|
---|
| 204 | pb_system("cd $source ; mkdir $tmp ; python setup.py sdist --keep-temp --dist-dir $tmp ; cd $tmp ; file=`ls *.tar.gz` ; if [ _\$file = _ ] || [ ! -f \$file ]; then exit -1; fi; tar xfz \$file ; dir=`tar tvfz \$file | head -1 | awk '{print \$6}'` ; if [ ! -d \$dir ] || [ _\$dir = _ ] || [ \$dir = / ]; then exit -1 ; fi ; mv \$dir/* \$dir/.??* . ; rmdir \$dir ; rm -f \$file ; ls -al ","Exporting current $source from GIT with pbr to $tmp ");
|
---|
[2079] | 205 | } else {
|
---|
| 206 | # no pbr do it ourselves
|
---|
| 207 | pb_system("cd $source ; stid=`$vcscmd stash create` ; $vcscmd archive --format=tar \$\{stid:=HEAD\} | (mkdir $tmp && cd $tmp && tar xf -)","Exporting current $source from GIT to $tmp ");
|
---|
| 208 | }
|
---|
[1800] | 209 | } else {
|
---|
| 210 | $uri = pb_vcs_mod_htftp($uri,"git");
|
---|
| 211 | pb_system("$vcscmd clone $uri $destdir","Exporting $uri from GIT to $destdir ");
|
---|
| 212 | }
|
---|
[1469] | 213 | }
|
---|
| 214 | } elsif ($scheme =~ /^cvs/) {
|
---|
| 215 | # CVS needs a relative path !
|
---|
| 216 | my $dir=dirname($destdir);
|
---|
| 217 | my $base=basename($destdir);
|
---|
| 218 | if (defined $source) {
|
---|
| 219 | # CVS also needs a modules name not a dir
|
---|
| 220 | $tmp1 = basename($source);
|
---|
| 221 | } else {
|
---|
| 222 | # Probably not right, should be checked, but that way I'll notice it :-)
|
---|
| 223 | pb_log(0,"You're in an untested part of project-builder.org, please report any result upstream\n");
|
---|
| 224 | $tmp1 = $uri;
|
---|
| 225 | }
|
---|
| 226 | # If we're working on the CVS itself
|
---|
| 227 | my $cvstag = basename($ENV{'PBROOTDIR'});
|
---|
| 228 | my $cvsopt = "";
|
---|
| 229 | if ($cvstag eq "cvs") {
|
---|
| 230 | my $pbdate = strftime("%Y-%m-%d %H:%M:%S", @date);
|
---|
| 231 | $cvsopt = "-D \"$pbdate\"";
|
---|
| 232 | } else {
|
---|
| 233 | # we're working on a tag which should be the last part of PBROOTDIR
|
---|
| 234 | $cvsopt = "-r $cvstag";
|
---|
| 235 | }
|
---|
| 236 | pb_system("cd $dir ; $vcscmd -d $account\@$host:$path export $cvsopt -d $base $tmp1","Exporting $tmp1 from $source under CVS to $destdir ");
|
---|
[2202] | 237 | } elsif (($scheme =~ /http/) || ($scheme eq "ftp")) {
|
---|
| 238 | my $f = basename($path);
|
---|
| 239 | unlink "$ENV{'PBTMP'}/$f";
|
---|
| 240 | pb_system("$vcscmd $ENV{'PBTMP'}/$f $uri","Downloading $uri with $vcscmd to $ENV{'PBTMP'}/$f\n");
|
---|
| 241 | # We want to preserve the original tar file
|
---|
| 242 | pb_vcs_export("file://$ENV{'PBTMP'}/$f",$source,$destdir);
|
---|
| 243 | return("$ENV{'PBTMP'}/$f");
|
---|
[1469] | 244 | } else {
|
---|
[1678] | 245 | confess "cms $scheme unknown";
|
---|
[1469] | 246 | }
|
---|
| 247 | return(undef);
|
---|
| 248 | }
|
---|
| 249 |
|
---|
| 250 | =item B<pb_vcs_get_uri>
|
---|
| 251 |
|
---|
| 252 | This function is only called with a real VCS system and gives the URL stored in the checked out directory.
|
---|
| 253 | The first parameter is the schema of the VCS systems (svn, cvs, svn+ssh, ...)
|
---|
| 254 | The second parameter is the directory in which it is locally exposed (result of a checkout).
|
---|
| 255 |
|
---|
| 256 | =cut
|
---|
| 257 |
|
---|
| 258 | sub pb_vcs_get_uri {
|
---|
| 259 |
|
---|
| 260 | my $scheme = shift;
|
---|
| 261 | my $dir = shift;
|
---|
| 262 |
|
---|
| 263 | my $res = "";
|
---|
| 264 | my $void = "";
|
---|
| 265 | my $vcscmd = pb_vcs_cmd($scheme);
|
---|
| 266 |
|
---|
| 267 | if ($scheme =~ /^svn/) {
|
---|
[1678] | 268 | open(PIPE,"LANGUAGE=C $vcscmd info $dir 2> /dev/null |") || return("");
|
---|
[1469] | 269 | while (<PIPE>) {
|
---|
| 270 | ($void,$res) = split(/^URL:/) if (/^URL:/);
|
---|
| 271 | }
|
---|
| 272 | $res =~ s/^\s*//;
|
---|
| 273 | close(PIPE);
|
---|
| 274 | chomp($res);
|
---|
| 275 | } elsif ($scheme =~ /^svk/) {
|
---|
[1678] | 276 | open(PIPE,"LANGUAGE=C $vcscmd info $dir 2> /dev/null |") || return("");
|
---|
[1469] | 277 | my $void2 = "";
|
---|
| 278 | while (<PIPE>) {
|
---|
| 279 | ($void,$void2,$res) = split(/ /) if (/^Depot/);
|
---|
| 280 | }
|
---|
| 281 | $res =~ s/^\s*//;
|
---|
| 282 | close(PIPE);
|
---|
| 283 | chomp($res);
|
---|
| 284 | } elsif ($scheme =~ /^hg/) {
|
---|
| 285 | open(HGRC,".hg/hgrc/") || return("");
|
---|
| 286 | while (<HGRC>) {
|
---|
| 287 | ($void,$res) = split(/^default.*=/) if (/^default.*=/);
|
---|
| 288 | }
|
---|
| 289 | close(HGRC);
|
---|
| 290 | chomp($res);
|
---|
| 291 | } elsif ($scheme =~ /^git/) {
|
---|
[1800] | 292 | if ($scheme =~ /svn/) {
|
---|
| 293 | my $cwd = abs_path();
|
---|
| 294 | chdir($dir) || return("");;
|
---|
| 295 | open(PIPE,"LANGUAGE=C $vcscmd info . 2> /dev/null |") || return("");
|
---|
| 296 | chdir($cwd) || return("");
|
---|
| 297 | while (<PIPE>) {
|
---|
| 298 | ($void,$res) = split(/^URL:/) if (/^URL:/);
|
---|
| 299 | }
|
---|
| 300 | $res =~ s/^\s*//;
|
---|
| 301 | close(PIPE);
|
---|
| 302 | chomp($res);
|
---|
| 303 | # We've got an SVN ref so add git in front of it for coherency
|
---|
| 304 | $res = "git+".$res;
|
---|
| 305 | } else {
|
---|
| 306 | # Pure git
|
---|
[1897] | 307 | # First we may deal with a separate git repo under $dir
|
---|
[1875] | 308 | if ( -d "$dir/.git" ) {
|
---|
| 309 | open(GIT,"LANGUAGE=C $vcscmd --git-dir=$dir/.git remote -v 2> /dev/null |") || return("");
|
---|
| 310 | } else {
|
---|
| 311 | # If not, the pbconf dir may be in the pbprojdir so sharing the .git dir
|
---|
| 312 | my $cwd = abs_path();
|
---|
| 313 | chdir($dir) || return("");;
|
---|
| 314 | open(GIT,"LANGUAGE=C $vcscmd remote -v 2> /dev/null |") || return("");
|
---|
| 315 | chdir($cwd) || return("");
|
---|
| 316 | }
|
---|
[1800] | 317 | while (<GIT>) {
|
---|
| 318 | next unless (/^origin\s+(\S+) \(push\)$/);
|
---|
| 319 | return $1;
|
---|
| 320 | }
|
---|
| 321 | close(GIT);
|
---|
| 322 | warn "Unable to find remote origin for $dir";
|
---|
| 323 | return "";
|
---|
[1469] | 324 | }
|
---|
| 325 | } elsif ($scheme =~ /^cvs/) {
|
---|
| 326 | # This path is always the root path of CVS, but we may be below
|
---|
[1678] | 327 | open(FILE,"$dir/CVS/Root") || confess "$dir isn't CVS controlled";
|
---|
[1469] | 328 | $res = <FILE>;
|
---|
| 329 | chomp($res);
|
---|
| 330 | close(FILE);
|
---|
| 331 | # Find where we are in the tree
|
---|
| 332 | my $rdir = $dir;
|
---|
| 333 | while ((! -d "$rdir/CVSROOT") && ($rdir ne "/")) {
|
---|
| 334 | $rdir = dirname($rdir);
|
---|
| 335 | }
|
---|
[1678] | 336 | confess "Unable to find a CVSROOT dir in the parents of $dir" if (! -d "$rdir/CVSROOT");
|
---|
[1469] | 337 | #compute our place under that root dir - should be a relative path
|
---|
| 338 | $dir =~ s|^$rdir||;
|
---|
| 339 | my $suffix = "";
|
---|
| 340 | $suffix = "$dir" if ($dir ne "");
|
---|
| 341 |
|
---|
| 342 | my $prefix = "";
|
---|
| 343 | if ($scheme =~ /ssh/) {
|
---|
| 344 | $prefix = "cvs+ssh://";
|
---|
| 345 | } else {
|
---|
| 346 | $prefix = "cvs://";
|
---|
| 347 | }
|
---|
| 348 | $res = $prefix.$res.$suffix;
|
---|
| 349 | } else {
|
---|
[1678] | 350 | confess "cms $scheme unknown";
|
---|
[1469] | 351 | }
|
---|
| 352 | pb_log(1,"pb_vcs_get_uri returns $res\n");
|
---|
| 353 | return($res);
|
---|
| 354 | }
|
---|
| 355 |
|
---|
| 356 | =item B<pb_vcs_copy>
|
---|
| 357 |
|
---|
| 358 | This function copies a VCS content to another.
|
---|
| 359 | The first parameter is the schema of the VCS systems (svn, cvs, svn+ssh, ...)
|
---|
| 360 | The second parameter is the URL of the original VCS content.
|
---|
| 361 | The third parameter is the URL of the destination VCS content.
|
---|
| 362 |
|
---|
| 363 | Only coded for SVN now as used for pbconf itself not the project
|
---|
| 364 |
|
---|
| 365 | =cut
|
---|
| 366 |
|
---|
| 367 | sub pb_vcs_copy {
|
---|
| 368 | my $scheme = shift;
|
---|
| 369 | my $oldurl = shift;
|
---|
| 370 | my $newurl = shift;
|
---|
| 371 | my $vcscmd = pb_vcs_cmd($scheme);
|
---|
| 372 | $oldurl = pb_vcs_mod_socks($oldurl);
|
---|
| 373 | $newurl = pb_vcs_mod_socks($newurl);
|
---|
| 374 |
|
---|
| 375 | if ($scheme =~ /^svn/) {
|
---|
| 376 | $oldurl = pb_vcs_mod_htftp($oldurl,"svn");
|
---|
| 377 | $newurl = pb_vcs_mod_htftp($newurl,"svn");
|
---|
| 378 | pb_system("$vcscmd copy -m \"Creation of $newurl from $oldurl\" $oldurl $newurl","Copying $oldurl to $newurl ");
|
---|
[2169] | 379 | } elsif ($scheme =~ /^(flat)|(ftp)|(http)|(https)|(file)\b/o) {
|
---|
[1554] | 380 | # Nothing to do.
|
---|
[1469] | 381 | } else {
|
---|
[1678] | 382 | confess "cms $scheme unknown for project management";
|
---|
[1469] | 383 | }
|
---|
| 384 | }
|
---|
| 385 |
|
---|
| 386 | =item B<pb_vcs_checkout>
|
---|
| 387 |
|
---|
| 388 | This function checks a VCS content out to a directory.
|
---|
| 389 | The first parameter is the schema of the VCS systems (svn, cvs, svn+ssh, ...)
|
---|
| 390 | The second parameter is the URL of the VCS content.
|
---|
| 391 | The third parameter is the directory where we want to deliver it (result of export).
|
---|
| 392 |
|
---|
| 393 | =cut
|
---|
| 394 |
|
---|
| 395 | sub pb_vcs_checkout {
|
---|
| 396 | my $scheme = shift;
|
---|
| 397 | my $url = shift;
|
---|
| 398 | my $destination = shift;
|
---|
| 399 | my $vcscmd = pb_vcs_cmd($scheme);
|
---|
| 400 | $url = pb_vcs_mod_socks($url);
|
---|
| 401 |
|
---|
| 402 | if ($scheme =~ /^svn/) {
|
---|
| 403 | $url = pb_vcs_mod_htftp($url,"svn");
|
---|
| 404 | pb_system("$vcscmd co $url $destination","Checking out $url to $destination ");
|
---|
| 405 | } elsif ($scheme =~ /^svk/) {
|
---|
| 406 | $url = pb_vcs_mod_htftp($url,"svk");
|
---|
| 407 | pb_system("$vcscmd co $url $destination","Checking out $url to $destination ");
|
---|
| 408 | } elsif ($scheme =~ /^hg/) {
|
---|
| 409 | $url = pb_vcs_mod_htftp($url,"hg");
|
---|
| 410 | pb_system("$vcscmd clone $url $destination","Checking out $url to $destination ");
|
---|
| 411 | } elsif ($scheme =~ /^git/) {
|
---|
| 412 | $url = pb_vcs_mod_htftp($url,"git");
|
---|
| 413 | pb_system("$vcscmd clone $url $destination","Checking out $url to $destination ");
|
---|
[2169] | 414 | } elsif (($scheme eq "ftp") || ($scheme =~ /http/)) {
|
---|
[1469] | 415 | return;
|
---|
| 416 | } elsif ($scheme =~ /^cvs/) {
|
---|
| 417 | my ($scheme, $account, $host, $port, $path) = pb_get_uri($url);
|
---|
| 418 |
|
---|
| 419 | # If we're working on the CVS itself
|
---|
| 420 | my $cvstag = basename($ENV{'PBROOTDIR'});
|
---|
| 421 | my $cvsopt = "";
|
---|
| 422 | if ($cvstag eq "cvs") {
|
---|
| 423 | my @date = pb_get_date();
|
---|
| 424 | my $pbdate = strftime("%Y-%m-%d %H:%M:%S", @date);
|
---|
| 425 | $cvsopt = "-D \"$pbdate\"";
|
---|
| 426 | } else {
|
---|
| 427 | # we're working on a tag which should be the last part of PBROOTDIR
|
---|
| 428 | $cvsopt = "-r $cvstag";
|
---|
| 429 | }
|
---|
| 430 | pb_mkdir_p("$destination");
|
---|
| 431 | pb_system("cd $destination ; $vcscmd -d $account\@$host:$path co $cvsopt .","Checking out $url to $destination ");
|
---|
| 432 | } elsif ($scheme =~ /^file/) {
|
---|
| 433 | pb_vcs_export($url,undef,$destination);
|
---|
| 434 | } else {
|
---|
[1678] | 435 | confess "cms $scheme unknown";
|
---|
[1469] | 436 | }
|
---|
| 437 | }
|
---|
| 438 |
|
---|
| 439 | =item B<pb_vcs_up>
|
---|
| 440 |
|
---|
| 441 | This function updates a local directory with the VCS content.
|
---|
| 442 | The first parameter is the schema of the VCS systems (svn, cvs, svn+ssh, ...)
|
---|
[1492] | 443 | The second parameter is the list of directory to update.
|
---|
[1469] | 444 |
|
---|
| 445 | =cut
|
---|
| 446 |
|
---|
| 447 | sub pb_vcs_up {
|
---|
| 448 | my $scheme = shift;
|
---|
[1493] | 449 | my @dir = @_;
|
---|
[1469] | 450 | my $vcscmd = pb_vcs_cmd($scheme);
|
---|
| 451 |
|
---|
[1539] | 452 | if ($scheme =~ /^((svn)|(cvs)|(svk))/o) {
|
---|
[1492] | 453 | pb_system("$vcscmd up ".join(' ',@dir),"Updating ".join(' ',@dir));
|
---|
[1535] | 454 | } elsif ($scheme =~ /^((hg)|(git))/o) {
|
---|
[1539] | 455 | foreach my $d (@dir) {
|
---|
[2022] | 456 | pb_system("(cd $d && $vcscmd fetch)", "Updating $d ");
|
---|
[1539] | 457 | }
|
---|
[2169] | 458 | } elsif ($scheme =~ /^(flat)|(ftp)|(http)|(https)|(file)\b/o) {
|
---|
[1554] | 459 | # Nothing to do.
|
---|
[1469] | 460 | } else {
|
---|
[1678] | 461 | confess "cms $scheme unknown";
|
---|
[1469] | 462 | }
|
---|
| 463 | }
|
---|
| 464 |
|
---|
| 465 | =item B<pb_vcs_checkin>
|
---|
| 466 |
|
---|
| 467 | This function updates a VCS content from a local directory.
|
---|
| 468 | The first parameter is the schema of the VCS systems (svn, cvs, svn+ssh, ...)
|
---|
| 469 | The second parameter is the directory to update from.
|
---|
| 470 | The third parameter is the comment to pass during the commit
|
---|
| 471 |
|
---|
| 472 | =cut
|
---|
| 473 |
|
---|
| 474 | sub pb_vcs_checkin {
|
---|
| 475 | my $scheme = shift;
|
---|
| 476 | my $dir = shift;
|
---|
| 477 | my $msg = shift;
|
---|
| 478 | my $vcscmd = pb_vcs_cmd($scheme);
|
---|
| 479 |
|
---|
[1539] | 480 | if ($scheme =~ /^((svn)|(cvs)|(svk))/o) {
|
---|
[1535] | 481 | pb_system("cd $dir && $vcscmd ci -m \"$msg\" .","Checking in $dir ");
|
---|
| 482 | } elsif ($scheme =~ /^git/) {
|
---|
[2265] | 483 | pb_system("cd $dir && git commit -a -m \"$msg\"", "Checking in $dir ");
|
---|
[2169] | 484 | } elsif ($scheme =~ /^(flat)|(ftp)|(http)|(https)|(file)\b/o) {
|
---|
[1554] | 485 | # Nothing to do.
|
---|
[1469] | 486 | } else {
|
---|
[1678] | 487 | confess "cms $scheme unknown";
|
---|
[1469] | 488 | }
|
---|
| 489 | pb_vcs_up($scheme,$dir);
|
---|
| 490 | }
|
---|
| 491 |
|
---|
[1678] | 492 | =item B<pb_vcs_add_if_not_in>
|
---|
| 493 |
|
---|
[2254] | 494 | This function adds to a VCS content from a local directory if the content wasn't already managed under the VCS.
|
---|
[1678] | 495 | The first parameter is the schema of the VCS systems (svn, cvs, svn+ssh, ...)
|
---|
| 496 | The second parameter is a list of directory/file to add.
|
---|
| 497 |
|
---|
| 498 | =cut
|
---|
| 499 |
|
---|
| 500 | sub pb_vcs_add_if_not_in {
|
---|
| 501 | my $scheme = shift;
|
---|
| 502 | my @f = @_;
|
---|
| 503 | my $vcscmd = pb_vcs_cmd($scheme);
|
---|
| 504 |
|
---|
| 505 | if ($scheme =~ /^((hg)|(git)|(svn)|(svk)|(cvs))/o) {
|
---|
| 506 | for my $f (@f) {
|
---|
| 507 | my $uri = pb_vcs_get_uri($scheme,$f);
|
---|
| 508 | pb_vcs_add($scheme,$f) if ($uri !~ /^$scheme/);
|
---|
| 509 | }
|
---|
[2169] | 510 | } elsif ($scheme =~ /^(flat)|(ftp)|(http)|(https)|(file)\b/o) {
|
---|
[1678] | 511 | # Nothing to do.
|
---|
| 512 | } else {
|
---|
| 513 | confess "cms $scheme unknown";
|
---|
| 514 | }
|
---|
| 515 | }
|
---|
| 516 |
|
---|
[1469] | 517 | =item B<pb_vcs_add>
|
---|
| 518 |
|
---|
| 519 | This function adds to a VCS content from a local directory.
|
---|
| 520 | The first parameter is the schema of the VCS systems (svn, cvs, svn+ssh, ...)
|
---|
[1492] | 521 | The second parameter is a list of directory/file to add.
|
---|
[1469] | 522 |
|
---|
| 523 | =cut
|
---|
| 524 |
|
---|
| 525 | sub pb_vcs_add {
|
---|
| 526 | my $scheme = shift;
|
---|
[1493] | 527 | my @f = @_;
|
---|
[1469] | 528 | my $vcscmd = pb_vcs_cmd($scheme);
|
---|
| 529 |
|
---|
[1535] | 530 | if ($scheme =~ /^((hg)|(git)|(svn)|(svk)|(cvs))/o) {
|
---|
[2265] | 531 | $vcscmd =~ s/ svn// if (($scheme =~ /git/) && ($scheme =~ /svn/));
|
---|
[1492] | 532 | pb_system("$vcscmd add ".join(' ',@f),"Adding ".join(' ',@f)." to VCS ");
|
---|
[2169] | 533 | } elsif ($scheme =~ /^(flat)|(ftp)|(http)|(https)|(file)\b/o) {
|
---|
[1554] | 534 | # Nothing to do.
|
---|
[1469] | 535 | } else {
|
---|
[1678] | 536 | confess "cms $scheme unknown";
|
---|
[1469] | 537 | }
|
---|
[2268] | 538 | my @f1;
|
---|
| 539 | foreach my $f (@f) {
|
---|
| 540 | push(@f1,$f) if (-d $f);
|
---|
| 541 | push(@f1,dirname($f)) if (-f $f);
|
---|
[1469] | 542 | }
|
---|
[2268] | 543 | pb_vcs_up($scheme,@f1);
|
---|
| 544 | }
|
---|
[1469] | 545 |
|
---|
| 546 | =item B<pb_vcs_isdiff>
|
---|
| 547 |
|
---|
[1800] | 548 | This function returns a integer indicating the number of differences between the VCS content and the local directory where it's checked out.
|
---|
[1469] | 549 | The first parameter is the schema of the VCS systems (svn, cvs, svn+ssh, ...)
|
---|
| 550 | The second parameter is the directory to consider.
|
---|
| 551 |
|
---|
| 552 | =cut
|
---|
| 553 |
|
---|
| 554 | sub pb_vcs_isdiff {
|
---|
| 555 | my $scheme = shift;
|
---|
| 556 | my $dir =shift;
|
---|
| 557 | my $vcscmd = pb_vcs_cmd($scheme);
|
---|
| 558 | my $l = undef;
|
---|
| 559 |
|
---|
[2022] | 560 | if ($scheme =~ /^((svn)|(cvs)|(svk)|(git))/o) {
|
---|
[2265] | 561 | $vcscmd =~ s/ svn// if (($scheme =~ /git/) && ($scheme =~ /svn/));
|
---|
[1678] | 562 | open(PIPE,"$vcscmd diff $dir |") || confess "Unable to get $vcscmd diff from $dir";
|
---|
[1469] | 563 | $l = 0;
|
---|
| 564 | while (<PIPE>) {
|
---|
| 565 | # Skipping normal messages in case of CVS
|
---|
| 566 | next if (/^cvs diff:/);
|
---|
| 567 | $l++;
|
---|
| 568 | }
|
---|
[2169] | 569 | } elsif ($scheme =~ /^(flat)|(ftp)|(http)|(https)|(file)\b/o) {
|
---|
[1469] | 570 | $l = 0;
|
---|
| 571 | } else {
|
---|
[1678] | 572 | confess "cms $scheme unknown";
|
---|
[1469] | 573 | }
|
---|
| 574 | pb_log(1,"pb_vcs_isdiff returns $l\n");
|
---|
| 575 | return($l);
|
---|
| 576 | }
|
---|
| 577 |
|
---|
| 578 | sub pb_vcs_mod_htftp {
|
---|
| 579 |
|
---|
| 580 | my $url = shift;
|
---|
| 581 | my $proto = shift;
|
---|
| 582 |
|
---|
| 583 | $url =~ s/^$proto\+((ht|f)tp[s]*):/$1:/;
|
---|
| 584 | pb_log(1,"pb_vcs_mod_htftp returns $url\n");
|
---|
| 585 | return($url);
|
---|
| 586 | }
|
---|
| 587 |
|
---|
| 588 | sub pb_vcs_mod_socks {
|
---|
| 589 |
|
---|
| 590 | my $url = shift;
|
---|
| 591 |
|
---|
| 592 | $url =~ s/^([A-z0-9]+)\+(socks):/$1:/;
|
---|
| 593 | pb_log(1,"pb_vcs_mod_socks returns $url\n");
|
---|
| 594 | return($url);
|
---|
| 595 | }
|
---|
| 596 |
|
---|
| 597 |
|
---|
| 598 | sub pb_vcs_cmd {
|
---|
| 599 |
|
---|
| 600 | my $scheme = shift;
|
---|
| 601 | my $cmd = "";
|
---|
[1576] | 602 | my $cmdopt = "";
|
---|
[1469] | 603 |
|
---|
| 604 | # If there is a socks proxy to use
|
---|
| 605 | if ($scheme =~ /socks/) {
|
---|
| 606 | # Get the socks proxy command from the conf file
|
---|
| 607 | my ($pbsockscmd) = pb_conf_get("pbsockscmd");
|
---|
| 608 | $cmd = "$pbsockscmd->{$ENV{'PBPROJ'}} ";
|
---|
| 609 | }
|
---|
| 610 |
|
---|
[1576] | 611 | if (defined $ENV{'PBVCSOPT'}) {
|
---|
[1586] | 612 | $cmdopt .= " $ENV{'PBVCSOPT'}";
|
---|
[1576] | 613 | }
|
---|
| 614 |
|
---|
[1469] | 615 | if ($scheme =~ /hg/) {
|
---|
[1800] | 616 | $cmd .= "hg".$cmdopt;
|
---|
[1469] | 617 | } elsif ($scheme =~ /git/) {
|
---|
[1800] | 618 | if ($scheme =~ /svn/) {
|
---|
| 619 | $cmd .= "git svn".$cmdopt;
|
---|
| 620 | } else {
|
---|
| 621 | $cmd .= "git".$cmdopt;
|
---|
| 622 | }
|
---|
[1469] | 623 | } elsif ($scheme =~ /svn/) {
|
---|
[1800] | 624 | $cmd .= "svn".$cmdopt;
|
---|
[1469] | 625 | } elsif ($scheme =~ /svk/) {
|
---|
[1800] | 626 | $cmd .= "svk".$cmdopt;
|
---|
[1469] | 627 | } elsif ($scheme =~ /cvs/) {
|
---|
[1800] | 628 | $cmd .= "cvs".$cmdopt;
|
---|
[1469] | 629 | } elsif (($scheme =~ /http/) || ($scheme =~ /ftp/)) {
|
---|
| 630 | my $command = pb_check_req("wget",1);
|
---|
| 631 | if (-x $command) {
|
---|
[1800] | 632 | $cmd .= "$command -nv -O ";
|
---|
[1469] | 633 | } else {
|
---|
| 634 | $command = pb_check_req("curl",1);
|
---|
| 635 | if (-x $command) {
|
---|
[1800] | 636 | $cmd .= "$command -o ";
|
---|
[1469] | 637 | } else {
|
---|
[1678] | 638 | confess "Unable to handle $scheme.\nNo wget/curl available, please install one of those";
|
---|
[1469] | 639 | }
|
---|
| 640 | }
|
---|
| 641 | } else {
|
---|
[1800] | 642 | $cmd = "";
|
---|
[1469] | 643 | }
|
---|
[1800] | 644 | pb_log(3,"pb_vcs_cmd returns $cmd\n");
|
---|
| 645 | return($cmd);
|
---|
[1469] | 646 | }
|
---|
| 647 |
|
---|
[1850] | 648 | =item B<pb_vcs_compliant>
|
---|
[1469] | 649 |
|
---|
[1850] | 650 | This function checks the compliance of the project and the pbconf directory.
|
---|
| 651 | The first parameter is the key name of the value that needs to be read in the configuration file.
|
---|
| 652 | The second parameter is the environment variable this key will populate.
|
---|
| 653 | The third parameter is the location of the pbconf dir.
|
---|
| 654 | The fourth parameter is the URI of the CMS content related to the pbconf dir.
|
---|
| 655 | The fifth parameter indicates whether we should inititate the context or not.
|
---|
| 656 |
|
---|
| 657 | =cut
|
---|
| 658 |
|
---|
| 659 | sub pb_vcs_compliant {
|
---|
| 660 |
|
---|
| 661 | my $param = shift;
|
---|
| 662 | my $envar = shift;
|
---|
| 663 | my $defdir = shift;
|
---|
| 664 | my $uri = shift;
|
---|
| 665 | my $pbinit = shift;
|
---|
| 666 | my %pdir;
|
---|
| 667 |
|
---|
| 668 | pb_log(1,"pb_vcs_compliant: envar: $envar - defdir: $defdir - uri: $uri\n");
|
---|
| 669 | my ($pdir) = pb_conf_get_if($param) if (defined $param);
|
---|
| 670 | if (defined $pdir) {
|
---|
| 671 | %pdir = %$pdir;
|
---|
| 672 | }
|
---|
| 673 |
|
---|
| 674 | if ((defined $pdir) && (%pdir) && (defined $pdir{$ENV{'PBPROJ'}})) {
|
---|
| 675 | # That's always the environment variable that will be used
|
---|
| 676 | $ENV{$envar} = $pdir{$ENV{'PBPROJ'}};
|
---|
| 677 | } else {
|
---|
| 678 | if (defined $param) {
|
---|
| 679 | pb_log(1,"WARNING: no $param defined, using $defdir\n");
|
---|
| 680 | pb_log(1," Please create a $param reference for project $ENV{'PBPROJ'} in $ENV{'PBETC'}\n");
|
---|
| 681 | pb_log(1," if you want to use another directory\n");
|
---|
| 682 | }
|
---|
| 683 | $ENV{$envar} = "$defdir";
|
---|
| 684 | }
|
---|
| 685 |
|
---|
| 686 | # Expand potential env variable in it
|
---|
| 687 | eval { $ENV{$envar} =~ s/(\$ENV.+\})/$1/eeg };
|
---|
| 688 | pb_log(2,"$envar: $ENV{$envar}\n");
|
---|
| 689 |
|
---|
| 690 | my ($scheme, $account, $host, $port, $path) = pb_get_uri($uri);
|
---|
| 691 |
|
---|
| 692 | if (($scheme !~ /^cvs/) && ($scheme !~ /^svn/) && ($scheme !~ /^svk/) && ($scheme !~ /^hg/) && ($scheme !~ /^git/)) {
|
---|
| 693 | # Do not compare if it's not a real cms
|
---|
| 694 | pb_log(1,"pb_vcs_compliant useless\n");
|
---|
| 695 | return;
|
---|
| 696 | } elsif (defined $pbinit) {
|
---|
| 697 | pb_mkdir_p("$ENV{$envar}");
|
---|
| 698 | } elsif (! -d "$ENV{$envar}") {
|
---|
| 699 | # Either we have a version in the uri, and it should be the same
|
---|
| 700 | # as the one in the envar. Or we should add the version to the uri
|
---|
[2022] | 701 | # But not if it's git as it manages version branches internally
|
---|
[1866] | 702 | if ((basename($uri) ne basename($ENV{$envar})) && ($scheme !~ /^git/)) {
|
---|
[1850] | 703 | $uri .= "/".basename($ENV{$envar})
|
---|
| 704 | }
|
---|
| 705 | pb_log(1,"Checking out $uri\n");
|
---|
| 706 | # Create structure and remove end dir before exporting
|
---|
| 707 | pb_mkdir_p("$ENV{$envar}");
|
---|
| 708 | pb_rm_rf($ENV{$envar});
|
---|
| 709 | pb_vcs_checkout($scheme,$uri,$ENV{$envar});
|
---|
| 710 | } else {
|
---|
| 711 | pb_log(1,"$uri found locally, checking content\n");
|
---|
| 712 | my $cmsurl = pb_vcs_get_uri($scheme,$ENV{$envar});
|
---|
| 713 | my ($scheme2, $account2, $host2, $port2, $path2) = pb_get_uri($cmsurl);
|
---|
| 714 | # For svk, scheme doesn't appear in svk info so remove it here in uri coming from conf file
|
---|
| 715 | # which needs it to trigger correct behaviour
|
---|
| 716 | $uri =~ s/^svk://;
|
---|
[1893] | 717 | if ($scheme2 =~ /^git/) {
|
---|
| 718 | # remove schema from `git+file:` and `git+dir:` urls
|
---|
| 719 | # TODO: handle query-parameters
|
---|
[2022] | 720 | $uri =~ s/^git\+(file|dir|ssh):[\/]*//;
|
---|
[1893] | 721 | # Expand potential env variable in it -- this is required due to the consistency check
|
---|
[1897] | 722 | $uri =~ s/(\$ENV.+\})/$1/eeg;
|
---|
[1893] | 723 | } elsif ($scheme2 =~ /^hg/) {
|
---|
| 724 | # This VCS manages branches internally not with different tree structures
|
---|
[1850] | 725 | # Assuming it's correct for now.
|
---|
[1897] | 726 | return;
|
---|
| 727 | }
|
---|
[2025] | 728 | # Remove git+ part if only in scheme
|
---|
| 729 | $uri =~ s/^git\+// if (($scheme =~ /^git\+/) && ($scheme2 !~ /^git\+/));
|
---|
[1897] | 730 |
|
---|
| 731 | if ($cmsurl ne $uri) {
|
---|
[1850] | 732 | # The local content doesn't correpond to the repository
|
---|
| 733 | pb_log(0,"ERROR: Inconsistency detected:\n");
|
---|
| 734 | pb_log(0," * $ENV{$envar} ($envar) refers to $cmsurl but\n");
|
---|
| 735 | pb_log(0," * $ENV{'PBETC'} refers to $uri\n");
|
---|
| 736 | die "Project $ENV{'PBPROJ'} is not Project-Builder compliant.";
|
---|
| 737 | } else {
|
---|
| 738 | pb_log(1,"Content correct - doing nothing - you may want to update your repository however\n");
|
---|
| 739 | # they match - do nothing - there may be local changes
|
---|
| 740 | }
|
---|
| 741 | }
|
---|
| 742 | pb_log(1,"pb_vcs_compliant end\n");
|
---|
| 743 | }
|
---|
| 744 |
|
---|
[2267] | 745 | =item B<pb_vcs_conf_update_v0>
|
---|
[1850] | 746 |
|
---|
[2267] | 747 | This function transform the old configuration v0 file as first param into a new v1 one as second param by calling a COnf.pm function and then adds the resulting file into VCS
|
---|
| 748 |
|
---|
| 749 | =cut
|
---|
| 750 |
|
---|
| 751 |
|
---|
| 752 | sub pb_vcs_conf_update_v0 {
|
---|
| 753 |
|
---|
| 754 | my $orig = shift;
|
---|
| 755 | my $dest = shift;
|
---|
| 756 |
|
---|
| 757 | pb_conf_update_v0($orig,$dest);
|
---|
| 758 | # Adding this new file to VCS (not removing the previous one)
|
---|
[2284] | 759 | my ($pbprojurl) = pb_conf_get("pbprojurl");
|
---|
| 760 | my ($scheme, $account, $host, $port, $path) = pb_get_uri($pbprojurl->{$ENV{'PBPROJ'}});
|
---|
[2267] | 761 | pb_vcs_add_if_not_in($scheme,$dest);
|
---|
[2268] | 762 | }
|
---|
[2267] | 763 |
|
---|
[1469] | 764 | =back
|
---|
| 765 |
|
---|
| 766 | =head1 WEB SITES
|
---|
| 767 |
|
---|
| 768 | The main Web site of the project is available at L<http://www.project-builder.org/>. Bug reports should be filled using the trac instance of the project at L<http://trac.project-builder.org/>.
|
---|
| 769 |
|
---|
| 770 | =head1 USER MAILING LIST
|
---|
| 771 |
|
---|
| 772 | None exists for the moment.
|
---|
| 773 |
|
---|
| 774 | =head1 AUTHORS
|
---|
| 775 |
|
---|
| 776 | The Project-Builder.org team L<http://trac.project-builder.org/> lead by Bruno Cornec L<mailto:bruno@project-builder.org>.
|
---|
| 777 |
|
---|
| 778 | =head1 COPYRIGHT
|
---|
| 779 |
|
---|
| 780 | Project-Builder.org is distributed under the GPL v2.0 license
|
---|
| 781 | described in the file C<COPYING> included with the distribution.
|
---|
| 782 |
|
---|
| 783 | =cut
|
---|
| 784 |
|
---|
| 785 | 1;
|
---|