Commit 950f0efb authored by Vitaly Lipatov's avatar Vitaly Lipatov

improve test for get_tardir_from_rules and fix improve get_tardir_from_rules

parent e47e0cf1
...@@ -50,10 +50,12 @@ get_tardir_from_rules() ...@@ -50,10 +50,12 @@ get_tardir_from_rules()
local tar="$1" local tar="$1"
local packname="$(basename "$2" .$tar)" local packname="$(basename "$2" .$tar)"
local dir local dir
if print_gear_rules | grep "$tar *:" | grep -q -v "name=" ; then assert_var tar packname
dir=$(print_gear_rules | grep "$tar *:" | sed -e "s|$tar *: *||g" | sed -e "s| .*||g" | head -n1) # firstly try get dir by name=
else
dir=$(print_gear_rules | grep "$tar *:" | grep "name=$packname" | sed -e "s|$tar *: *||g" | sed -e "s| .*||g" | head -n1) dir=$(print_gear_rules | grep "$tar *:" | grep "name=$packname" | sed -e "s|$tar *: *||g" | sed -e "s| .*||g" | head -n1)
# if can't get by name, use first rule without name=
if [ -z "$dir" ] ; then
dir=$(print_gear_rules | grep "$tar *:" | grep -v "name=" | sed -e "s|$tar *: *||g" | sed -e "s| .*||g" | head -n1)
fi fi
if [ -z "$dir" ] ; then if [ -z "$dir" ] ; then
......
...@@ -23,10 +23,15 @@ Get version test ...@@ -23,10 +23,15 @@ Get version test
EOF EOF
} }
check()
{
[ "$2" != "$3" ] && echo "FATAL with '$1': result '$2' do not match with '$3'" || echo "OK for '$1' with '$2'"
}
check_get_version() check_get_version()
{ {
RES=$1 RES=$1
RESGET=`get_tarballname $SPEC` RESGET=`get_tarballname $SPEC`
[ "$RES" != "$RESGET" ] && echo "FATAL with 'get_tarballname': result '$RES' do not match with '$RESGET'" || echo "OK for 'get_tarballname' with '$RESGET'" [ "$RES" != "$RESGET" ] && echo "FATAL with 'get_tarballname': result '$RES' do not match with '$RESGET'" || echo "OK for 'get_tarballname' with '$RESGET'"
} }
...@@ -55,19 +60,36 @@ echo "Source path $SOURCEPATH: " ...@@ -55,19 +60,36 @@ echo "Source path $SOURCEPATH: "
gen_spec gen_spec
get_etersoft_srpm_path $SPEC get_etersoft_srpm_path $SPEC
echo "TODO"
subst "s|Source:.*|Source: http://fp.ru/python-larch_1.20131130.orig.tar.gz|g" $SPEC subst "s|Source:.*|Source: http://fp.ru/python-larch_1.20131130.orig.tar.gz|g" $SPEC
check_get_version python-larch check_get_version python-larch
subst "s|Source:.*|Source0: http://fp.ru/python-larch_1.20131130.orig.tar.gz|g" $SPEC
check_get_version python-larch
rm -f $SPEC [ -n "$1" ] && SPEC="$1"
[ -s $SPEC ] || SPEC="$1"
build_rpms_name $SPEC build_rpms_name $SPEC
echo "Tarball from rules" #echo "Tarball from rules"
#get_tardir_from_rules tar wine-staging-2.4.0.tar || echo "No tarball" #get_tardir_from_rules tar wine-staging-2.4.0.tar || echo "No tarball"
get_tardir_from_rules tar || echo "No tarball" #get_tardir_from_rules tar || echo "No tarball"
get_tardir_from_rules tar.gz || echo "No tarball" #get_tardir_from_rules tar.gz || echo "No tarball"
echo "Test ostree"
# TODO: fake .gear
cd /home/lav/Projects/git-alt/containers/ostree
SPEC=ostree.spec
build_rpms_name $SPEC
check_tarball()
{
local TARBALL="$1"
local TARDIR=$(get_tardir_from_rules "$(get_ext $TARBALL)" $(basename "$TARBALL"))
check "$1" "$(basename $TARDIR)" "$2"
}
check_tarball ostree-2017.8.tar ostree
check_tarball libglnx.tar libglnx
check_tarball bsdiff.tar bsdiff
# TODO: в rules может задаваться другой name архива
echo "DONE" echo "DONE"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment