File: sync-bson-tests.pl

package info (click to toggle)
libbson-xs-perl 0.8.4-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 1,712 kB
  • sloc: ansic: 9,734; perl: 1,046; makefile: 3
file content (41 lines) | stat: -rwxr-xr-x 1,165 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/env perl
use v5.10;
use strict;
use warnings;
use utf8;
use open qw/:std :utf8/;

use Path::Tiny;

# Assumes that
my $root = path($0)->parent(2);

my $path_to_bsonpm = shift(@ARGV);
die "Usage: $0 <path-to-bson>\n" unless $path_to_bsonpm;

my $bsonpm = path($path_to_bsonpm);
die "'$bsonpm' doesn't look like a path containing BSON.pm\n"
  unless $bsonpm->child(qw/lib BSON.pm/)->exists;

sub try_system {
    my @command = @_;
    say "Running: @command";
    system(@command) and die "Aborting: '@command' failed";
}

sub rsync {
    my ($dir) = @_;
    try_system( 'rsync', '-a', '--delete', $bsonpm->child("corpus"), $root );
    try_system( 'rsync', '-a', '--delete', $bsonpm->child(qw/t common/),
        $root->child("t") );
    try_system( 'rsync', '-a', '--delete', $bsonpm->child(qw/t corpus/),
        $root->child("t") );
    try_system( 'rsync', '-a', '--delete', $bsonpm->child(qw/t lib/),
        $root->child("t") );
    try_system( 'rsync', '-a', '--delete', $bsonpm->child(qw/t mapping/),
        $root->child("t") );
    try_system( 'rsync', '-a', '--delete', $bsonpm->child(qw/t regression/),
        $root->child("t") );
}

rsync();