File: update-copied-tests

package info (click to toggle)
libmaxmind-db-reader-xs-perl 1.000009-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,648 kB
  • sloc: perl: 3,263; ansic: 260; makefile: 3; sh: 2
file content (42 lines) | stat: -rwxr-xr-x 804 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
42
#!/usr/bin/env perl

use strict;
use warnings;
use autodie qw( :all );

use 5.01000;

use File::Copy qw( copy );
use File::Find::Rule;
use File::pushd;
use File::Temp qw( tempdir );
use Path::Class qw( file );

my $branch = shift || 'main';

my $tempdir = tempdir( CLEANUP => 1 );

{
    my $dir = pushd($tempdir);

    system(
        'git',      'clone',
        '--branch', $branch,
        'git://github.com/maxmind/MaxMind-DB-Reader-perl.git',
        'pp'
    );
}

my $t_root = "$tempdir/pp/t";

for my $file ( File::Find::Rule->name(qr/\.t$/)->in($t_root) ) {
    open my $fh, '<', $file;
    my $first_line = <$fh>;

    next if $first_line =~ /^\# PP only/;

    my $to_file = file( 't', $file =~ s{^\Q$t_root\E/}{}r );

    $to_file->dir()->mkpath( 0, 0755 );
    copy( $file => $to_file );
}