[tbb-commits] [builders/rbm] branch master updated: Bug 40038: Fix archiving of nested git submodules

gitolite role git at cupani.torproject.org
Fri Apr 29 11:08:50 UTC 2022


This is an automated email from the git hooks/post-receive script.

gk pushed a commit to branch master
in repository builders/rbm.

The following commit(s) were added to refs/heads/master by this push:
     new 86f77f6  Bug 40038: Fix archiving of nested git submodules
86f77f6 is described below

commit 86f77f63259a030315e0c20e80fa02ed3ab2688c
Author: Nicolas Vigier <boklm at torproject.org>
AuthorDate: Mon Apr 25 12:30:25 2022 +0200

    Bug 40038: Fix archiving of nested git submodules
---
 lib/RBM.pm | 34 ++++++++++++++++++----------------
 1 file changed, 18 insertions(+), 16 deletions(-)

diff --git a/lib/RBM.pm b/lib/RBM.pm
index 8387fa3..24c6d44 100644
--- a/lib/RBM.pm
+++ b/lib/RBM.pm
@@ -478,6 +478,19 @@ sub run_script {
     return @res == 1 ? $res[0] : @res;
 }
 
+sub git_submodule_init_sync_update {
+    foreach my $action (
+        ['init'],
+        ['sync', '--recursive'],
+        ['update', '--recursive']
+    ) {
+        my ($stdout, $stderr, $success, $exit_code) =
+                                capture_exec('git', 'submodule', @$action);
+        exit_error "Error running git submodule " . join(' ', @$action) . "\n$stderr"
+                    unless $success;
+    }
+}
+
 sub execute {
     my ($project, $cmd, $options) = @_;
     CORE::state %cache;
@@ -492,14 +505,8 @@ sub execute {
         my ($stdout, $stderr, $success, $exit_code)
                 = capture_exec('git', 'checkout', $git_hash);
         exit_error "Cannot checkout $git_hash:\n$stderr" unless $success;
-        if (project_config($project, 'git_submodule', $options)) {
-            foreach my $action (qw(init sync update)) {
-                ($stdout, $stderr, $success, $exit_code)
-                    = capture_exec('git', 'submodule', $action);
-                exit_error "Error running git submodule $action\n$stderr"
-                    unless $success;
-            }
-        }
+        git_submodule_init_sync_update()
+                if project_config($project, 'git_submodule', $options);
     } elsif (project_config($project, 'hg_url', $options)) {
         my $hg_hash = project_config($project, 'hg_hash', $options)
                 || exit_error "No hg_hash specified for project $project";
@@ -574,15 +581,10 @@ sub maketar {
             my ($stdout, $stderr, $success, $exit_code)
                 = capture_exec('git', 'checkout', $commit_hash);
             exit_error "Cannot checkout $commit_hash: $stderr" unless $success;
-            foreach my $action (qw(init sync update)) {
-                ($stdout, $stderr, $success, $exit_code)
-                    = capture_exec('git', 'submodule', $action);
-                exit_error "Error running git submodule $action\n$stderr"
-                    unless $success;
-            }
+            git_submodule_init_sync_update();
             ($stdout, $stderr, $success, $exit_code)
-                = capture_exec('git', 'submodule', 'foreach',
-                    "git archive --prefix=$project-$version/\$path/"
+                = capture_exec('git', 'submodule', 'foreach', '--recursive',
+                    "git archive --prefix=$project-$version/\$displaypath/"
                     . " --output=$tmpdir/submodule.tar \$sha1;"
                     . "tar -Af \"$dest_dir/$tar_file\" $tmpdir/submodule.tar");
             exit_error 'Error running git archive on submodules.' unless $success;

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the tbb-commits mailing list