=pod =head1 EXPORTS =over 4 =cut my $target_voteServer = 'havoc'; # havoc vdev|voff (build will mostly be unrunnable, as havoc now lacks web services etc.) # 'v'; # obsidian v for public release # 'voff'; # obsidian voff for pre-release testing $target_voteServer ne 'havoc' and warn( "building to '" . $target_voteServer . "'\n" ); # avoid surprises =pod =item B A target I added for my local builds. =cut sub build__target_local() { use votorola::b::FileSync qw( $from_dir sync_found_public $to_dir ); use File::Copy (); print call_stack_indentation() . "local\n"; if( $target_voteServer eq 'havoc' ) { $to_dir = ensure_dir( out_dir() . '/votorola' ); $from_dir = '/home/mike/code/votorola/all/votorola'; File::Find::find( {follow_fast=>1, no_chdir=>1, wanted=>sub { my $file = $File::Find::name; $file =~ m'/\.wh\.\.wh\.' and return; # AUFS whiteout files of my union mount $file =~ m"^$from_dir/\._" and return; # exclude ._/ff-link/*, which it tries to copy $file =~ m"^$from_dir/_/javadoc" and return; # exclude this link to generated output $file =~ m"^$from_dir/b/example" and return; # " sync_found_public(); # copy the remainder, as usual }}, $from_dir ); } # elsif( $target_voteServer eq 'voff' ) # { # print " (skipped for $target_voteServer)\n"; # general releases are copied from clean voff builds, # # which should therefore omit any local customizations # return; # } ## vote-server 'v' no longer has customizations, so there's no longer an asymmettry to warn about } =pod =item B The root of the cache directory in which intermediate build files are stored for reuse, without a trailing '/'. The directory must be on the same host or mis-sync may occur. =cut sub build_cache_root() { return '/home/mike/var/build'; } # normally uses only subdirectory 'votorola' =pod =item B( $example_base_dir ) Copies examples of configuration from the developer's vote-server to the specified output directory. (If you are not actually releasing the builds, you can leave this subroutine empty.) =cut sub copy_site_example( $ ) { use votorola::b::FileSync qw( $from_dir sync_found $to_dir ); my $example_base_dir = shift; $from_dir = '/home/mike/code/votorola/all/votorola/s/_/example_template'; $to_dir = ensure_dir( $example_base_dir ); File::Find::find( {follow_fast=>1, no_chdir=>1, wanted=>\&sync_found}, $from_dir ); _copy_minimal_example( $example_base_dir . '/minimal' ); _copy_full_example( $example_base_dir . '/full' ); } =pod =item B The directory to which built files are finally output, without a trailing '/'. The entire directory is deleted by 'build clean'. =cut sub out_dir() { my $dir; if( $target_voteServer eq 'havoc' ) { $dir = '/home/mike/var/deploy/votorola'; } elsif( $target_voteServer eq 'v' ) { $dir = '/mnt/lan/obsidian/home/v/var/build/votorola'; -d '/mnt/lan/obsidian/home/v/var/build' or die "not mounted: " . $dir; } elsif( $target_voteServer eq 'voff' ) { # $dir = '/mnt/lan/ivory/tmp/votorola-build'; # -d '/mnt/lan/ivory/tmp' or die "not mounted: " . $dir; $dir = '/mnt/lan/obsidian/home/voff/var/build/votorola'; -d '/mnt/lan/obsidian/home/voff/var/build' or die "not mounted: " . $dir; } else { die; } return $dir; } ##### P r i v a t e ###################################################################### sub _copy_minimal_example( $ ) # cf. _copy_full_example() { use File::Path qw( rmtree ); use votorola::b::FileSync qw( $from_dir $to_dir ); my $example_dir = shift; $from_dir = '/home/voff'; { my $votorola_out = $from_dir . '/votorola-SWAPOUT'; -d $votorola_out && die "cannot build when swapped out: " . $votorola_off_old; } $to_dir = ensure_dir( $example_dir . $from_dir ); File::Find::find( {follow=>1, follow_skip=>2, no_chdir=>1, wanted=>\&_sync_found_example}, # skip needed, because cycles may occur among cache links $from_dir ); } sub _copy_full_example( $ ) # cf. _copy_minimal_example() { use votorola::b::FileSync qw( $from_dir sync_found_public sync_to_file $to_dir ); my $example_dir = shift; # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - $from_dir = '/home/vdev'; $to_dir = ensure_dir( $example_dir . $from_dir ); File::Find::find( {follow=>1, follow_skip=>2, no_chdir=>1, wanted=>sub # skip needed, else will die on cycles among cache links { my $file = $File::Find::name; $file eq $from_dir . '/votorola/private.jsm' and return; # though not public and therefore not copied, be sure if( $file eq $from_dir .'/votorola/private_example.jsm' ) { sync_to_file( $file, "$to_dir/votorola/private.jsm" ); return; } _sync_found_example(); # accept the remainder, as usual }}, $from_dir ); } sub _sync_found_example() { my $file = $File::Find::name; root_filter: { $file =~ m"^$from_dir/votorola-" and return; # votorola-SWAPOUT or TESTPASS $file =~ m"^$from_dir/\.java" and last; $file =~ m"^$from_dir/votorola" and last; $file =~ m"^$from_dir/\.bashrc" and last; return; # exclude all others } $file =~ m"^$from_dir/votorola/code" and return; $file =~ m"^$from_dir/votorola/in/" and return; # only the directory, no content $file =~ m"^$from_dir/votorola/out/" and return; # " $file =~ m'/\.sync-web-control\.pl$' and return; $file =~ m'\.pdf$' and return; $file =~ m'\.svg$' and return; sync_found_public(); # accept the remainder, as usual } =pod =back =cut 1;