commit 31be478688e0448d36373d21939922f2a108aeea Author: Nicolas Vigier boklm@torproject.org Date: Mon Aug 7 23:44:06 2017 +0200
rbm-build: allow selecting the build script using the step option --- doc/rbm-build.asc | 16 ++++++++++++---- doc/rbm-deb-src.asc | 2 ++ doc/rbm-deb.asc | 2 ++ doc/rbm-rpm.asc | 2 ++ doc/rbm-srpm.asc | 2 ++ doc/rbm_cli.asc | 5 +++-- lib/RBM.pm | 2 +- rbm | 1 + test.pl | 2 +- 9 files changed, 26 insertions(+), 8 deletions(-)
diff --git a/doc/rbm-build.asc b/doc/rbm-build.asc index 042ab41..e7a2666 100644 --- a/doc/rbm-build.asc +++ b/doc/rbm-build.asc @@ -19,16 +19,24 @@ Build a package for the selected project. CONFIGURATION OPTIONS ---------------------
-The +build+ option is used as the build script. The default value of -the +build+ option is '[% INCLUDE build -%]' which means that you can -create the build script as a +build+ file in the project's directory. +When no +step+ was selected in the command line options, the +build+ +option is used as the build script. The default value of the +build+ +option is '[% INCLUDE build -%]' which means that you can create the +build script as a +build+ file in the project's directory. + +If a +step+ is selected in the command line options, an option of the +same name is used as the build script.
See link:rbm_config.html[rbm_config(7)] for all other options.
COMMAND LINE OPTIONS -------------------- -See link:rbm_cli.html[rbm_cli(7)]. + +The --step=<step> option can be used to select the build script to run. + +See link:rbm_cli.html[rbm_cli(7)] for the other command line options.
SEE ALSO -------- link:rbm.html[rbm(1)] +link:rbm_steps.html[rbm_steps(7)] diff --git a/doc/rbm-deb-src.asc b/doc/rbm-deb-src.asc index 07c8f39..d0212ea 100644 --- a/doc/rbm-deb-src.asc +++ b/doc/rbm-deb-src.asc @@ -16,6 +16,8 @@ DESCRIPTION
Create a debian source package for the selected project.
+This is equivalent to running 'rbm build --step deb_src <project>'. + CONFIGURATION OPTIONS ---------------------
diff --git a/doc/rbm-deb.asc b/doc/rbm-deb.asc index 4f0562e..0544b89 100644 --- a/doc/rbm-deb.asc +++ b/doc/rbm-deb.asc @@ -16,6 +16,8 @@ DESCRIPTION
Build a debian package.
+This is equivalent to running 'rbm build --step deb <project>'. + CONFIGURATION OPTIONS ---------------------
diff --git a/doc/rbm-rpm.asc b/doc/rbm-rpm.asc index 1edc118..75f1886 100644 --- a/doc/rbm-rpm.asc +++ b/doc/rbm-rpm.asc @@ -16,6 +16,8 @@ DESCRIPTION
Build an rpm package for the selected project.
+This is equivalent to running 'rbm build --step rpm <project>'. + CONFIGURATION OPTIONS ---------------------
diff --git a/doc/rbm-srpm.asc b/doc/rbm-srpm.asc index 9fe40fb..bc2a28c 100644 --- a/doc/rbm-srpm.asc +++ b/doc/rbm-srpm.asc @@ -16,6 +16,8 @@ DESCRIPTION
Create a source rpm package for the select project.
+This is equivalent to running 'rbm build --step srpm <project>'. + CONFIGURATION OPTIONS ---------------------
diff --git a/doc/rbm_cli.asc b/doc/rbm_cli.asc index adb8b27..0e6828c 100644 --- a/doc/rbm_cli.asc +++ b/doc/rbm_cli.asc @@ -65,8 +65,9 @@ The following options can be set on the command line : directory in case of build failure.
--step:: - This sets the current step. This is only meaningful with the - showconf command. + This sets the current step when using the showconf command. When + using the build command this is used to select the step (and build + script of the same name) to start.
include::clioptions_tar.asc[]
diff --git a/lib/RBM.pm b/lib/RBM.pm index 888c3e1..100bc04 100644 --- a/lib/RBM.pm +++ b/lib/RBM.pm @@ -46,7 +46,7 @@ sub load_config { $config = load_config_file($config_file); $config->{default} = %default_config; $config->{basedir} = dirname($config_file); - $config->{step} = 'init'; + $config->{step} = 'rbm_init'; $config->{opt} = {}; my $pdir = $config->{projects_dir} || $config->{default}{projects_dir}; foreach my $p (glob path($pdir) . '/*') { diff --git a/rbm b/rbm index 9a8ccf2..2c4ad0d 100755 --- a/rbm +++ b/rbm @@ -173,6 +173,7 @@ sub build_script { my $cmd = shift; my $args = set_options(@_); usageexit($cmd) unless @$args == 1; + $script_name = $RBM::config->{step} if $RBM::config->{step} ne 'rbm_init'; RBM::build_pkg($args->[0], { pkg_type => $script_name }); }
diff --git a/test.pl b/test.pl index 2748614..8e842e7 100755 --- a/test.pl +++ b/test.pl @@ -196,7 +196,7 @@ my @tests = (
foreach my $test (@tests) { set_target($test->{target} ? @{$test->{target}} : ()); - set_step($test->{step} ? $test->{step} : 'init'); + set_step($test->{step} ? $test->{step} : 'rbm_init'); if ($test->{config}) { is( RBM::project_config(@{$test->{config}}),
tbb-commits@lists.torproject.org