cpt

Carbs Packaging Tools
git clone git://git.carbslinux.org/cpt
Log | Files | Refs | README | LICENSE

commit d630d6cca44986e884fa917048b2042c54db05d7
parent 6656fbf0f387f778a2a5fb077be6835abd6a7686
Author: Cem Keylan <cem@ckyln.com>
Date:   Mon, 26 Oct 2020 00:43:52 +0300

pkg_owner(): add function to retrieve the owning package of a file

This function is almost identical to the function with the same name on
kiss. However, instead of saving the owner on a global variable, the function
prints the owning package to the standard output.

The function can be called similar to grep. The usage is:

    pkg_owner GREP_FLAGS FILE_TO_CHECK MANIFEST_LOCATIONS...

If no manifest is specified, the function will use every installed package
on the system database.

Diffstat:
Msrc/cpt-lib | 13+++++++++++++
1 file changed, 13 insertions(+), 0 deletions(-)

diff --git a/src/cpt-lib b/src/cpt-lib @@ -393,6 +393,19 @@ sh256() { while read -r hash _; do printf '%s %s\n' "$hash" "$1"; done } +pkg_owner() { + set +f + + [ "$3" ] || set -- "$1" "$2" "$sys_db"/*/manifest + + pkg_owner=$(grep "$@") + pkg_owner=${pkg_owner%/*} + pkg_owner=${pkg_owner##*/} + + set -f -- "$pkg_owner"; unset pkg_owner + [ "$1" ] && printf '%s\n' "$1" +} + pkg_isbuilt() ( # Check if a package is built or not. read -r ver rel < "$(pkg_find "$1")/version"