Alien-Build

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

  - Added Alien::Build::Plugin::Test::Mock
  - Added alienfile_skip_if_missing_prereqs function to Test::Alien::Build
  - Remove run-time dependency on Test2::Suite
    Test2::API is still a run-time dependency, but that has
    been in-core since 5.26.

1.48      2018-07-04 20:33:29 -0400
  - Production release identical to 1.47_01

1.47_01   2018-07-03 23:17:09 -0400
  - Fixed bug where Alien::Base was capturing stderr and stdout
    from pkg-config, instead of just stdout which is what it should
    be doing.
  - Additional diagnostics for xz fail

1.46      2018-06-25 03:08:25 +0000
  - Production release identical to 1.45_01

1.45_01   2018-06-24 08:13:08 -0400
  - Add alt method to Alien::Base.  This merges the capabilities from
    Alien::Role::Alt into core, making that role now obsolete.

Changes  view on Meta::CPAN

  - PkgConfig::CommandLine plugin supports multiple pkg_names
  - PkgConfig::PP plugin supports multiple pkg_names
  - PkgConfig::LibPkgConf is a candidate for removing from core
  - PkgConfig::LibPkgConf plugin supports multiple pkg_names
  - PkgConfig::Negotiate plugin supports multiple pkg_names

0.78_01   2017-07-30 12:55:31 -0400
  - Development release otherwise identical to 0.77

0.77      2017-07-30 12:54:13 -0400
  - Add options to Probe::CommandLine plugin: match_stderr, version_stderr

0.76_01   2017-07-26 11:31:44 -0400
  - Development release otherwise identical to 0.75

0.75      2017-07-26 11:30:11 -0400
  - Disable C++ Test::Alien test on production releases
    C++ in Test::Alien is considered experimental and the
    test has been intermitently causing a hard fail.
    Until the issue is resolved the test will only run on
    development releases

corpus/alien_build_plugin_fetch_curlcommand/record/old.json  view on Meta::CPAN

{"-l ftp://localhost/corpus/alien_build_plugin_fetch_curlcommand/dir/bogus/":{"stdout":"","files":{},"stderr":"  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current\n                                 Dload  Upload   Total   S...

corpus/alien_build_plugin_fetch_curlcommand/record/old.yml  view on Meta::CPAN

---
-L -O -J -f -w @writeout http://localhost/corpus/alien_build_plugin_fetch_curlcommand/dir/bogus.html:
  exit: 22
  files: {}
  stderr: "  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current\n                                 Dload  Upload   Total   Spent    Left  Speed\n\r  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     ...
  stdout: |-
    ab-filename     :bogus.html
    ab-content_type :
    ab-url          :http://localhost/corpus/alien_build_plugin_fetch_curlcommand/dir/bogus.html
-L -O -J -f -w @writeout http://localhost/corpus/alien_build_plugin_fetch_curlcommand/dir/foo-1.01.tar:
  exit: 0
  files:
    foo-1.01.tar: "content:foo-1.01\n"
  stderr: "  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current\n                                 Dload  Upload   Total   Spent    Left  Speed\n\r  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     ...
  stdout: |-
    ab-filename     :foo-1.01.tar
    ab-content_type :text/plain
    ab-url          :http://localhost/corpus/alien_build_plugin_fetch_curlcommand/dir/foo-1.01.tar
-L -O -J -f -w @writeout http://localhost/corpus/alien_build_plugin_fetch_curlcommand/dir/html_test.html:
  exit: 0
  files:
    html_test.html: "<html><head><title>Hello World</title></head><body><p>Hello World</p></body></html>\n"
  stderr: "  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current\n                                 Dload  Upload   Total   Spent    Left  Speed\n\r  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     ...
  stdout: |-
    ab-filename     :html_test.html
    ab-content_type :text/html;charset=UTF-8
    ab-url          :http://localhost/corpus/alien_build_plugin_fetch_curlcommand/dir/html_test.html
-L -f -O -J -w @writeout http://localhost/corpus/alien_build_plugin_fetch_curlcommand/dir/bogus.html:
  exit: 22
  files: {}
  stderr: "  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current\n                                 Dload  Upload   Total   Spent    Left  Speed\n\r  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     ...
  stdout: |-
    ab-filename     :bogus.html
    ab-content_type :
    ab-url          :http://localhost/corpus/alien_build_plugin_fetch_curlcommand/dir/bogus.html
-L -f -O -J -w @writeout http://localhost/corpus/alien_build_plugin_fetch_curlcommand/dir/foo-1.01.tar:
  exit: 0
  files:
    foo-1.01.tar: "content:foo-1.01\n"
  stderr: "  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current\n                                 Dload  Upload   Total   Spent    Left  Speed\n\r  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     ...
  stdout: |-
    ab-filename     :foo-1.01.tar
    ab-content_type :text/plain;charset=UTF-8
    ab-url          :http://localhost/corpus/alien_build_plugin_fetch_curlcommand/dir/foo-1.01.tar
-L -f -O -J -w @writeout http://localhost/corpus/alien_build_plugin_fetch_curlcommand/dir/html_test.html:
  exit: 0
  files:
    html_test.html: "<html><head><title>Hello World</title></head><body><p>Hello World</p></body></html>\n"
  stderr: "  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current\n                                 Dload  Upload   Total   Spent    Left  Speed\n\r  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     ...
  stdout: |-
    ab-filename     :html_test.html
    ab-content_type :text/html;charset=UTF-8
    ab-url          :http://localhost/corpus/alien_build_plugin_fetch_curlcommand/dir/html_test.html
-L -f -O -w @writeout http://localhost/corpus/alien_build_plugin_fetch_curlcommand/dir/bogus.html:
  exit: 22
  files: {}
  stderr: "  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current\n                                 Dload  Upload   Total   Spent    Left  Speed\n\r  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     ...
  stdout: |-
    ab-filename     :bogus.html
    ab-content_type :
    ab-url          :http://localhost/corpus/alien_build_plugin_fetch_curlcommand/dir/bogus.html
-L -f -O -w @writeout http://localhost/corpus/alien_build_plugin_fetch_curlcommand/dir/foo-1.01.tar:
  exit: 0
  files:
    foo-1.01.tar: "content:foo-1.01\n"
  stderr: "  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current\n                                 Dload  Upload   Total   Spent    Left  Speed\n\r  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     ...
  stdout: |-
    ab-filename     :foo-1.01.tar
    ab-content_type :text/plain;charset=UTF-8
    ab-url          :http://localhost/corpus/alien_build_plugin_fetch_curlcommand/dir/foo-1.01.tar
-L -f -O -w @writeout http://localhost/corpus/alien_build_plugin_fetch_curlcommand/dir/html_test.html:
  exit: 0
  files:
    html_test.html: "<html><head><title>Hello World</title></head><body><p>Hello World</p></body></html>\n"
  stderr: "  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current\n                                 Dload  Upload   Total   Spent    Left  Speed\n\r  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     ...
  stdout: |-
    ab-filename     :html_test.html
    ab-content_type :text/html;charset=UTF-8
    ab-url          :http://localhost/corpus/alien_build_plugin_fetch_curlcommand/dir/html_test.html
-L -f -o content -w @writeout http://localhost/corpus/alien_build_plugin_fetch_curlcommand/dir/bogus.html:
  exit: 22
  files: {}
  stderr: "  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current\n                                 Dload  Upload   Total   Spent    Left  Speed\n\r  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     ...
  stdout: |-
    ab-filename     :content
    ab-content_type :
    ab-url          :http://localhost/corpus/alien_build_plugin_fetch_curlcommand/dir/bogus.html
-L -f -o content -w @writeout http://localhost/corpus/alien_build_plugin_fetch_curlcommand/dir/foo-1.01.tar:
  exit: 0
  files:
    content: "content:foo-1.01\n"
  stderr: "  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current\n                                 Dload  Upload   Total   Spent    Left  Speed\n\r  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     ...
  stdout: |-
    ab-filename     :content
    ab-content_type :text/plain
    ab-url          :http://localhost/corpus/alien_build_plugin_fetch_curlcommand/dir/foo-1.01.tar
-L -f -o content -w @writeout http://localhost/corpus/alien_build_plugin_fetch_curlcommand/dir/html_test.html:
  exit: 0
  files:
    content: "<html><head><title>Hello World</title></head><body><p>Hello World</p></body></html>\n"
  stderr: "  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current\n                                 Dload  Upload   Total   Spent    Left  Speed\n\r  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     ...
  stdout: |-
    ab-filename     :content
    ab-content_type :text/html;charset=UTF-8
    ab-url          :http://localhost/corpus/alien_build_plugin_fetch_curlcommand/dir/html_test.html
-l ftp://localhost/corpus/alien_build_plugin_fetch_curlcommand/dir/:
  exit: 0
  files: {}
  stderr: "  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current\n                                 Dload  Upload   Total   Spent    Left  Speed\n\r  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     ...
  stdout: |
    foo-1.00.tar
    foo-1.01.tar
    foo-1.02.tar
    html_test.html
-l ftp://localhost/corpus/alien_build_plugin_fetch_curlcommand/dir/bogus.txt/:
  exit: 9
  files: {}
  stderr: "  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current\n                                 Dload  Upload   Total   Spent    Left  Speed\n\r  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     ...
  stdout: ''
-l ftp://localhost/corpus/alien_build_plugin_fetch_curlcommand/dir/bogus/:
  exit: 9
  files: {}
  stderr: "  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current\n                                 Dload  Upload   Total   Spent    Left  Speed\n\r  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     ...
  stdout: ''
-o bogus.txt ftp://localhost/corpus/alien_build_plugin_fetch_curlcommand/dir/bogus.txt:
  exit: 78
  files: {}
  stderr: "  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current\n                                 Dload  Upload   Total   Spent    Left  Speed\n\r  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     ...
  stdout: ''
-o dir ftp://localhost/corpus/alien_build_plugin_fetch_curlcommand/dir:
  exit: 78
  files: {}
  stderr: "  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current\n                                 Dload  Upload   Total   Spent    Left  Speed\n\r  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     ...
  stdout: ''
-o foo-1.01.tar ftp://localhost/corpus/alien_build_plugin_fetch_curlcommand/dir/foo-1.01.tar:
  exit: 0
  files:
    foo-1.01.tar: "content:foo-1.01\n"
  stderr: "  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current\n                                 Dload  Upload   Total   Spent    Left  Speed\n\r  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     ...
  stdout: ''

corpus/alien_build_plugin_fetch_wget/record/old.json  view on Meta::CPAN

{"-k --content-disposition -S http://localhost/corpus/alien_build_plugin_fetch_wget/dir/foo-1.01.tar":{"stderr":"--2021-05-12 00:10:35--  http://localhost/corpus/alien_build_plugin_fetch_wget/dir/foo-1.01.tar\nResolving localhost (localhost)... ::1, ...

corpus/alien_build_plugin_fetch_wget/record/old.yml  view on Meta::CPAN

---
--help:
  exit: 0
  files: {}
  stderr: ''
  stdout: |
    GNU Wget 1.20.1, a non-interactive network retriever.
    Usage: wget [OPTION]... [URL]...
    
    Mandatory arguments to long options are mandatory for short options too.
    
    Startup:
      -V,  --version                   display the version of Wget and exit
      -h,  --help                      print this help
      -b,  --background                go to background after startup

corpus/alien_build_plugin_fetch_wget/record/old.yml  view on Meta::CPAN

           --trust-server-names        use the name specified by the redirection
                                         URL's last component
      -X,  --exclude-directories=LIST  list of excluded directories
      -np, --no-parent                 don't ascend to the parent directory
    
    Email bug reports, questions, discussions to <bug-wget@gnu.org>
    and/or open issues at https://savannah.gnu.org/bugs/?func=additem&group=wget.
-k --content-disposition -S http://localhost/corpus/alien_build_plugin_fetch_wget/dir/bogus.html:
  exit: 8
  files: {}
  stderr: |
    --2021-05-12 00:10:35--  http://localhost/corpus/alien_build_plugin_fetch_wget/dir/bogus.html
    Resolving localhost (localhost)... ::1, 127.0.0.1
    Connecting to localhost (localhost)|::1|:42643... failed: Connection refused.
    Connecting to localhost (localhost)|127.0.0.1|:42643... connected.
    HTTP request sent, awaiting response... 
      HTTP/1.0 404 Not Found
      Date: Wed, 12 May 2021 06:10:35 GMT
      Server: HTTP::Server::PSGI
      Content-Type: text/plain
      Content-Length: 9
    2021-05-12 00:10:35 ERROR 404: Not Found.
    
    Converted links in 0 files in 0 seconds.
  stdout: ''
-k --content-disposition -S http://localhost/corpus/alien_build_plugin_fetch_wget/dir/foo-1.01.tar:
  exit: 0
  files:
    foo-1.01.tar: "content:foo-1.01\n"
  stderr: |
    --2021-05-12 00:10:35--  http://localhost/corpus/alien_build_plugin_fetch_wget/dir/foo-1.01.tar
    Resolving localhost (localhost)... ::1, 127.0.0.1
    Connecting to localhost (localhost)|::1|:42643... failed: Connection refused.
    Connecting to localhost (localhost)|127.0.0.1|:42643... connected.
    HTTP request sent, awaiting response... 
      HTTP/1.0 200 OK
      Date: Wed, 12 May 2021 06:10:35 GMT
      Server: HTTP::Server::PSGI
      Content-Type: application/x-tar
      Content-Length: 17

corpus/alien_build_plugin_fetch_wget/record/old.yml  view on Meta::CPAN

         0K                                                       100% 1.65M=0s
    
    2021-05-12 00:10:35 (1.65 MB/s) - ‘foo-1.01.tar’ saved [17/17]
    
    Converted links in 0 files in 0 seconds.
  stdout: ''
-k --content-disposition -S http://localhost/corpus/alien_build_plugin_fetch_wget/dir/html_test.html:
  exit: 0
  files:
    html_test.html: "<html><head><title>Hello World</title></head><body><p>Hello World</p></body></html>\n"
  stderr: |
    --2021-05-12 00:10:35--  http://localhost/corpus/alien_build_plugin_fetch_wget/dir/html_test.html
    Resolving localhost (localhost)... ::1, 127.0.0.1
    Connecting to localhost (localhost)|::1|:42643... failed: Connection refused.
    Connecting to localhost (localhost)|127.0.0.1|:42643... connected.
    HTTP request sent, awaiting response... 
      HTTP/1.0 200 OK
      Date: Wed, 12 May 2021 06:10:35 GMT
      Server: HTTP::Server::PSGI
      Content-Type: text/html; charset=utf-8
      Content-Length: 84

lib/Alien/Base/PkgConfig.pm  view on Meta::CPAN

package Alien::Base::PkgConfig;

use strict;
use warnings;
use 5.008004;
use Carp;
use Config;
use Path::Tiny qw( path );
use Capture::Tiny qw( capture_stderr );

# ABSTRACT: Private legacy pkg-config class for Alien::Base
our $VERSION = '2.84'; # VERSION


sub new {
  my $class   = shift;

  # allow creation of an object from a full spec.
  if (ref $_[0] eq 'HASH') {

lib/Alien/Base/PkgConfig.pm  view on Meta::CPAN

      if defined $override and ref $override ne 'HASH';
  }

  return $self->_interpolate_vars( $self->{keywords}{$keyword}, $override );
}

my $pkg_config_command;

sub pkg_config_command {
  unless (defined $pkg_config_command) {
    capture_stderr {

      # For now we prefer PkgConfig.pm over pkg-config on
      # Solaris 64 bit Perls.  We may need to do this on
      # other platforms, in which case this logic should
      # be abstracted so that it can be shared here and
      # in Build.PL

      if (`pkg-config --version` && $? == 0 && !($^O eq 'solaris' && $Config{ptrsize} == 8)) {
        $pkg_config_command = 'pkg-config';
      } else {

lib/Alien/Build/Plugin/Fetch/CurlCommand.pm  view on Meta::CPAN

          $self->curl_command,
          '-L', '-f', '-O', '-J',
          -w => '@writeout',
          @headers,
        );

        push @command, -D => 'head' if $self->_see_headers;

        push @command, $url;

        my($stdout, $stderr) = $self->_execute($build, @command);

        my %h = map { /^ab-(.*?)\s*:(.*)$/ ? ($1 => $2) : () } split /\n/, $stdout;

        if(-e 'head')
        {
          $build->log(" ~ $_ => $h{$_}") for sort keys %h;
          $build->log(" header: $_") for path('headers')->lines;
        }

        my($type) = split /;/, $h{content_type};

lib/Alien/Build/Plugin/Fetch/CurlCommand.pm  view on Meta::CPAN

            filename => $h{filename},
            path     => path($h{filename})->absolute->stringify,
            protocol => $scheme,
          };
        }
      }
#      elsif($scheme eq 'ftp')
#      {
#        if($url =~ m{/$})
#        {
#          my($stdout, $stderr) = $self->_execute($build, $self->curl_command, -l => $url);
#          chomp $stdout;
#          return {
#            type => 'list',
#            list => [
#              map { { filename => $_, url => "$url$_" } } sort split /\n/, $stdout,
#            ],
#          };
#        }
#
#        my $first_error;
#
#        {
#          local $CWD = tempdir( CLEANUP => 1 );
#
#          my($filename) = $url =~ m{/([^/]+)$};
#          $filename = 'unknown' if (! defined $filename) || ($filename eq '');
#          my($stdout, $stderr) = eval { $self->_execute($build, $self->curl_command, -o => $filename, $url) };
#          $first_error = $@;
#          if($first_error eq '')
#          {
#            return {
#              type     => 'file',
#              filename => $filename,
#              path     => path($filename)->absolute->stringify,
#            };
#          }
#        }
#
#        {
#          my($stdout, $stderr) = eval { $self->_execute($build, $self->curl_command, -l => "$url/") };
#          if($@ eq '')
#          {
#            chomp $stdout;
#            return {
#              type => 'list',
#              list => [
#                map { { filename => $_, url => "$url/$_" } } sort split /\n/, $stdout,
#              ],
#            };
#          };

lib/Alien/Build/Plugin/Fetch/CurlCommand.pm  view on Meta::CPAN

    },
  ) if $self->curl_command;

  $self;
}

sub _execute
{
  my($self, $build, @command) = @_;
  $build->log("+ @command");
  my($stdout, $stderr, $err) = capture {
    system @command;
    $?;
  };
  if($err)
  {
    chomp $stderr;
    $build->log($_) for split /\n/, $stderr;
    if($stderr =~ /Remote filename has no length/ && !!(any { /^-O$/ } @command))
    {
      my @new_command = map {
        /^-O$/ ? ( -o => 'index.html' ) : /^-J$/ ? () : ($_)
      } @command;
      return $self->_execute($build, @new_command);
    }
    die "error in curl fetch";
  }
  ($stdout, $stderr);
}

1;

__END__

=pod

=encoding UTF-8

lib/Alien/Build/Plugin/Fetch/Wget.pm  view on Meta::CPAN

              push @{ $headers{$key} }, $value;
            }
            @headers = pairmap { "--header=$a: @{[ join ', ', @$b ]}" } %headers;
          }
          else
          {
            $build->log("Fetch for $url with http_headers that is not an array reference");
          }
        }

        my($stdout, $stderr) = $self->_execute(
          $build,
          $self->wget_command,
          '-k', '--content-disposition', '-S',
          @headers,
          $url,
        );

        my($path) = path('.')->children;
        die "no file found after wget" unless $path;
        my($type) = $stderr =~ /Content-Type:\s*(.*?)$/m;
        $type =~ s/;.*$// if $type;
        if($type eq 'text/html')
        {
          return {
            type     => 'html',
            base     => $url,
            content  => scalar $path->slurp,
            protocol => $scheme,
          };
        }

lib/Alien/Build/Plugin/Fetch/Wget.pm  view on Meta::CPAN

        die "scheme $scheme is not supported by the Fetch::Wget plugin";
      }
    },
  ) if $self->wget_command;
}

sub _execute
{
  my($self, $build, @command) = @_;
  $build->log("+ @command");
  my($stdout, $stderr, $err) = capture {
    system @command;
    $?;
  };
  if($err)
  {
    chomp $stderr;
    $stderr = [split /\n/, $stderr]->[-1];
    die "error in wget fetch: $stderr";
  }
  ($stdout, $stderr);
}

1;

__END__

=pod

=encoding UTF-8

lib/Alien/Build/Plugin/Probe/CommandLine.pm  view on Meta::CPAN


has 'args'       => [];


has 'secondary' => 0;


has 'match'     => undef;


has 'match_stderr' => undef;


has 'version'   => undef;


has 'version_stderr' => undef;


has 'atleast_version' => undef;


sub init
{
  my($self, $meta) = @_;

  my $check = sub {
    my($build) = @_;

    unless(File::Which::which($self->command))
    {
      die 'Command not found ' . $self->command;
    }

    if(defined $self->match || defined $self->match_stderr || defined $self->version || defined $self->version_stderr)
    {
      my($out,$err,$ret) = capture {
        system( $self->command, @{ $self->args } );
      };
      die 'Command did not return a true value' if $ret;
      die 'Command output did not match' if defined $self->match && $out !~ $self->match;
      die 'Command standard error did not match' if defined $self->match_stderr && $err !~ $self->match_stderr;
      if (defined $self->version or defined $self->version_stderr)
      {
        my $found_version = '0';
        if(defined $self->version)
        {
          if($out =~ $self->version)
          {
            $found_version = $1;
            $build->runtime_prop->{version} = $found_version;
          }
        }
        if(defined $self->version_stderr)
        {
          if($err =~ $self->version_stderr)
          {
            $found_version = $1;
            $build->hook_prop->{version} = $found_version;
            $build->runtime_prop->{version} = $found_version;
          }
        }
        if (my $atleast_version = $self->atleast_version)
        {
          if(version_cmp ($found_version, $self->atleast_version) < 0)
          {

lib/Alien/Build/Plugin/Probe/CommandLine.pm  view on Meta::CPAN

 use alienfile;
 plugin 'Probe::CommandLine' => (
   command   => 'gzip',
   secondary => 0, # default
 );

=head2 match

Regular expression for which the program output should match.

=head2 match_stderr

Regular expression for which the program standard error should match.

=head2 version

Regular expression to parse out the version from the program output.
The regular expression should store the version number in C<$1>.

=head2 version_stderr

Regular expression to parse out the version from the program standard error.
The regular expression should store the version number in C<$1>.

=head2 atleast_version

The minimum required version as provided by the system.

=head1 SEE ALSO

t/alien_build_plugin_probe_commandline.t  view on Meta::CPAN

      command => 'foo',
      version => qr/version ([0-9\.]+)/,
      atleast_version => '1.5.0'
    );
    is cap { $build->probe }, 'share';
    is $build->runtime_prop->{version}, undef;
  };

};

subtest 'match_stderr + version_stderr' => sub {

  my $guard = system_fake
    'foo' => sub { print STDERR "Froodle Foomaker version 1.00\n"; return 0 },
  ;

  subtest 'match good' => sub {
    my($build) = build(command => 'foo', match_stderr => qr/Froodle/);
    is cap { $build->probe }, 'system';
  };

  subtest 'match bad' => sub {
    my($build) = build(command => 'foo', match_stderr => qr/Droodle/);
    is cap { $build->probe }, 'share';
  };

  subtest 'version found' => sub {
    my($build) = build(command => 'foo', version_stderr => qr/version ([0-9\.]+)/);
    is cap { $build->probe }, 'system';
    is $build->runtime_prop->{version}, '1.00';
  };

  subtest 'version unfound' => sub {
    my($build) = build(command => 'foo', version_stderr => qr/version = ([0-9\.]+)/);
    is cap { $build->probe }, 'system';
    is $build->runtime_prop->{version}, undef;
  };


};

done_testing;

t/lib/MyTest/FauxFetchCommand.pm  view on Meta::CPAN

my $command_name = $test_name =~ /curlcommand/ ? 'curl' : 'wget';

my %record = %{ decode_json path("corpus/$test_name/record/old.json")->slurp };

sub real_cmd
{
  my(@args) = @_;

  my %old = map { $_->basename => 1 } path('.')->children;

  my($stdout, $stderr, $exit) = tee {
    CORE::system $command_name, @args;
    $? >> 8;
  };

  my $key = "@args";

  for($key, $stdout, $stderr)
  {
    s{http://localhost.*?/corpus}{http://localhost/corpus}g;
    s{ftp://[a-z]+:[a-z]+\@localhost:[0-9]+/.*?/corpus}{ftp://localhost/corpus}g;
  }

  my %files;

  if(! -d ".git")
  {
    foreach my $child (path('.')->children)
    {
      next if $old{$child->basename};
      $files{$child->basename} = $child->slurp;
    }
  }

  $record{$key} = {
    stdout => $stdout,
    stderr => $stderr,
    exit   => $exit,
    files  => \%files,
  };

  $exit;
}

sub faux_cmd
{
  my(@args) = @_;

t/lib/MyTest/FauxFetchCommand.pm  view on Meta::CPAN


  unless($record{$key})
  {
    my $ctx = context();
    $ctx->bail("do not have a record for $command_name $key");
  }

  my $run = $record{$key};

  print STDOUT $run->{stdout};
  print STDERR $run->{stderr};

  foreach my $filename (keys %{ $run->{files} })
  {
    path($filename)->spew($run->{files}->{$filename});
  }

  $run->{exit};
}

sub test_config ($)

xt/author/pod_spelling_system.t  view on Meta::CPAN

  if -r $config_filename;

plan skip_all => 'disabled' if $config->{pod_spelling_system}->{skip};

chdir(File::Spec->catdir($FindBin::Bin, File::Spec->updir, File::Spec->updir));

add_stopwords($config->{pod_spelling_system}->{stopwords}->@*);
add_stopwords(qw(
Plicease
stdout
stderr
stdin
subref
loopback
username
os
Ollis
Mojolicious
plicease
CPAN
reinstall



( run in 1.173 second using v1.01-cache-2.11-cpan-49f99fa48dc )