From 2ff2ae734f8909054776f89fdb2f6fb3795aac15 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Mon, 20 Jul 2009 15:22:00 -0700 Subject: db-scripts: getpkgbase: return pkgbase by default Check for pkgbase first. If and only if this doesn't exist, return pkgname. This fixes potential ordering issues. Signed-off-by: Aaron Griffin --- db-functions | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'db-functions') diff --git a/db-functions b/db-functions index 6d84d31..fb00d89 100644 --- a/db-functions +++ b/db-functions @@ -66,14 +66,13 @@ _grep_pkginfo() { } -# Get the package base or name +# Get the package base or name as fallback getpkgbase() { local _base - _base="$(_grep_pkginfo "$1" "^pkg(base|name)")" + _base="$(_grep_pkginfo "$1" "^pkgbase")" if [ -z "$_base" ]; then - echo "ERROR: Package '$1' has no pkgbase or pkgname in the PKGINFO. Fail!" - exit 1 + echo $(getpkgname "$1") fi echo "$_base" -- cgit v1.2.3-24-g4f1b