extfs: rpm: make it testable.

The way we make this helper testable is a bit different than with other
helpers:

While in other helpers we make it possible to override just one or two
variables, here we make it possible to inject a code snippet into it. This is a
more powerful approach which lets us override even functions, as will be shown
in a following patch.

(As for relocating the "AllTAGS=..." line: all non-declarative code needs to be
moved past our new injection point, or else this code won't be affected by the
injection. BTW, the "$1" on that line isn't used; a vestige from old days.)

Signed-off-by: Mooffie <mooffie@gmail.com>
This commit is contained in:
Mooffie 2017-01-01 18:19:48 +02:00
parent 65ebc83f88
commit 97bc2af3b2

View File

@ -122,8 +122,6 @@ mcrpmfs_getOneTag()
echo $AllTAGS | $SED "s/.*|${1}=//" | cut -d '|' -f 1
}
AllTAGS=`mcrpmfs_getAllNeededTags "$1"`
mcrpmfs_printOneMetaInfo()
{
if test "$3" = "raw"; then
@ -330,6 +328,11 @@ mcrpmfs_run ()
esac
}
# Let the test framework override functions and variables.
[ -n "$MC_TEST_RPM_REWRITE" ] && . "$MC_TEST_RPM_REWRITE"
AllTAGS=`mcrpmfs_getAllNeededTags "$1"`
umask 077
case "${param}" in
list) mcrpmfs_list; exit 0;;