Commit fe8e76c2 authored by Vitaly Lipatov's avatar Vitaly Lipatov

introduce querypackage and build_rpms_name_by_srpm

parent 07189ba6
...@@ -63,6 +63,37 @@ build_rpms_name() ...@@ -63,6 +63,37 @@ build_rpms_name()
build_buildroot build_buildroot
} }
querypackage()
{
rpmquery -p --queryformat "%{$2}" $1
}
build_rpms_name_by_srpm()
{
local SRPM=$1
BASENAME=$(querypackage $SRPM NAME)
RELEASE=$(querypackage $SRPM RELEASE)
VERSION=$(querypackage $SRPM VERSION)
PKGARCH=$(querypackage $SRPM ARCH)
# suggest target arch
if [ "$PKGARCH" != "noarch" ] ; then
PKGARCH=$DEFAULTARCH
fi
NAMERPMIN=$BASENAME-$VERSION-$RELEASE.$PKGARCH.rpm
NAMESRPMIN=$BASENAME-$VERSION-$RELEASE.src.rpm
if [ "$(basename "$SRPM")" != $NAMESRPMIN ] ; then
warning "Generated srpm name $NAMESRPMIN is not equal to real file name $SRPM"
fi
}
spec_by_srpm()
{
local PKG=$1
local PKGNAME
PKGNAME=$(querypackage $PKG NAME)
[ -n "$PKGNAME" ] && echo $PKGNAME.spec
}
# pkg-source-1.0.src.rpm -> pkg-source # pkg-source-1.0.src.rpm -> pkg-source
get_pkgname_from_filename() get_pkgname_from_filename()
{ {
......
...@@ -173,13 +173,6 @@ add_changelog_helper() ...@@ -173,13 +173,6 @@ add_changelog_helper()
return $R return $R
} }
spec_by_srpm()
{
local PKG=$1
local PKGNAME
PKGNAME=$(rpm -qp --queryformat "%{NAME}" $PKG)
[ -n "$PKGNAME" ] && echo $PKGNAME.spec
}
# set specdir by spec (run with full path to spec only or in spec dir) # set specdir by spec (run with full path to spec only or in spec dir)
set_specdir() set_specdir()
......
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