From 15d3a8656a3a30a148001f2adf337f558949c738 Mon Sep 17 00:00:00 2001 From: Wang Yong Date: Wed, 9 Jun 2021 17:49:05 +0800 Subject: [PATCH] tests/install-rpm: catch full rpm name [before] start remove test: python2-gitdb ...... Removed: python2-gitdb-0.6.4-2.oe1.aarch64 ...... remove test finished: python2-gitdb [after] start remove test: python2-gitdb-0.6.4-2.oe1.aarch64 ...... Removed: python2-gitdb-0.6.4-2.oe1.aarch64 ...... remove test finished: python2-gitdb-0.6.4-2.oe1.aarch64 print rpm name accurately Signed-off-by: Wang Yong --- tests/install-rpm | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/tests/install-rpm b/tests/install-rpm index 046bd92a8..4133f619f 100755 --- a/tests/install-rpm +++ b/tests/install-rpm @@ -47,13 +47,24 @@ ldd_test() done } +handle_rpm_name() +{ + name=$(yum info $@ | awk -F ': ' '{if($1 ~ /Name/) print $2}') + version=$(yum info $@ | awk -F ': ' '{if($1 ~ /Version/) print $2}') + release=$(yum info $@ | awk -F ': ' '{if($1 ~ /Release/) print $2}') + architecture=$(yum info $@ | awk -F ': ' '{if($1 ~ /Architecture/) print $2}') + + rpm_full_name="${name}-${version}-${release}.${architecture}" +} + remove_rpm() { for i in ${rpm_name[@]} do - echo "start remove test: $i" + handle_rpm_name $i + echo "start remove test: ${rpm_full_name}" yum remove -y "$i" 2>&1 - echo "remove test finished: $i" + echo "remove test finished: ${rpm_full_name}" done }