Test: simplify SRC_DIR extraction in run-unit-tests.sh

Use `spectool`, instead of `rpmdev-spectool`, because it is available
only on c9s and el9 and the intention was to keep tests implementation
the same across all distributions and their versions. This makes the
test case identical to c8s / el8.

In addition, the output from the tool differs on c8s and c9s, therefore
simplify the extraction of the SRC_DIR using only one sed command, which
produces the desired output on c8s and c9s.

Related: rhbz#2174847

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
This commit is contained in:
Tomáš Hozza 2023-04-17 14:23:09 +02:00
parent 4d13e6b27c
commit eac3dd265a
No known key found for this signature in database
GPG Key ID: C5887AD51D9F3C2D
1 changed files with 1 additions and 2 deletions

View File

@ -71,8 +71,7 @@ fi
${PKG_MAINT_TOOL} ${PKG_MAINT_TOOL_EXTRA_ARGS} prep
# Extract the Source0 basename without extension
SRC_DIR=$(rpmdev-spectool --source 0 osbuild.spec | awk '{print $2}' | sed 's/.tar.gz//')
SRC_DIR="${SRC_DIR##*/}"
SRC_DIR=$(spectool --source 0 osbuild.spec | sed 's/.\+\(osbuild-[0-9]\+\)\.tar\.gz/\1/')
cd "${SRC_DIR}"