Skip to content

Commit

Permalink
Draft code to generate the list of packages being installed during th…
Browse files Browse the repository at this point in the history
…e test job

(Incomplete and untested)
  • Loading branch information
Avinesh committed Jun 10, 2022
1 parent 9a73df2 commit df67214
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/opensusebasetest.pm
Expand Up @@ -62,6 +62,7 @@ this method, must call this baseclass method from the overwriting method.
sub pre_run_hook {
my ($self) = @_;
clear_started_systemd_services();
clear_installed_packages();
}

=head2 post_run_hook
Expand Down
22 changes: 22 additions & 0 deletions lib/utils.pm
Expand Up @@ -94,6 +94,8 @@ our @EXPORT = qw(
permit_root_ssh_in_sol
cleanup_disk_space
package_upgrade_check
get_installed_packages
clear_installed_packages
);

=head1 SYNOPSIS
Expand Down Expand Up @@ -508,6 +510,10 @@ sub get_netboot_mirror {
return get_var('MIRROR_' . uc($m_protocol));
}


my @installed_packages;


=head2 zypper_call
zypper_call($command [, exitcode => $exitcode] [, timeout => $timeout] [, log => $log] [, dumb_term => $dumb_term]);
Expand Down Expand Up @@ -572,6 +578,14 @@ sub zypper_call {
}
upload_logs("/tmp/$log") if $log;

my @cmd_as_array = split (/ /, $command);
my $zypper_op = shift @cmd_as_array;
if ($zypper_op eq 'in' or $zypper_op eq 'install') {
foreach (@array) {
push(@installed_packages, "$_");
}
}

unless (grep { $_ == $ret } @$allow_exit_codes) {
upload_logs('/var/log/zypper.log');
my $msg = "'zypper -n $command' failed with code $ret";
Expand All @@ -596,6 +610,14 @@ sub zypper_call {
return $ret;
}

sub get_installed_packages {
return @installed_packages;
}

sub clear_installed_packages {
@installed_packages = ();
}


=head2 zypper_enable_install_dvd
Expand Down

0 comments on commit df67214

Please sign in to comment.