summaryrefslogtreecommitdiff
path: root/src/core/libs/lib-pacman.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/libs/lib-pacman.sh')
-rw-r--r--src/core/libs/lib-pacman.sh29
1 files changed, 28 insertions, 1 deletions
diff --git a/src/core/libs/lib-pacman.sh b/src/core/libs/lib-pacman.sh
index 4497074..a104cee 100644
--- a/src/core/libs/lib-pacman.sh
+++ b/src/core/libs/lib-pacman.sh
@@ -78,7 +78,7 @@ do
then
add_pacman_repo target ${repo} "Include = $var_MIRRORLIST"
else
- add_pacman_repo target ${repo} "Server = ${serverurl/\/\$repo\//\/$repo\/}" # replace literal '/$repo/' in the serverurl string by "/$repo/" where $repo is our variable.
+ add_pacman_repo target ${repo} "Server = ${serverurl/\$repo/$repo}" # replace literal '$repo' in the serverurl string by "$repo" where $repo is our variable.
fi
done
# Set up the necessary directories for pacman use
@@ -132,3 +132,30 @@ pacman_what_is_this_for ()
! [ -d /var/lib/pacman ] && mkdir -p /var/lib/pacman
}
+list_package_groups ()
+{
+ $PACMAN_TARGET -Sg
+}
+
+
+# List the packages in one or more repos or groups. output is one or more lines, each line being like this:
+# <repo/group name> packagename [version, if $1=repo]
+# $1 repo or group
+# $2 one or more repo or group names
+# TODO: check the validity of the specified names in $2
+list_packages ()
+{
+ [ "$1" = repo -o "$1" = group ] || die_error "list_packages \$1 must be repo or group. not $1!"
+ [ "$1" = repo ] && $PACMAN_TARGET -Sl $2
+ [ "$1" = group ] && $PACMAN_TARGET -Sg $2
+}
+
+# find out the group to which one or more packages belong
+# $1 packages separated by spaces
+# output format: multiple lines, each line like:
+# <pkgname> <group>
+# TODO: check $1
+which_group ()
+{
+ PACKAGE_GROUPS=`$PACMAN_TARGET -Si $1| awk '/^Name/{ printf("%s ",$3) } /^Group/{ print $3 }'`
+}