morgan pushed to branch main at The Tor Project / Applications / RBM
Commits:
-
1b1b183f
by Nicolas Vigier at 2025-06-19T15:45:19+02:00
5 changed files:
Changes:
... | ... | @@ -27,6 +27,7 @@ MAN1_ASC += rbm.asc |
27 | 27 | MAN1_ASC += rbm-usage.asc
|
28 | 28 | MAN1_ASC += rbm-tar.asc
|
29 | 29 | MAN1_ASC += rbm-showconf.asc
|
30 | +MAN1_ASC += rbm-show_used_projects.asc
|
|
30 | 31 | MAN1_ASC += rbm-fetch.asc
|
31 | 32 | MAN1_ASC += rbm-build.asc
|
32 | 33 |
... | ... | @@ -15,6 +15,7 @@ rbm commands : |
15 | 15 | - link:rbm-usage.html[rbm-usage(1)]
|
16 | 16 | - link:rbm-tar.html[rbm-tar(1)]
|
17 | 17 | - link:rbm-showconf.html[rbm-showconf(1)]
|
18 | +- link:rbm-show_used_projects.html[rbm-show_used_projects(1)]
|
|
18 | 19 | - link:rbm-build.html[rbm-build(1)]
|
19 | 20 | - link:rbm-fetch.html[rbm-fetch(1)]
|
20 | 21 |
1 | +rbm-show_used_projects(1)
|
|
2 | +=========================
|
|
3 | + |
|
4 | +NAME
|
|
5 | +----
|
|
6 | +rbm-show_used_projects - Show which projects are used when processing a config option
|
|
7 | + |
|
8 | + |
|
9 | +SYNOPSIS
|
|
10 | +--------
|
|
11 | +[verse]
|
|
12 | +'rbm show_used_projects' <project> <config name> [options]
|
|
13 | + |
|
14 | +DESCRIPTION
|
|
15 | +-----------
|
|
16 | + |
|
17 | +This command works in a similar way to showconf, but instead of printing
|
|
18 | +the selected config option, it will print the projects that were used
|
|
19 | +while processing this option.
|
|
20 | + |
|
21 | +COMMAND LINE OPTIONS
|
|
22 | +--------------------
|
|
23 | +See link:rbm_cli.html[rbm_cli(7)].
|
|
24 | + |
|
25 | +EXAMPLE
|
|
26 | +-------
|
|
27 | + |
|
28 | +Show which projects are being used when processing the build script
|
|
29 | +from the 'release' project using the 'alpha' target:
|
|
30 | +----
|
|
31 | +$ rbm show_used_projects release build --target alpha
|
|
32 | +----
|
|
33 | + |
|
34 | +SEE ALSO
|
|
35 | +--------
|
|
36 | +link:rbm.html[rbm(1)],
|
|
37 | +link:rbm_config.html[rbm_config(7)] |
... | ... | @@ -34,6 +34,13 @@ BEGIN { |
34 | 34 | |
35 | 35 | our $config;
|
36 | 36 | |
37 | +our %used_projects;
|
|
38 | +our $store_used_projects;
|
|
39 | + |
|
40 | +sub get_used_projects {
|
|
41 | + return sort keys %used_projects;
|
|
42 | +}
|
|
43 | + |
|
37 | 44 | sub load_config_file {
|
38 | 45 | my $res = {};
|
39 | 46 | my @conf;
|
... | ... | @@ -243,6 +250,7 @@ sub confkey_str { |
243 | 250 | |
244 | 251 | sub project_config {
|
245 | 252 | my ($project, $name, $options) = @_;
|
253 | + $used_projects{$project} = 1 if $store_used_projects;
|
|
246 | 254 | CORE::state %config_cache;
|
247 | 255 | my $res;
|
248 | 256 | my $error_if_undef = $options->{error_if_undef};
|
... | ... | @@ -30,6 +30,10 @@ my %actions = ( |
30 | 30 | run => \&show_conf,
|
31 | 31 | descr => 'Show configuration',
|
32 | 32 | },
|
33 | + show_used_projects => {
|
|
34 | + run => \&show_used_projects,
|
|
35 | + descr => 'Show the list of used projects when getting a config option',
|
|
36 | + },
|
|
33 | 37 | usage => {
|
34 | 38 | run => \&usage,
|
35 | 39 | descr => 'Show usage information for an action',
|
... | ... | @@ -104,6 +108,19 @@ sub show_conf { |
104 | 108 | print ref $r ? YAML::XS::Dump($r) : "$r\n";
|
105 | 109 | }
|
106 | 110 | |
111 | +sub show_used_projects {
|
|
112 | + shift;
|
|
113 | + my $args = set_options(@_);
|
|
114 | + usageexit('show_used_projects') unless @$args == 2;
|
|
115 | + my $project = shift @$args;
|
|
116 | + $RBM::store_used_projects = 1;
|
|
117 | + RBM::valid_project($project);
|
|
118 | + my $r = RBM::project_config($project, @$args);
|
|
119 | + RBM::exit_error "Undefined" unless defined $r;
|
|
120 | + my @usedprojects = RBM::get_used_projects;
|
|
121 | + print join("\n", @usedprojects), "\n";
|
|
122 | +}
|
|
123 | + |
|
107 | 124 | sub fetch {
|
108 | 125 | shift;
|
109 | 126 | $RBM::config->{run}{fetch} = 1;
|