Commit 7e1f5073 authored by Vitaly Lipatov's avatar Vitaly Lipatov

epm-print: add arch depend constructname support

parent 200df9d1
......@@ -124,6 +124,21 @@ compare_version()
rpmevrcmp "$@"
}
# construct package file name.
# name version [arch] [pkgtype]
construct_name()
{
local name="$1"
local version="$2"
local arch="$3"
local pkgtype="$4"
[ -n "$arch" ] || arch="$(distro_info --distro-arch)"
[ -n "$pkgtype" ] || pkgtype="$(distro_info -p)"
local ds=$(get_pkg_name_delimiter $pkgtype)
echo "${name}$ds${version}${ds/-/.}$arch.$pkgtype"
}
epm_print()
{
local WHAT="$1"
......@@ -161,6 +176,7 @@ cat <<EOF
epm print specname from filename NN print spec filename for the source package file
epm print binpkgfilelist in DIR for NN list binary package(s) filename(s) from DIR for the source package file
epm print compare [package] version N1 N2 compare (package) versions and print -1, 0, 1
epm print constructname <name> <version> [arch] [ pkgtype] print distro dependend package filename from args name version arch pkgtype
EOF
;;
"name")
......@@ -250,6 +266,9 @@ EOF
compare_version "$1" "$2"
#fi
;;
"constructname")
construct_name "$@"
;;
*)
fatal "Unknown command $ epm print $WHAT. Use epm print help for get help."
;;
......
......@@ -616,3 +616,13 @@ assure_distr()
[ -n "$2" ] && TEXT="$2"
[ "$DISTRNAME" = "$1" ] || fatal "$TEXT supported only for $1 distro"
}
# return delimiter sign in depend of package type
get_pkg_name_delimiter()
{
local pkgtype="$1"
[ -n "$pkgtype" ] || pkgtype="$($DISTRVENDOR -p)"
[ "$pkgtype" = "deb" ] && echo "_" && return
echo "-"
}
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