Commits:
-
74602df1
by Nicolas Vigier at 2024-01-31T08:51:48+00:00
Bug 41067: Use Capture::Tiny instead of IO::CaptureOutput
The IO::CaptureOutput perl module is deprecated, so we switch to
Capture::Tiny. We also remove some uses of IO::CaptureOutput where it
was not needed.
8 changed files:
Changes:
README
... |
... |
@@ -21,7 +21,7 @@ You also need a few perl modules installed: |
21
|
21
|
- Getopt::Long
|
22
|
22
|
- Template
|
23
|
23
|
- IO::Handle
|
24
|
|
-- IO::CaptureOutput
|
|
24
|
+- Capture::Tiny
|
25
|
25
|
- JSON
|
26
|
26
|
- File::Temp
|
27
|
27
|
- Path::Tiny
|
... |
... |
@@ -41,7 +41,7 @@ If you are running Debian or Ubuntu, you can install them with: |
41
|
41
|
|
42
|
42
|
# apt-get install libdata-dump-perl libdata-uuid-perl libdatetime-perl \
|
43
|
43
|
libdigest-sha-perl libfile-copy-recursive-perl \
|
44
|
|
- libfile-slurp-perl libio-all-perl libio-captureoutput-perl \
|
|
44
|
+ libfile-slurp-perl libio-all-perl libcapture-tiny-perl \
|
45
|
45
|
libio-handle-util-perl libjson-perl \
|
46
|
46
|
libparallel-forkmanager-perl libpath-tiny-perl \
|
47
|
47
|
libsort-versions-perl libstring-shellquote-perl \
|
... |
... |
@@ -51,7 +51,7 @@ If you are running Debian or Ubuntu, you can install them with: |
51
|
51
|
If you are running an Arch based system, you should be able to install them with:
|
52
|
52
|
|
53
|
53
|
# pacman -S perl-datetime perl-path-tiny perl-yaml perl-yaml-libyaml \
|
54
|
|
- perl-yaml-tiny perl-template-toolkit perl-io-captureoutput \
|
|
54
|
+ perl-yaml-tiny perl-template-toolkit perl-capture-tiny \
|
55
|
55
|
perl-file-copy-recursive perl-string-shellquote \
|
56
|
56
|
perl-sort-versions perl-data-uuid perl-data-dump perl-json \
|
57
|
57
|
perl-digest-sha1 perl-io-all perl-file-slurp perl-sys-syscall \
|
rbm.conf
... |
... |
@@ -705,7 +705,6 @@ gpg_allow_expired_keys: 1 |
705
|
705
|
|
706
|
706
|
--- |
|
707
|
707
|
# This part of the file contains options written in perl
|
708
|
|
- use IO::CaptureOutput qw(capture_exec);
|
709
|
708
|
(
|
710
|
709
|
var_p => {
|
711
|
710
|
nightly_torbrowser_version => sub {
|
tools/clean-old
1
|
1
|
#!/usr/bin/perl -w
|
2
|
2
|
use strict;
|
3
|
|
-use IO::CaptureOutput qw(capture_exec);
|
4
|
3
|
use FindBin;
|
5
|
4
|
use lib "$FindBin::Bin/../rbm/lib";
|
6
|
5
|
use RBM;
|
tools/dmg2mar
... |
... |
@@ -29,7 +29,7 @@ |
29
|
29
|
# $ export "PATH=$p7zipdir/bin:$PATH"
|
30
|
30
|
|
31
|
31
|
use strict;
|
32
|
|
-use IO::CaptureOutput qw(capture_exec);
|
|
32
|
+use Capture::Tiny qw(capture);
|
33
|
33
|
use File::Slurp;
|
34
|
34
|
use File::Find;
|
35
|
35
|
use Parallel::ForkManager;
|
... |
... |
@@ -48,6 +48,15 @@ sub exit_error { |
48
|
48
|
exit (exists $_[1] ? $_[1] : 1);
|
49
|
49
|
}
|
50
|
50
|
|
|
51
|
+sub capture_exec {
|
|
52
|
+ my @cmd = @_;
|
|
53
|
+ my ($stdout, $stderr, $exit) = capture {
|
|
54
|
+ system(@cmd);
|
|
55
|
+ };
|
|
56
|
+ return ($stdout, $stderr, $exit == 0, $exit) if wantarray();
|
|
57
|
+ return $stdout;
|
|
58
|
+}
|
|
59
|
+
|
51
|
60
|
sub osname {
|
52
|
61
|
my ($osname) = capture_exec('uname', '-s');
|
53
|
62
|
my ($arch) = capture_exec('uname', '-m');
|
tools/download-torbrowser
... |
... |
@@ -6,7 +6,6 @@ |
6
|
6
|
use strict;
|
7
|
7
|
use English;
|
8
|
8
|
use LWP::Simple;
|
9
|
|
-use IO::CaptureOutput qw(capture_exec);
|
10
|
9
|
use File::Temp;
|
11
|
10
|
use File::Basename qw(fileparse);
|
12
|
11
|
use FindBin;
|
tools/signing/machines-setup/setup-signing-machine
... |
... |
@@ -100,7 +100,7 @@ authorized_keys richard richard.pub |
100
|
100
|
# Install rbm deps
|
101
|
101
|
install_packages libyaml-libyaml-perl libtemplate-perl libdatetime-perl \
|
102
|
102
|
libio-handle-util-perl libio-all-perl \
|
103
|
|
- libio-captureoutput-perl libjson-perl libpath-tiny-perl \
|
|
103
|
+ libcapture-tiny-perl libjson-perl libpath-tiny-perl \
|
104
|
104
|
libstring-shellquote-perl libsort-versions-perl \
|
105
|
105
|
libdigest-sha-perl libdata-uuid-perl libdata-dump-perl \
|
106
|
106
|
libfile-copy-recursive-perl libfile-slurp-perl
|
tools/update-responses/README.md
... |
... |
@@ -13,14 +13,14 @@ Dependencies |
13
|
13
|
|
14
|
14
|
The following perl modules need to be installed to run the script:
|
15
|
15
|
FindBin YAML::XS File::Slurp Digest::SHA XML::Writer File::Temp
|
16
|
|
- IO::CaptureOutput Parallel::ForkManager XML::LibXML LWP JSON
|
|
16
|
+ Capture::Tiny Parallel::ForkManager XML::LibXML LWP JSON
|
17
|
17
|
|
18
|
18
|
On Debian / Ubuntu you can install them with:
|
19
|
19
|
|
20
|
20
|
```
|
21
|
21
|
# apt-get install libfindbin-libs-perl libyaml-libyaml-perl \
|
22
|
22
|
libfile-slurp-perl libdigest-sha-perl libxml-writer-perl \
|
23
|
|
- libio-captureoutput-perl libparallel-forkmanager-perl \
|
|
23
|
+ libcapture-tiny-perl libparallel-forkmanager-perl \
|
24
|
24
|
libxml-libxml-perl libwww-perl libjson-perl
|
25
|
25
|
```
|
26
|
26
|
|
... |
... |
@@ -28,7 +28,7 @@ On Red Hat / Fedora you can install them with: |
28
|
28
|
|
29
|
29
|
```
|
30
|
30
|
# for module in FindBin YAML::XS File::Slurp Digest::SHA XML::Writer \
|
31
|
|
- File::Temp IO::CaptureOutput Parallel::ForkManager \
|
|
31
|
+ File::Temp Capture::Tiny Parallel::ForkManager \
|
32
|
32
|
XML::LibXML LWP JSON
|
33
|
33
|
do yum install "perl($module)"; done
|
34
|
34
|
```
|
tools/update-responses/update_responses
... |
... |
@@ -14,7 +14,7 @@ use File::Copy; |
14
|
14
|
use File::Temp;
|
15
|
15
|
use File::Find;
|
16
|
16
|
use POSIX qw(setlocale LC_ALL);
|
17
|
|
-use IO::CaptureOutput qw(capture_exec);
|
|
17
|
+use Capture::Tiny qw(capture);
|
18
|
18
|
use Parallel::ForkManager;
|
19
|
19
|
use File::Basename;
|
20
|
20
|
use XML::LibXML '1.70';
|
... |
... |
@@ -265,9 +265,11 @@ sub create_incremental_mar { |
265
|
265
|
local $ENV{MOZ_PRODUCT_VERSION} = $new_version;
|
266
|
266
|
local $ENV{MAR_CHANNEL_ID} = get_config($config, $new_version, $os, 'mar_channel_id');
|
267
|
267
|
local $ENV{TMPDIR} = $tmpdir;
|
268
|
|
- my ($out, $err, $success) = capture_exec('make_incremental_update.sh',
|
269
|
|
- $mar_file_path, "$tmpdir/A", "$tmpdir/B");
|
270
|
|
- if (!$success) {
|
|
268
|
+ my ($out, $err, $exit) = capture {
|
|
269
|
+ system('make_incremental_update.sh',
|
|
270
|
+ $mar_file_path, "$tmpdir/A", "$tmpdir/B");
|
|
271
|
+ };
|
|
272
|
+ if ($exit) {
|
271
|
273
|
unlink $mar_file_path if -f $mar_file_path;
|
272
|
274
|
exit_error "making incremental mar:\n" . $err;
|
273
|
275
|
}
|
... |
... |
@@ -490,9 +492,11 @@ sub extract_martools { |
490
|
492
|
$martools_tmpdir = get_tmpdir($config);
|
491
|
493
|
my $old_cwd = getcwd;
|
492
|
494
|
chdir $martools_tmpdir;
|
493
|
|
- my (undef, undef, $success) = capture_exec('unzip', $marzip);
|
|
495
|
+ my (undef, undef, $exit) = capture {
|
|
496
|
+ system('unzip', $marzip);
|
|
497
|
+ };
|
494
|
498
|
chdir $old_cwd;
|
495
|
|
- exit_error "Error extracting $marzip" unless $success;
|
|
499
|
+ exit_error "Error extracting $marzip" if $exit;
|
496
|
500
|
$ENV{PATH} = "$martools_tmpdir/mar-tools:$initPATH";
|
497
|
501
|
if ($initLD_LIBRARY_PATH) {
|
498
|
502
|
$ENV{LD_LIBRARY_PATH} = "$initLD_LIBRARY_PATH:$martools_tmpdir/mar-tools";
|
|