From a8d80ad82033fd955ccd8a4ffb2463a641a8cb6e Mon Sep 17 00:00:00 2001 From: Daniel Hilst Selli <392820+dhilst@users.noreply.github.com> Date: Mon, 26 Jan 2026 11:30:44 -0300 Subject: [PATCH] debug: Echo build-ubunturepo output during the build Signed-off-by: Daniel Hilst Selli <392820+dhilst@users.noreply.github.com> --- github_action_xcat_test.pl | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/github_action_xcat_test.pl b/github_action_xcat_test.pl index e0b53e273..c2d56d737 100644 --- a/github_action_xcat_test.pl +++ b/github_action_xcat_test.pl @@ -53,6 +53,23 @@ sub runcmd } +#-------------------------------------------------------- +# Fuction name: echocmd +# Description: run a command after 'cmd' label in one case +# the output is echoed to the terminal +# Attributes: +# Return code: +# $::RUNCMD_RC : the return code of command +#-------------------------------------------------------- +sub echocmd +{ + my ($cmd) = @_; + $::RUNCMD_RC = 0; + system($cmd); + $::RUNCMD_RC = $? >> 8; + undef; +} + #-------------------------------------------------------- # Fuction name: get_files_recursive # Description: Search all file in one directory recursively @@ -279,11 +296,16 @@ sub send_back_comment{ sub build_xcat_core{ my @output; - my $cmd = "sudo ./build-ubunturepo -c UP=0 BUILDALL=1 GPGSIGN=0"; - @output = runcmd("$cmd"); + my $dest = $ENV{RUNNER_WORKSPACE}; + my $cmd = <<"EOF"; +find . -name changelog.dch -delete; + +set -x +sudo DEBEMAIL="\$DEBEMAIL" DEBFULLNAME="\$DEBFULLNAME" \\ + ./build-ubunturepo -c UP=0 BUILDALL=1 GPGSIGN=0 DEST="$dest" +EOF + echocmd("$cmd"); if($::RUNCMD_RC){ - my $lastline = $output[-1]; - $lastline =~ s/[\r\n\t\\"']*//g; print "[build_xcat_core] $cmd ....[Failed]\n"; $check_result_str .= "> **BUILD ERROR**, Please click ``Details`` label in ``Merge pull request`` box for detailed information"; print $check_result_str; @@ -311,11 +333,12 @@ sub install_xcat{ "sudo echo \"deb [arch=ppc64el allow-insecure=yes] http://xcat.org/files/xcat/repos/apt/devel/xcat-dep bionic main\" >> /etc/apt/sources.list", "sudo wget -q -O - \"http://xcat.org/files/xcat/repos/apt/apt.key\" | sudo apt-key add -", "sudo apt-get -qq --allow-insecure-repositories update"); - chdir $ENV{RUNNER_WORKSPACE};; + chdir "$ENV{RUNNER_WORKSPACE}/debsfeat/prepare-merge-upstream/xcat-core"; + my $cwd = Cwd::cwd(); my @output; foreach my $cmd (@cmds){ - print "[install_xcat] running $cmd\n"; + print "[install_xcat] running $cmd at $cwd\n"; @output = runcmd("$cmd"); if($::RUNCMD_RC){ print RED "[install_xcat] $cmd. ...[Failed]\n";