Simplify check_installed_pkg to avoid calling xbps-pkgdb unnecessarily.
--HG-- extra : convert_revision : 6e0f6f96a65b346e2e2e3c3253e5469d5eed8ede
This commit is contained in:
parent
3c6daaa6e3
commit
c467d31a66
2 changed files with 5 additions and 14 deletions
|
@ -193,11 +193,8 @@ main(int argc, char **argv)
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
obj = prop_dictionary_get(dbdict, argv[2]);
|
obj = prop_dictionary_get(dbdict, argv[2]);
|
||||||
if (obj == NULL) {
|
if (obj == NULL)
|
||||||
printf("=> ERROR: package `%s' not registered in database.\n",
|
|
||||||
argv[2]);
|
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
|
||||||
printf("%s\n", prop_string_cstring_nocopy(obj));
|
printf("%s\n", prop_string_cstring_nocopy(obj));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
14
xbps.sh
14
xbps.sh
|
@ -1164,16 +1164,10 @@ check_installed_pkg()
|
||||||
run_file $XBPS_TEMPLATESDIR/${pkg%-[0-9]*.*}.tmpl
|
run_file $XBPS_TEMPLATESDIR/${pkg%-[0-9]*.*}.tmpl
|
||||||
fi
|
fi
|
||||||
|
|
||||||
$XBPS_PKGDB_CMD installed $pkgname
|
iver="$($XBPS_PKGDB_CMD version $pkgname)"
|
||||||
if [ $? -eq 0 ]; then
|
if [ -n "$iver" ]; then
|
||||||
#
|
$XBPS_CMPVER_CMD $pkgname-$iver $pkgname-$reqver
|
||||||
# Package is installed, let's check the version.
|
[ $? -eq 0 ] && return 0
|
||||||
#
|
|
||||||
iver="$($XBPS_PKGDB_CMD version $pkgname)"
|
|
||||||
if [ -n "$iver" ]; then
|
|
||||||
$XBPS_CMPVER_CMD $pkgname-$iver $pkgname-$reqver
|
|
||||||
[ $? -eq 0 ] && return 0
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
|
|
Loading…
Reference in a new issue