[tbb-commits] [Git][tpo/applications/rbm][main] 2 commits: Bug 40062: Copy input_files directories recursively

boklm (@boklm) git at gitlab.torproject.org
Thu Oct 12 07:47:53 UTC 2023



boklm pushed to branch main at The Tor Project / Applications / RBM


Commits:
063c41f9 by Nicolas Vigier at 2023-10-11T14:22:35+02:00
Bug 40062: Copy input_files directories recursively

When an input_files is a directory, instead of passing each files
included in the directory individually to remote_put, we just pass the
directory and expect remote_put to copy it recursively.

Since in the case of container, each call to remote_put is a significant
overhead, this makes it much faster when including a directory
containing many files.

- - - - -
0a47c75f by Nicolas Vigier at 2023-10-11T14:32:44+02:00
Bug 40062: Avoid using run_chroot in copy_file_to

When copying files to a container directory, we were running `chown` on
the files using run_chroot, which in addition to using the chroot
command is doing other things like setting up mount points and other
things not needed for running `chown`. Simply using `chroot` should be
enough and faster.

- - - - -


2 changed files:

- container
- lib/RBM.pm


Changes:

=====================================
container
=====================================
@@ -110,7 +110,7 @@ sub copy_file_to {
     my $filename = fileparse($src);
     rcopy($src, "$rootfsdir/$dst/$filename")
         or exit_error "Failed to copy $src to $rootfsdir/$dst/$filename";
-    return run_chroot($rootfsdir, ['chown', '-R', $owner, $dst]);
+    return system('/usr/sbin/chroot', $rootfsdir, 'chown', '-R', $owner, $dst);
 }
 
 sub copy_file_from {


=====================================
lib/RBM.pm
=====================================
@@ -1091,7 +1091,8 @@ sub input_files {
         my $file_type = -d $fname ? 'directory' : 'file';
         print "Using $file_type $fname\n";
         mkdir dirname("$dest_dir/$name");
-        push @res_copy, recursive_copy($fname, $name, $dest_dir, $action);
+        recursive_copy($fname, $name, $dest_dir, $action);
+        push @res_copy, $name;
     }
     chdir $old_cwd;
     RETURN_RES:



View it on GitLab: https://gitlab.torproject.org/tpo/applications/rbm/-/compare/fb51b232ea9281032762df30211400139ff80275...0a47c75f7b9b3c6ccc4086b44336be0b85e5fbef

-- 
View it on GitLab: https://gitlab.torproject.org/tpo/applications/rbm/-/compare/fb51b232ea9281032762df30211400139ff80275...0a47c75f7b9b3c6ccc4086b44336be0b85e5fbef
You're receiving this email because of your account on gitlab.torproject.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.torproject.org/pipermail/tbb-commits/attachments/20231012/779448c0/attachment-0001.htm>


More information about the tbb-commits mailing list