This is an automated email from the git hooks/post-receive script.
boklm pushed a change to branch main in repository builders/rbm.
from c485326 Bug 40043: container: add rbm to /etc/hosts by default new e7b453d Bug 40009: Add git_depth option new 8ed3aa1 Bug 40010: Add git_branch 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/options_tar.asc | 11 +++++++++++ lib/RBM.pm | 29 ++++++++++++++++++----------- 2 files changed, 29 insertions(+), 11 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 e7b453d37a4202ef1d0e41703d3595a4674eeb8d Author: Jeremy Rand jeremyrand@danwin1210.de AuthorDate: Sat May 7 20:46:13 2022 +0000
Bug 40009: Add git_depth option --- doc/options_tar.asc | 5 +++++ lib/RBM.pm | 18 +++++++++++------- 2 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/doc/options_tar.asc b/doc/options_tar.asc index c21317f..40e2cc5 100644 --- a/doc/options_tar.asc +++ b/doc/options_tar.asc @@ -20,6 +20,11 @@ git_submodule:: If this option is enabled, git submodules are fetched and included in the tarball. This option is disabled by default.
+git_depth:: + An integer specifying a depth for shallow Git clone/fetch + depth, to decrease network and storage usage. If not set, + shallow clone/fetch is disabled. + compress_tar:: If set, the tarball created will be compressed in the select format. Possible values: xz, gz, bz2. The default is gz but it diff --git a/lib/RBM.pm b/lib/RBM.pm index a92a04b..fc9a7a1 100644 --- a/lib/RBM.pm +++ b/lib/RBM.pm @@ -437,15 +437,19 @@ sub git_clone_fetch_chdir { 'git_clone_dir', $options))); my $git_url = project_config($project, 'git_url', $options) || exit_error "git_url is undefined"; - my @clone_submod = (); - my @fetch_submod = (); + my @clone_opts = (); + my @fetch_opts = (); if (project_config($project, 'git_submodule', $options)) { - @clone_submod = ('--recurse-submodules'); - @fetch_submod = ('--recurse-submodules=on-demand'); + push @clone_opts, ('--recurse-submodules'); + push @fetch_opts, ('--recurse-submodules=on-demand'); + } + if (my $git_depth = project_config($project, 'git_depth', $options)) { + push @clone_opts, ("--depth=$git_depth"); + push @fetch_opts, ("--depth=$git_depth"); } if (!chdir rbm_path("$clonedir/$project")) { chdir $clonedir || exit_error "Can't enter directory $clonedir: $!"; - if (system('git', 'clone', @clone_submod, $git_url, $project) != 0) { + if (system('git', 'clone', @clone_opts, $git_url, $project) != 0) { exit_error "Error cloning $git_url"; } chdir($project) || exit_error "Error entering $project directory"; @@ -458,10 +462,10 @@ sub git_clone_fetch_chdir { system('git', 'checkout', '-q', '--detach') == 0 || exit_error "Error running git checkout --detach"; } - system('git', 'fetch', @fetch_submod, 'origin', + system('git', 'fetch', @fetch_opts, 'origin', '+refs/heads/*:refs/heads/*') == 0 || exit_error "Error fetching git repository"; - system('git', 'fetch', @fetch_submod, 'origin', + system('git', 'fetch', @fetch_opts, 'origin', '+refs/tags/*:refs/tags/*') == 0 || exit_error "Error fetching git repository"; $config->{_rbm}{fetched_projects}{$project} = 1;
This is an automated email from the git hooks/post-receive script.
boklm pushed a commit to branch main in repository builders/rbm.
commit 8ed3aa1c0b65c711947df2f0d483215510514253 Author: Jeremy Rand jeremyrand@danwin1210.de AuthorDate: Sat May 7 21:05:47 2022 +0000
Bug 40010: Add git_branch option --- doc/options_tar.asc | 6 ++++++ lib/RBM.pm | 15 +++++++++------ 2 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/doc/options_tar.asc b/doc/options_tar.asc index 40e2cc5..898b47c 100644 --- a/doc/options_tar.asc +++ b/doc/options_tar.asc @@ -25,6 +25,12 @@ git_depth:: depth, to decrease network and storage usage. If not set, shallow clone/fetch is disabled.
+git_branch:: + A Git ref name that will be exclusively cloned/fetched, to + decrease network and storage usage. Must be a descendent + (inclusive) of git_hash. If not set, all Git refs are + cloned/fetched. + compress_tar:: If set, the tarball created will be compressed in the select format. Possible values: xz, gz, bz2. The default is gz but it diff --git a/lib/RBM.pm b/lib/RBM.pm index fc9a7a1..d8e7b13 100644 --- a/lib/RBM.pm +++ b/lib/RBM.pm @@ -447,6 +447,11 @@ sub git_clone_fetch_chdir { push @clone_opts, ("--depth=$git_depth"); push @fetch_opts, ("--depth=$git_depth"); } + my @fetch_refs = ('+refs/heads/*:refs/heads/*', '+refs/tags/*:refs/tags/*'); + if (my $git_branch = project_config($project, 'git_branch', $options)) { + push @clone_opts, ('--branch', $git_branch, '--single-branch'); + @fetch_refs = ($git_branch); + } if (!chdir rbm_path("$clonedir/$project")) { chdir $clonedir || exit_error "Can't enter directory $clonedir: $!"; if (system('git', 'clone', @clone_opts, $git_url, $project) != 0) { @@ -462,12 +467,10 @@ sub git_clone_fetch_chdir { system('git', 'checkout', '-q', '--detach') == 0 || exit_error "Error running git checkout --detach"; } - system('git', 'fetch', @fetch_opts, 'origin', - '+refs/heads/*:refs/heads/*') == 0 - || exit_error "Error fetching git repository"; - system('git', 'fetch', @fetch_opts, 'origin', - '+refs/tags/*:refs/tags/*') == 0 - || exit_error "Error fetching git repository"; + for my $fetch_ref (@fetch_refs) { + system('git', 'fetch', @fetch_opts, 'origin', $fetch_ref) == 0 + || exit_error "Error fetching $fetch_ref from git repository $git_url"; + } $config->{_rbm}{fetched_projects}{$project} = 1; } }
tor-commits@lists.torproject.org