Ticket #3751: extfs: rpm: introduce the $RPM_QUERY_FMT variable.

This minor refactoring will enable us to make this helper testable.

Instead of doing:

    $RPM -qp --qf a b c

we are now doing:

    $RPM_QUERY_FMT a b c

In a future patch we'll then be able to point $RPM_QUERY_FMT to some mock
program.

Signed-off-by: Mooffie <mooffie@gmail.com>
This commit is contained in:
Mooffie 2017-01-01 17:52:12 +02:00
parent 3078e74afe
commit 65ebc83f88

View File

@ -64,6 +64,7 @@ if rpm --nosignature --version >/dev/null 2>&1; then
else else
RPM="rpm" RPM="rpm"
fi fi
RPM_QUERY_FMT="$RPM -qp --qf"
RPM2CPIO="rpm2cpio" RPM2CPIO="rpm2cpio"
SED="sed" SED="sed"
@ -92,7 +93,7 @@ mcrpmfs_getAllNeededTags()
tag_CONFLICTS="" tag_CONFLICTS=""
fi fi
$RPM -qp --qf \ $RPM_QUERY_FMT \
"|NAME=%{NAME}"\ "|NAME=%{NAME}"\
"|VERSION=%{VERSION}"\ "|VERSION=%{VERSION}"\
"|RELEASE=%{RELEASE}"\ "|RELEASE=%{RELEASE}"\
@ -113,7 +114,7 @@ ${tag_CONFLICTS}\
mcrpmfs_getRawOneTag() mcrpmfs_getRawOneTag()
{ {
$RPM -qp --qf "$1" "${rpm_filename}" $RPM_QUERY_FMT "$1" "${rpm_filename}"
} }
mcrpmfs_getOneTag() mcrpmfs_getOneTag()