This is an automated email from the git hooks/post-receive script.
boklm pushed a change to branch main in repository builders/rbm.
from 8ed3aa1 Bug 40010: Add git_branch option new 5255072 Bug 40047: fix options in hg_clone_fetch_chdir new a6ccc10 Bug 40048: Add a hg_clone_subdir option
The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference.
Summary of changes: doc/rbm_config.asc | 7 +++++++ lib/RBM.pm | 23 +++++++++++++++-------- lib/RBM/DefaultConfig.pm | 1 + 3 files changed, 23 insertions(+), 8 deletions(-)
This is an automated email from the git hooks/post-receive script.
boklm pushed a commit to branch main in repository builders/rbm.
commit 52550726bd4bce0e78b38ea69b1462e875023891 Author: Nicolas Vigier boklm@torproject.org AuthorDate: Tue Nov 1 17:58:21 2022 +0100
Bug 40047: fix options in hg_clone_fetch_chdir --- lib/RBM.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/RBM.pm b/lib/RBM.pm index d8e7b13..86d9a9d 100644 --- a/lib/RBM.pm +++ b/lib/RBM.pm @@ -595,7 +595,7 @@ sub maketar { } elsif (project_config($project, 'hg_url', $options)) { $commit_hash = project_config($project, 'hg_hash', $options) || exit_error "No hg_hash specified for project $project"; - hg_clone_fetch_chdir($project); + hg_clone_fetch_chdir($project, $options); } else { return undef; }
This is an automated email from the git hooks/post-receive script.
boklm pushed a commit to branch main in repository builders/rbm.
commit a6ccc103fe59f6b520777308af92bf98113e2c90 Author: Nicolas Vigier boklm@torproject.org AuthorDate: Tue Nov 1 18:22:58 2022 +0100
Bug 40048: Add a hg_clone_subdir option --- doc/rbm_config.asc | 7 +++++++ lib/RBM.pm | 21 ++++++++++++++------- lib/RBM/DefaultConfig.pm | 1 + 3 files changed, 22 insertions(+), 7 deletions(-)
diff --git a/doc/rbm_config.asc b/doc/rbm_config.asc index dc045e2..226ccae 100644 --- a/doc/rbm_config.asc +++ b/doc/rbm_config.asc @@ -145,6 +145,13 @@ hg_clone_dir:: The directory used to store clones of mercurial repositories. The default value is +hg_clones+.
+hg_clone_subdir:: + If this option is set, the repository is cloned in a + subdirectory with that name. This is useful if a single project + requires clones of multiple mercurial repositories, for example + using a different +hg_url+ in each +targets+ or +steps+. + The default value is +.+, which means that no subdirectory is used. + hg_opt:: This option contains options that should be passed on the mercurial command line. This can for instance be useful if you diff --git a/lib/RBM.pm b/lib/RBM.pm index 86d9a9d..2209890 100644 --- a/lib/RBM.pm +++ b/lib/RBM.pm @@ -476,8 +476,8 @@ sub git_clone_fetch_chdir { }
sub hg_need_fetch { - my ($project, $options) = @_; - return 0 if $config->{_rbm}{fetched_projects}{$project}; + my ($project, $subdir, $options) = @_; + return 0 if $config->{_rbm}{hg_fetched_projects}{$project}{$subdir}; my $fetch = project_config($project, 'fetch', $options); if ($fetch eq 'if_needed') { my $hg_hash = project_config($project, 'hg_hash', $options) @@ -495,18 +495,25 @@ sub hg_clone_fetch_chdir { 'hg_clone_dir', $options))); my $hg_url = shell_quote(project_config($project, 'hg_url', $options)) || exit_error "hg_url is undefined"; - my $sq_project = shell_quote($project); - if (!chdir rbm_path("$clonedir/$project")) { + my $subdir = project_config($project, 'hg_clone_subdir', $options); + exit_error "hg_clone_subdir ($subdir) cannot be '..'" if $subdir eq '..'; + exit_error "hg_clone_subdir ($subdir) cannot include / or \" + if $subdir =~ m|[\/]|; + my $destdir = $subdir eq '.' ? $project : "$project/$subdir"; + my $sq_destdir = shell_quote($destdir); + if (!chdir rbm_path("$clonedir/$destdir")) { chdir $clonedir || exit_error "Can't enter directory $clonedir: $!"; - if (system("$hg clone -q $hg_url $sq_project") != 0) { + mkdir $project if $subdir ne '.'; + if (system("$hg clone -q $hg_url $sq_destdir") != 0) { exit_error "Error cloning $hg_url"; } - chdir($project) || exit_error "Error entering $project directory"; + chdir($destdir) || exit_error "Error entering $destdir directory"; } - if (hg_need_fetch($project, $options)) { + if (hg_need_fetch($project, $subdir, $options)) { system("$hg pull -q $hg_url") == 0 || exit_error "Error pulling changes from $hg_url"; } + $config->{_rbm}{hg_fetched_projects}{$project}{$subdir} = 1; }
sub run_script { diff --git a/lib/RBM/DefaultConfig.pm b/lib/RBM/DefaultConfig.pm index b60d5c2..32072c4 100644 --- a/lib/RBM/DefaultConfig.pm +++ b/lib/RBM/DefaultConfig.pm @@ -116,6 +116,7 @@ our %default_config = ( output_dir => 'out', git_clone_dir => 'git_clones', hg_clone_dir => 'hg_clones', + hg_clone_subdir => '.', fetch => 'if_needed', pkg_type => 'build', build => '[% INCLUDE build -%]',
tbb-commits@lists.torproject.org