Commit 004b9745 authored by Vitaly Lipatov's avatar Vitaly Lipatov Committed by Vitaly Lipatov

add get_tarballname and use it

parent 4dcfa654
...@@ -84,6 +84,12 @@ get_version() ...@@ -84,6 +84,12 @@ get_version()
eval_spec $1 | get_var "Version" eval_spec $1 | get_var "Version"
} }
get_tarballname()
{
local SOURCE=$(eval_spec $1 | get_var "Source$2")
basename $SOURCE | sed -e "s|-$(get_version $1).*||g"
}
# Set version for spec (args: spec version), f.i. test.spec 1.2.3) # Set version for spec (args: spec version), f.i. test.spec 1.2.3)
# Supports %major and %ver_major macros in spec # Supports %major and %ver_major macros in spec
......
#!/bin/sh
. `dirname $0`/../share/eterbuild/functions/common
load_mod spec
SPEC=get_ver.spec
check_get_version()
{
RES=$1
cat <<EOF >$SPEC
Name: get_version_test
Release: alt1
Version: $TESTVER
Source: %name-%version.tar.bz2
Summary: Test
Group: Other
License: Public License
%define major 1.0
%define ver 10
%define maj 1.0
%description
Get version test
EOF
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'"
}
TESTVER=1.0.10
check_get_version get_version_test
rm -f $SPEC
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