diff --git a/README b/README index 5fa8c0b402a408758e199e498a87a83d8566d87a..1f93a93361a8c7ac42c5551b09acf09812251d53 100644 --- a/README +++ b/README @@ -21,7 +21,7 @@ You also need a few perl modules installed: - Getopt::Long - Template - IO::Handle -- IO::CaptureOutput +- Capture::Tiny - JSON - File::Temp - Path::Tiny @@ -41,7 +41,7 @@ If you are running Debian or Ubuntu, you can install them with: # apt-get install libdata-dump-perl libdata-uuid-perl libdatetime-perl \ libdigest-sha-perl libfile-copy-recursive-perl \ - libfile-slurp-perl libio-all-perl libio-captureoutput-perl \ + libfile-slurp-perl libio-all-perl libcapture-tiny-perl \ libio-handle-util-perl libjson-perl \ libparallel-forkmanager-perl libpath-tiny-perl \ libsort-versions-perl libstring-shellquote-perl \ @@ -51,7 +51,7 @@ If you are running Debian or Ubuntu, you can install them with: If you are running Fedora, CentOS or RHEL, you can install them with: # dnf install "perl(YAML::XS)" "perl(File::Basename)" "perl(Getopt::Long)" \ - "perl(Template)" "perl(IO::Handle)" "perl(IO::CaptureOutput)" \ + "perl(Template)" "perl(IO::Handle)" "perl(Capture::Tiny)" \ "perl(JSON)" "perl(File::Temp)" "perl(Path::Tiny)" \ "perl(File::Path)" "perl(File::Slurp)" \ "perl(File::Copy::Recursive)" "perl(String::ShellQuote)" @@ -62,7 +62,7 @@ If you are running Fedora, CentOS or RHEL, you can install them with: If you are running an Arch based system, you should be able to install them with: # pacman -S perl-datetime perl-path-tiny perl-yaml perl-yaml-libyaml \ - perl-yaml-tiny perl-template-toolkit perl-io-captureoutput \ + perl-yaml-tiny perl-template-toolkit perl-capture-tiny \ perl-file-copy-recursive perl-string-shellquote \ perl-sort-versions perl-data-uuid perl-data-dump perl-json \ perl-digest-sha1 perl-io-all perl-file-slurp perl-sys-syscall \ diff --git a/rbm.conf b/rbm.conf index 718f508b2f58843ae227e3d42132b48f6365ab43..3702c16c67c925382a01922b5f2aba23ca22173d 100644 --- a/rbm.conf +++ b/rbm.conf @@ -704,7 +704,6 @@ gpg_allow_expired_keys: 1 --- | # This part of the file contains options written in perl - use IO::CaptureOutput qw(capture_exec); ( var_p => { nightly_torbrowser_version => sub { diff --git a/tools/clean-old b/tools/clean-old index c7d9e0c0bc5ff474d25f8936e296d19a1604b496..c9c19922b65227daa0501a0700d356549023c6a3 100755 --- a/tools/clean-old +++ b/tools/clean-old @@ -1,6 +1,5 @@ #!/usr/bin/perl -w use strict; -use IO::CaptureOutput qw(capture_exec); use FindBin; use lib "$FindBin::Bin/../rbm/lib"; use RBM; diff --git a/tools/dmg2mar b/tools/dmg2mar index 49e8f5d10be3e2525c8b37cf5763dd39d7b35b69..28b70db69b0eb4f08cc291d7842b0e0060324b9f 100755 --- a/tools/dmg2mar +++ b/tools/dmg2mar @@ -29,7 +29,7 @@ # $ export "PATH=$p7zipdir/bin:$PATH" use strict; -use IO::CaptureOutput qw(capture_exec); +use Capture::Tiny qw(capture); use File::Slurp; use File::Find; use Parallel::ForkManager; @@ -48,6 +48,15 @@ sub exit_error { exit (exists $_[1] ? $_[1] : 1); } +sub capture_exec { + my @cmd = @_; + my ($stdout, $stderr, $exit) = capture { + system(@cmd); + }; + return ($stdout, $stderr, $exit == 0, $exit) if wantarray(); + return $stdout; +} + sub osname { my ($osname) = capture_exec('uname', '-s'); my ($arch) = capture_exec('uname', '-m'); diff --git a/tools/download-torbrowser b/tools/download-torbrowser index 25a7be0d839d5d5fd7271fbdf67ba09980e7ed94..4e115514a3dce2ba6e0b59f225315910928386b3 100755 --- a/tools/download-torbrowser +++ b/tools/download-torbrowser @@ -6,7 +6,6 @@ use strict; use English; use LWP::Simple; -use IO::CaptureOutput qw(capture_exec); use File::Temp; use File::Basename qw(fileparse); use FindBin; diff --git a/tools/signing/machines-setup/setup-signing-machine b/tools/signing/machines-setup/setup-signing-machine index 5769e070fd20b190faa3a1d60efcc88c40fa76dc..514ffb51c0ffa2d9068c36cd5d68c2208d3d1329 100755 --- a/tools/signing/machines-setup/setup-signing-machine +++ b/tools/signing/machines-setup/setup-signing-machine @@ -100,7 +100,7 @@ authorized_keys richard richard.pub # Install rbm deps install_packages libyaml-libyaml-perl libtemplate-perl libdatetime-perl \ libio-handle-util-perl libio-all-perl \ - libio-captureoutput-perl libjson-perl libpath-tiny-perl \ + libcapture-tiny-perl libjson-perl libpath-tiny-perl \ libstring-shellquote-perl libsort-versions-perl \ libdigest-sha-perl libdata-uuid-perl libdata-dump-perl \ libfile-copy-recursive-perl libfile-slurp-perl diff --git a/tools/update-responses/README.md b/tools/update-responses/README.md index 605047ac94497b2c5fe8ccb0d633e29ea81a32bb..bd25c062f5f7958b4824725ef691eb0a4e9ce543 100644 --- a/tools/update-responses/README.md +++ b/tools/update-responses/README.md @@ -13,14 +13,14 @@ Dependencies The following perl modules need to be installed to run the script: FindBin YAML::XS File::Slurp Digest::SHA XML::Writer File::Temp - IO::CaptureOutput Parallel::ForkManager XML::LibXML LWP JSON + Capture::Tiny Parallel::ForkManager XML::LibXML LWP JSON On Debian / Ubuntu you can install them with: ``` # apt-get install libfindbin-libs-perl libyaml-libyaml-perl \ libfile-slurp-perl libdigest-sha-perl libxml-writer-perl \ - libio-captureoutput-perl libparallel-forkmanager-perl \ + libcapture-tiny-perl libparallel-forkmanager-perl \ libxml-libxml-perl libwww-perl libjson-perl ``` @@ -28,7 +28,7 @@ On Red Hat / Fedora you can install them with: ``` # for module in FindBin YAML::XS File::Slurp Digest::SHA XML::Writer \ - File::Temp IO::CaptureOutput Parallel::ForkManager \ + File::Temp Capture::Tiny Parallel::ForkManager \ XML::LibXML LWP JSON do yum install "perl($module)"; done ``` diff --git a/tools/update-responses/update_responses b/tools/update-responses/update_responses index 1520bad027d5c26a0309ad6d4dfeab62f542f17f..471ccb9ee087c5b15aad53bc59a81127306f9f1e 100755 --- a/tools/update-responses/update_responses +++ b/tools/update-responses/update_responses @@ -14,7 +14,7 @@ use File::Copy; use File::Temp; use File::Find; use POSIX qw(setlocale LC_ALL); -use IO::CaptureOutput qw(capture_exec); +use Capture::Tiny qw(capture); use Parallel::ForkManager; use File::Basename; use XML::LibXML '1.70'; @@ -265,9 +265,11 @@ sub create_incremental_mar { local $ENV{MOZ_PRODUCT_VERSION} = $new_version; local $ENV{MAR_CHANNEL_ID} = get_config($config, $new_version, $os, 'mar_channel_id'); local $ENV{TMPDIR} = $tmpdir; - my ($out, $err, $success) = capture_exec('make_incremental_update.sh', - $mar_file_path, "$tmpdir/A", "$tmpdir/B"); - if (!$success) { + my ($out, $err, $exit) = capture { + system('make_incremental_update.sh', + $mar_file_path, "$tmpdir/A", "$tmpdir/B"); + }; + if ($exit) { unlink $mar_file_path if -f $mar_file_path; exit_error "making incremental mar:\n" . $err; } @@ -490,9 +492,11 @@ sub extract_martools { $martools_tmpdir = get_tmpdir($config); my $old_cwd = getcwd; chdir $martools_tmpdir; - my (undef, undef, $success) = capture_exec('unzip', $marzip); + my (undef, undef, $exit) = capture { + system('unzip', $marzip); + }; chdir $old_cwd; - exit_error "Error extracting $marzip" unless $success; + exit_error "Error extracting $marzip" if $exit; $ENV{PATH} = "$martools_tmpdir/mar-tools:$initPATH"; if ($initLD_LIBRARY_PATH) { $ENV{LD_LIBRARY_PATH} = "$initLD_LIBRARY_PATH:$martools_tmpdir/mar-tools";