commit 3f3886e1f210ad2853209c5aecd0951350a6f758 Author: Nicolas Vigier boklm@torproject.org Date: Wed Mar 15 12:25:39 2017 +0100
Add the input_files_paths option --- NEWS | 2 ++ doc/rbm_config.asc | 6 ++++++ lib/RBM.pm | 23 ++++++++++++++++++++++- lib/RBM/DefaultConfig.pm | 1 + 4 files changed, 31 insertions(+), 1 deletion(-)
diff --git a/NEWS b/NEWS index 5de36e0..4eac374 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,5 @@ +- Add the input_files_paths option + - Add the ENV option
- Add the build_log option diff --git a/doc/rbm_config.asc b/doc/rbm_config.asc index 48e505c..2e9b8ab 100644 --- a/doc/rbm_config.asc +++ b/doc/rbm_config.asc @@ -220,6 +220,12 @@ input_files_id:: file of type +project+, and the +filename+ and the sha256sum of the file for any other type of input file.
+input_files_paths:: + The value of this option is an array of all the paths of input + files that currently exist and are used in the build of the + current project and its dependencies. This is useful when + cleaning old build files, to find which ones are still used. + timestamp:: This is the UNIX timestamp, set as modification time on files created such as the sources tarball and rpm spec file. The diff --git a/lib/RBM.pm b/lib/RBM.pm index 632a8ba..79e0670 100644 --- a/lib/RBM.pm +++ b/lib/RBM.pm @@ -731,8 +731,9 @@ sub input_files { my ($action, $project, $options, $dest_dir) = @_; my @res_copy; my %res_getfnames; + my @res_getfpaths; my $getfnames_noname = 0; - my $need_dl = 1; + my $need_dl = $action ne 'getfpaths'; my $input_files_id = ''; $options = {$options ? %$options : ()}; my $input_files = project_config($project, 'input_files', $options,); @@ -840,6 +841,25 @@ sub input_files { $input_files_id .= "\n"; next; } + if ($action eq 'getfpaths') { + push @res_getfpaths, $fname if $fname; + if ($file_gpg_id && $fname) { + my $sig_ext = $t->('sig_ext'); + $sig_ext = ref $sig_ext eq 'ARRAY' ? $sig_ext : [ $sig_ext ]; + foreach my $s (@$sig_ext) { + if (-f "$fname.$s") { + push @res_getfpaths, "$fname.$s"; + last; + } + } + } + if ($input_file->{project} && $t->('project')) { + my $r = RBM::project_step_config($t->('project'), 'input_files_paths', + {%$options, step => $t->('pkg_type'), %$input_file}); + push @res_getfpaths, @$r if @$r; + } + next; + } exit_error "Missing file $name" unless $fname; if ($t->('sha256sum') && $t->('sha256sum') ne sha256_hex(read_file($fname))) { @@ -886,6 +906,7 @@ sub input_files { return sha256_hex($input_files_id) if $action eq 'input_files_id'; return @res_copy if $action eq 'copy'; return %res_getfnames if $action eq 'getfnames'; + return @res_getfpaths if $action eq 'getfpaths'; }
sub system_log { diff --git a/lib/RBM/DefaultConfig.pm b/lib/RBM/DefaultConfig.pm index c0764bd..cf0ed74 100644 --- a/lib/RBM/DefaultConfig.pm +++ b/lib/RBM/DefaultConfig.pm @@ -583,6 +583,7 @@ ZIP_END arch => &get_arch, input_files_by_name => sub { RBM::input_files('getfnames', @_); }, input_files_id => sub { RBM::input_files('input_files_id', @_); }, + input_files_paths => sub { RBM::input_files('getfpaths', @_); }, steps => { srpm => 'rpm', 'deb-src' => 'deb',