Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • tpo/applications/rbm
  • gk/rbm
  • boklm/rbm
  • JeremyRand/rbm
  • msimonelli/rbm
  • morgan/rbm
  • Mynacol/rbm
  • ppisar/rbm
  • pierov/rbm
9 results
Show changes
Commits on Source (3)
......@@ -92,6 +92,12 @@ target_prepend::
The same as +target+, but instead of replacing the current targets,
the new targets are prepended.
target_replace::
A hash table containing targets to replace. The key is a regular
expression, and the value the replacement. See +perlre+ manual
page for details about the syntax. Note that referencing capture
groups in the replacement is currently not supported.
enable::
The files are enabled by default. If this option is set to
0, then the file is ignored.
......
......@@ -779,7 +779,7 @@ sub input_file_need_dl {
my ($input_file, $t, $fname, $action) = @_;
return undef if $action eq 'getfpaths';
if ($fname
&& $input_file->{sha256sum}
&& ($input_file->{sha256sum} || $input_file->{norec}{sha256sum})
&& $t->('sha256sum') ne sha256file($fname)) {
sha256file($fname, { remove_cache => 1 });
$fname = undef;
......@@ -787,6 +787,7 @@ sub input_file_need_dl {
if ($action eq 'input_files_id') {
return undef if $input_file->{input_file_id};
return undef if $input_file->{sha256sum};
return undef if $input_file->{norec}{sha256sum};
return undef if $input_file->{exec};
return undef if $fname;
return 1 if $input_file->{URL};
......@@ -810,7 +811,9 @@ sub input_file_id {
my ($input_file, $t, $fname, $filename) = @_;
return $t->('input_file_id') if $input_file->{input_file_id};
return $input_file->{project} . ':' . $filename if $input_file->{project};
return $filename . ':' . $t->('sha256sum') if $input_file->{sha256sum};
if ($input_file->{sha256sum} || $input_file->{norec}{sha256sum}) {
return $filename . ':' . $t->('sha256sum');
}
my $opts = { norec => { output_dir => '/out', getting_id => 1, }};
return $filename . ':' . sha256_hex($t->('exec', $opts))
if $input_file->{exec};
......@@ -898,13 +901,18 @@ sub input_files {
next;
}
if ($input_file->{target} || $input_file->{target_append}
|| $input_file->{target_prepend}) {
|| $input_file->{target_prepend}
|| $input_file->{target_replace}) {
$input_file = { %$input_file };
foreach my $t (qw/target target_append target_prepend/) {
if ($input_file->{$t} && ref $input_file->{$t} ne 'ARRAY') {
exit_error("$t should be an ARRAY:\n" . pp($input_file));
}
}
if ($input_file->{target_replace} &&
ref $input_file->{target_replace} ne 'HASH') {
exit_error("target_replace should be a HASH\n" . pp($input_file));
}
if ($input_file->{target}) {
$input_file->{target} = process_template_opt($project,
$input_file->{target}, $options);
......@@ -923,6 +931,14 @@ sub input_files {
$input_file->{target_append},
$options) } ];
}
if ($input_file->{target_replace}) {
foreach my $pattern (keys %{$input_file->{target_replace}}) {
my $subst = $input_file->{target_replace}{$pattern};
$input_file->{target} = [
map { s/$pattern/$subst/r } @{$input_file->{target}}
];
}
}
}
if ($action eq 'getfnames') {
my $getfnames_name;
......
#!/usr/bin/perl -w
use strict;
use Path::Tiny;
use Test::More tests => 40;
use Test::More tests => 41;
use lib 'lib/';
sub set_target {
......@@ -220,6 +220,14 @@ my @tests = (
'out/r3' => "1 - build\n2 - build\n3 - build\n",
},
},
{
name => 'multi-steps build with changing targets',
target => [ 'target_a' ],
build => [ 'change-targets', 'build', { pkg_type => 'build' } ],
files => {
'out/change-targets.txt' => "no\nz\ntta\n",
},
},
{
name => 'build project in a module',
target => [],
......
# vim: filetype=yaml sw=2
targets:
tt_a:
option_a: 'tta'
steps:
build:
filename: change-targets.txt
build: |
#!/bin/sh
cat preptarget.txt replacetarget-1.txt replacetarget-2.txt > [% dest_dir %]/[% c('filename') %]
input_files:
- name: preptarget
refresh_input: 1
project: change-targets
pkg_type: preptarget
target_prepend:
- target_b
- name: replacetarget
r: 1
refresh_input: 1
project: change-targets
pkg_type: replacetarget
target_replace:
'^target_a$': target_z
- name: replacetarget
r: 2
refresh_input: 1
project: change-targets
pkg_type: replacetarget
target_replace:
'^target_.*$': 'tt_a'
preptarget:
filename: preptarget.txt
preptarget: |
#!/bin/sh
echo [% c('option_a') %] > [% dest_dir %]/[% c('filename') %]
input_files: []
replacetarget:
filename: 'replacetarget-[% c("r") %].txt'
replacetarget: |
#!/bin/sh
echo [% c('option_a') %] > [% dest_dir %]/[% c('filename') %]
input_files: []
version: '[% c("abbrev") %]'
hg_url: https://hg.mozilla.org/qa/mozmill-automation/
hg_hash: bbad7215c713
compress_tar: ''
t: '[% sha256(exec("cat testrun_remote.py")) %]'
build: |
#!/bin/sh
......
......@@ -15,6 +15,8 @@ targets:
- target_c
- target_a
- target_b
target_z:
option_a: z
steps:
rpm:
option_rpm: 1
......