From c6363b791efb3b907db756cac891e1d21afb9978 Mon Sep 17 00:00:00 2001 From: Ferenc Erki Date: Fri, 2 Dec 2022 23:47:43 +0100 Subject: [PATCH 1/4] Fix critic about BuiltinFunctions::ProhibitVoidMap --- lib/Rex/Pkg/Base.pm | 4 +++- lib/Rex/Pkg/Debian.pm | 4 +++- t/package.t | 5 ++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/Rex/Pkg/Base.pm b/lib/Rex/Pkg/Base.pm index 0d3d655a0..ddb85a874 100644 --- a/lib/Rex/Pkg/Base.pm +++ b/lib/Rex/Pkg/Base.pm @@ -273,7 +273,9 @@ OLD_PKG: push @modifications, map { $_->{action} = 'installed'; $_ } grep { !exists $_->{found} } @new_installed; - map { delete $_->{found} } @modifications; + for (@modifications) { + delete $_->{found}; + } return @modifications; } diff --git a/lib/Rex/Pkg/Debian.pm b/lib/Rex/Pkg/Debian.pm index a5a8c188d..7764524fe 100644 --- a/lib/Rex/Pkg/Debian.pm +++ b/lib/Rex/Pkg/Debian.pm @@ -118,7 +118,9 @@ OLD_PKG: push @modifications, map { $_->{action} = 'installed'; $_ } grep { !exists $_->{found} } @new_installed; - map { delete $_->{found} } @modifications; + for (@modifications) { + delete $_->{found}; + } return @modifications; } diff --git a/t/package.t b/t/package.t index 12be73a55..fd43b0440 100644 --- a/t/package.t +++ b/t/package.t @@ -1,7 +1,7 @@ use strict; use warnings; -use Test::More tests => 4; +use Test::More tests => 5; use Rex::Pkg::Base; @@ -33,4 +33,7 @@ is( $found_libssh2->{action}, "installed", "libssh2-1 was installed" ); my ($found_mc) = grep { $_->{name} eq "mc" } @mods; is( $found_mc->{action}, "removed", "mc was removed" ); +my $leftover_found = scalar grep { defined $_->{found} } @mods; +is( $leftover_found, 0, 'no internal found marker left' ); + 1; From c115585266f02944d71a1980ea2f47d1edcceaaf Mon Sep 17 00:00:00 2001 From: Elvin Aslanov Date: Mon, 10 Oct 2022 12:35:38 +0400 Subject: [PATCH 2/4] Clarify pkg command syntax Mark the `%options` hash as optional. Update changelog. --- ChangeLog | 1 + lib/Rex/Commands/Pkg.pm | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 2b0b89cfb..030d14110 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,7 @@ Revision history for Rex [DOCUMENTATION] - Clarify optional arguments of file commands + - Clarify optional arguments of the pkg command [ENHANCEMENTS] diff --git a/lib/Rex/Commands/Pkg.pm b/lib/Rex/Commands/Pkg.pm index 0e95a5540..9dac8b79a 100644 --- a/lib/Rex/Commands/Pkg.pm +++ b/lib/Rex/Commands/Pkg.pm @@ -60,7 +60,7 @@ use vars qw(@EXPORT); @EXPORT = qw(install update remove update_system installed_packages is_installed update_package_db repository package_provider_for pkg); -=head2 pkg($package, %options) +=head2 pkg($package [, %options]) Since: 0.45 From 888abfbb8f9d9dd72db379340cedeb00623afeee Mon Sep 17 00:00:00 2001 From: Elvin Aslanov Date: Thu, 13 Oct 2022 22:14:45 +0400 Subject: [PATCH 3/4] Correct example for file_read command --- ChangeLog | 1 + lib/Rex/Commands/File.pm | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 030d14110..4b909f161 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,7 @@ Revision history for Rex [DOCUMENTATION] - Clarify optional arguments of file commands - Clarify optional arguments of the pkg command + - Correct the code sample for file_read command [ENHANCEMENTS] diff --git a/lib/Rex/Commands/File.pm b/lib/Rex/Commands/File.pm index 1430f3338..f578b52d2 100644 --- a/lib/Rex/Commands/File.pm +++ b/lib/Rex/Commands/File.pm @@ -840,7 +840,7 @@ On failure it will die. my $fh; eval { - $fh = read("/etc/groups"); + $fh = file_read("/etc/groups"); }; # catch an error From ffd452edf2f34bc2bc778bf192499602ea8d531f Mon Sep 17 00:00:00 2001 From: Ferenc Erki Date: Tue, 6 Dec 2022 20:42:50 +0100 Subject: [PATCH 4/4] Reword changelog entry --- ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 4b909f161..9ed9ed699 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,7 +9,7 @@ Revision history for Rex [DOCUMENTATION] - Clarify optional arguments of file commands - Clarify optional arguments of the pkg command - - Correct the code sample for file_read command + - Correct example for file_read command [ENHANCEMENTS]