Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'contrib')
-rw-r--r--contrib/.gitignore9
-rw-r--r--contrib/Makefile.am36
-rw-r--r--contrib/PKGBUILD.vim10
-rw-r--r--contrib/README3
-rwxr-xr-xcontrib/bacman.in (renamed from contrib/bacman)19
-rw-r--r--contrib/bash_completion.in (renamed from contrib/bash_completion)6
-rwxr-xr-xcontrib/pacdiff.in (renamed from contrib/pacdiff)2
-rwxr-xr-xcontrib/paclist.in (renamed from contrib/paclist)0
-rwxr-xr-xcontrib/pacscripts.in (renamed from contrib/pacscripts)8
-rwxr-xr-xcontrib/pacsearch.in (renamed from contrib/pacsearch)0
-rwxr-xr-xcontrib/pactree321
-rwxr-xr-xcontrib/wget-xdelta.sh.in (renamed from contrib/wget-xdelta.sh)10
-rw-r--r--contrib/zsh_completion.in (renamed from contrib/zsh_completion)18
13 files changed, 77 insertions, 365 deletions
diff --git a/contrib/.gitignore b/contrib/.gitignore
new file mode 100644
index 00000000..91044765
--- /dev/null
+++ b/contrib/.gitignore
@@ -0,0 +1,9 @@
+bacman
+bash_completion
+pacdiff
+paclist
+pacscripts
+pacsearch
+pactree
+wget-xdelta.sh
+zsh_completion
diff --git a/contrib/Makefile.am b/contrib/Makefile.am
index c6243b16..4adc9491 100644
--- a/contrib/Makefile.am
+++ b/contrib/Makefile.am
@@ -1,15 +1,41 @@
-EXTRA_DIST = \
- PKGBUILD.vim \
+OURFILES = \
bacman \
bash_completion \
pacdiff \
paclist \
pacscripts \
pacsearch \
- pactree \
- vimprojects \
wget-xdelta.sh \
- zsh_completion \
+ zsh_completion
+
+EXTRA_DIST = \
+ PKGBUILD.vim \
+ bacman.in \
+ bash_completion.in \
+ pacdiff.in \
+ paclist.in \
+ pacscripts.in \
+ pacsearch.in \
+ vimprojects \
+ wget-xdelta.sh.in \
+ zsh_completion.in \
README
+# Files that should be removed, but which Automake does not know.
+MOSTLYCLEANFILES = $(OURFILES) *.tmp
+
+edit = sed \
+ -e 's|@sysconfdir[@]|$(sysconfdir)|g' \
+ -e 's|@localstatedir[@]|$(localstatedir)|g' \
+ -e 's|@BASH_SHELL[@]|$(BASH_SHELL)|g'
+
+$(OURFILES): Makefile
+ @echo ' ' GEN $@;
+ @rm -f $@ $@.tmp
+ @cp -a $@.in $@.tmp
+ @$(edit) $@.in >$@.tmp
+ @mv $@.tmp $@
+
+all-am: $(OURFILES)
+
# vim:set ts=2 sw=2 noet:
diff --git a/contrib/PKGBUILD.vim b/contrib/PKGBUILD.vim
index c35450a0..f627a5e6 100644
--- a/contrib/PKGBUILD.vim
+++ b/contrib/PKGBUILD.vim
@@ -40,7 +40,7 @@ syn match pbPkgverGroup /^pkgver=.*/ contains=pbIllegalPkgver,pbValidPkgver,pb_k
" pkgrel
syn keyword pb_k_pkgrel pkgrel contained
-syn match pbValidPkgrel /[[:digit:]]*/ contained contains=pbIllegalPkgver
+syn match pbValidPkgrel /[[:digit:]]*/ contained contains=pbIllegalPkgrel
syn match pbIllegalPkgrel /[^[:digit:]=]\|=.*=/ contained
syn match pbPkgrelGroup /^pkgrel=.*/ contains=pbIllegalPkgrel,pbValidPkgrel,pb_k_pkgrel,shDoubleQuote,shSingleQuote
@@ -52,6 +52,12 @@ syn match pbValidPkgdesc /[^='"]\.\{,80}/ contained contains=pbIllegalPkgdesc
syn match pbPkgdescGroup /^pkgdesc=.*/ contains=pbIllegalPkgdesc,pb_k_desc,pbValidPkgdesc,shDoubleQuote,shSingleQuote
syn match pbPkgdescSign /[='"]/ contained
+" epoch
+syn keyword pb_k_epoch epoch contained
+syn match pbValidEpoch /[[:digit:]]*/ contained contains=pbIllegalEpoch
+syn match pbIllegalEpoch /[^[:digit:]=]\|=.*=/ contained
+syn match pbEpochGroup /^epoch=.*/ contains=pbIllegalEpoch,pbValidEpoch,pb_k_epoch,shDoubleQuote,shSingleQuote
+
" url
syn keyword pb_k_url url contained
syn match pbValidUrl /['"]*\(https\|http\|ftp\)\:\/.*\.\+.*/ contained
@@ -166,7 +172,7 @@ hi def link pbValidSha1sums Number
" options
syn keyword pb_k_options options contained
-syn match pbOptions /\(no\)\?\(strip\|docs\|libtool\|emptydirs\|zipman\|ccache\|distcc\|makeflags\|force\)/ contained
+syn match pbOptions /\(no\)\?\(strip\|docs\|libtool\|emptydirs\|zipman\|ccache\|distcc\|makeflags\|buildflags\)/ contained
syn match pbOptionsNeg /\!/ contained
syn match pbOptionsDeprec /no/ contained
syn region pbOptionsGroup start=/^options=(/ end=/)/ contains=pb_k_options,pbOptions,pbOptionsNeg,pbOptionsDeprec,pbIllegalOption,shDoubleQuote,shSingleQuote
diff --git a/contrib/README b/contrib/README
index 96234722..4f591012 100644
--- a/contrib/README
+++ b/contrib/README
@@ -23,9 +23,6 @@ pacsearch - a colorized search combining both -Ss and -Qs output. Installed
packages are easily identified with a *** and local-only packages are also
listed.
-pactree - generate a dependency tree of an installed package in textual or
-graphical form (using graphviz).
-
bacman - regenerate a pacman package based on installed files and the pacman
database entries. Useful for reuse, or possible config file extension.
diff --git a/contrib/bacman b/contrib/bacman.in
index 6dd78394..bd545180 100755
--- a/contrib/bacman
+++ b/contrib/bacman.in
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!@BASH_SHELL@
#
# bacman: recreate a package from a running system
# This script rebuilds an already installed package using metadata
@@ -67,20 +67,20 @@ fi
#
# Setting environmental variables
#
-if [ ! -r /etc/pacman.conf ]; then
- echo "ERROR: unable to read /etc/pacman.conf"
+if [ ! -r @sysconfdir@/pacman.conf ]; then
+ echo "ERROR: unable to read @sysconfdir@/pacman.conf"
exit 1
fi
-eval $(awk '/DBPath/ {print $1$2$3}' /etc/pacman.conf)
-pac_db="${DBPath:-/var/lib/pacman/}/local"
+eval $(awk '/DBPath/ {print $1$2$3}' @sysconfdir@/pacman.conf)
+pac_db="${DBPath:-@localstatedir@/lib/pacman/}/local"
-if [ ! -r /etc/makepkg.conf ]; then
- echo "ERROR: unable to read /etc/makepkg.conf"
+if [ ! -r @sysconfdir@/makepkg.conf ]; then
+ echo "ERROR: unable to read @sysconfdir@/makepkg.conf"
exit 1
fi
-source "/etc/makepkg.conf"
+source "@sysconfdir@/makepkg.conf"
if [ -r ~/.makepkg.conf ]; then
source ~/.makepkg.conf
fi
@@ -220,9 +220,6 @@ while read i; do
%REPLACES%)
echo "replaces = $i" >> .PKGINFO
;;
- %FORCE%)
- echo "force = true" >> .PKGINFO
- ;;
# files
%BACKUP%)
diff --git a/contrib/bash_completion b/contrib/bash_completion.in
index bdc4754a..7f47f4b4 100644
--- a/contrib/bash_completion
+++ b/contrib/bash_completion.in
@@ -30,8 +30,7 @@ _arch_incomp() {
_makepkg() {
local cur opts prev
COMPREPLY=()
- cur=$(_get_cword)
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
if [[ $cur = -* && ! $prev =~ ^-(-(cleancache|config|help)$|\w*[Chp]) ]]; then
opts=('allsource asroot clean cleancache config force geninteg help holdver
ignorearch install log nobuild nocolor noconfirm nodeps noextract
@@ -55,8 +54,7 @@ _pacman_pkg() {
_pacman() {
local common core cur database prev query remove sync upgrade o
COMPREPLY=()
- cur=$(_get_cword)
- prev=${COMP_WORDS[COMP_CWORD-1]}
+ _get_comp_words_by_ref cur prev
database=('asdeps asexplicit')
query=('changelog check deps explicit file foreign groups info list owns
search unrequired upgrades' 'c e g i k l m o p s t u')
diff --git a/contrib/pacdiff b/contrib/pacdiff.in
index 3f26f381..ac4ce893 100755
--- a/contrib/pacdiff
+++ b/contrib/pacdiff.in
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!@BASH_SHELL@
# pacdiff : a simple pacnew/pacorig/pacsave updater
#
# Copyright (c) 2007 Aaron Griffin <aaronmgriffin@gmail.com>
diff --git a/contrib/paclist b/contrib/paclist.in
index 0379a4c5..0379a4c5 100755
--- a/contrib/paclist
+++ b/contrib/paclist.in
diff --git a/contrib/pacscripts b/contrib/pacscripts.in
index 101fb15f..d3664091 100755
--- a/contrib/pacscripts
+++ b/contrib/pacscripts.in
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!@BASH_SHELL@
#
# pacscripts : tries to print out the {pre,post}_{install,remove,upgrade}
# scripts of a given package
@@ -27,7 +27,7 @@ set -o errexit
progname=$(basename $0)
progver="0.4"
-conf="/etc/pacman.conf"
+conf="@sysconfdir@/pacman.conf"
if [ ! -r "$conf" ]; then
echo "ERROR: unable to read $conf"
@@ -36,8 +36,8 @@ fi
eval $(awk '/DBPath/ {print $1$2$3}' "$conf")
eval $(awk '/CacheDir/ {print $1$2$3}' "$conf")
-pac_db="${DBPath:-/var/lib/pacman}/local"
-pac_cache="${CacheDir:-/var/cache/pacman/pkg}"
+pac_db="${DBPath:-@localstatedir@/lib/pacman}/local"
+pac_cache="${CacheDir:-@localstatedir@/cache/pacman/pkg}"
error() {
local mesg=$1; shift
diff --git a/contrib/pacsearch b/contrib/pacsearch.in
index a20df265..a20df265 100755
--- a/contrib/pacsearch
+++ b/contrib/pacsearch.in
diff --git a/contrib/pactree b/contrib/pactree
deleted file mode 100755
index 73bece3a..00000000
--- a/contrib/pactree
+++ /dev/null
@@ -1,321 +0,0 @@
-#!/bin/bash
-# pactree : a simple dependency tree viewer
-#
-# Copyright (C) 2008 Carlo "carlocci" Bersani <carlocci@gmail.com>
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-# Original http://carlocci.ngi.it/arch/pactree
-# Credit to scj for the graphviz idea
-
-# set the colors
-branch1_color="\033[0;33m" #Brown
-branch2_color="\033[0;37m" #Gray
-leaf_color="\033[1;32m" #Light green
-leaf2_color="\033[0;32m" #Green
-
-# set the separators
-separator=" "
-branch_tip1="|--"
-branch_tip2="+--"
-provides="provides "
-
-# set the graphviz options
-# http://www.graphviz.org/doc/info/output.html for available output formats
-# http://www.graphviz.org/doc/info/colors.html for available colors
-gformat="png" #output format
-start_color="red" #START color
-nodes_color="green" #color of the nodes
-arrow1_color="chocolate4" #color of the normal arrow
-arrow2_color="grey" #color of the "provided by" headless arrow
-
-readonly prog_name="pactree"
-readonly prog_ver="0.3"
-
-_usage(){
- echo "This program generates the dependency tree of an installed package"
- echo "Usage: $prog_name [OPTIONS] <installed packages>"
- echo
- echo " OPTIONS:"
- echo " -c, --color Enable color output"
- echo " -d, --depth INT Limit the shown dependencies depth"
- echo " -g, --graph Use graphviz to make an image of the tree"
- echo " -l, --linear Enable linear output"
- echo " -r, --reversed Show reversed dependancies"
- echo " -s, --silent Shh, let me hear those errors!"
- echo " -u, --unique Print the dependency list with no duplicates"
- echo
- echo " -h, --help Print this help message"
- echo " -v, --version Print the program name and version"
- echo
- echo "Example: $prog_name -c -d2 readline"
-}
-
-_version(){
- echo "$prog_name version $prog_ver"
- echo "Copyright (C) 2008 Carlo \"carlocci\" Bersani <carlocci@gmail.com>"
-}
-# end of the friendliness
-
-
-# grab a field from the database: $1=path/to/file, $2=field to grab
-_grabfield(){
- for line in $(cat "$1" 2>/dev/null ); do
- if [ -z "$line" ]; then
- continue;
- fi;
- if [[ "$line" =~ %[A-Z]*% ]]; then
- current="$line"
- continue;
- fi;
- if [ "$current" = "$2" ]; then
- echo "$line"
- fi;
- done
-}
-
-
-# find a dep in the db: $1=dep, $2=field, $3=dbfile, ret=file list
-_finddep(){
- for line in $(awk 'BEGIN{RS=""}
- {
- if ($1=="'"$2"'"){
- for (i=2 ; i<=NF ; ++i){
- if ($i ~ /^'"$1"'([<>=]+.*|)$/ ){
- print FILENAME}
- }
- }
- }' $(find $pac_db -name $3)); do
- echo "${line%/*}"
- done
-}
-
-
-# Recursive function: does all of the work, pays all of the taxes #
-_tree(){
- pkg_name="$1"
- pkg_dirs="$(echo $pac_db/$pkg_name-[0-9]*)"
-
- # Is $pkg_name real or provided?
- [ ! -d "$pkg_dirs" ] && pkg_dirs="$(_finddep $pkg_name %PROVIDES% depends)"
-
- for pkg_dir in $pkg_dirs ; do
- spaces="$2"
- unset provided
- branch_tip="$branch_tip1"
- branch_color="$branch1_color"
- pkg_name="$(_grabfield "$pkg_dir/desc" %NAME%)"
- if [ ! "$pkg_name" = "$1" ]; then
- provided="$leaf2_color $provides$leaf_color$1"
- branch_tip="$branch_tip2"
- branch_color="$branch2_color"
- if [ $graphviz -eq 1 ] && [[ ! "${dep_list[@]}" =~ _$1_ ]] && [ $spaces -ne $((max_depth+1)) ]; then
- echo "\"$1\" -> \"$pkg_name\" [arrowhead=none, color=$arrow2_color];"
- dep_list=( "${dep_list[@]}" "_$1_" )
- _tree "$pkg_name" $((spaces+1))
- continue
- fi
- fi
-
- # Generate the spacer
- spacer=""
- for each in $(seq 1 $spaces); do
- spacer="$spacer$separator"
- done
- spacer="$spacer$branch_tip"
-
- [ $silent -ne 1 ] && echo -e "$branch_color$spacer$leaf_color$pkg_name$provided"
-
- [ ! -d "$pkg_dir" ] && echo "No $pkg_name in the database (inconsistent database?)" >&2
-
- if [[ ! " ${dep_list[@]} " =~ " $pkg_name " ]] && [ $spaces -ne $max_depth ]; then
- dep_list=( "${dep_list[@]}" "$pkg_name" )
- if [ $reversed_dep -eq 0 ]; then
- deps_pkg="$(_grabfield "$pkg_dir/depends" %DEPENDS%)"
- else
- reqs_pkg_dir="$(_finddep "$pkg_name" %DEPENDS% depends)"
- unset deps_pkg
- for req_pkg_dir in $reqs_pkg_dir; do
- deps_pkg=$(echo "$deps_pkg" "$(_grabfield "$req_pkg_dir/desc" %NAME%)")
- done
- fi
- for dep_pkg in $deps_pkg; do
- spaces=$2 #Bash scoping ;_;
- if [ $graphviz -eq 1 ]; then
- echo "\"$1\" -> \"${dep_pkg%%[<>=]*}\" [color=$arrow1_color];"
- fi
- _tree "${dep_pkg%%[<>=]*}" $((spaces+1))
- done
- fi
- done
-}
-
-
-# Main program: gets all of the money, pays none of the taxes
-
-# Command line parameters parser
-if [ $# -eq 0 ]; then
- _usage
- exit 1
-fi
-
-options=( "$@" )
-len_options=${#options[@]}
-for (( n=0 ; n < $len_options ; n++ )); do
- if [ "${options[$n]}" = "--" ]; then
- unset options[$n]
- break
- fi
- if [ "${options[$n]}" = "-h" -o "${options[$n]}" = "--help" ]; then
- _usage
- exit 0
- fi
-
- if [ "${options[$n]}" = "-v" -o "${options[$n]}" = "--version" ]; then
- _version
- exit 0
- fi
-
- if [ "${options[$n]}" = "-l" -o "${options[$n]}" = "--linear" ]; then
- unset options[$n]
- linear=1
- continue
- fi
-
- if [ "${options[$n]}" = "-s" -o "${options[$n]}" = "--silent" ]; then
- unset options[$n]
- silent=1
- continue
- fi
-
- if [ "${options[$n]}" = "-u" -o "${options[$n]}" = "--unique" ]; then
- unset options[$n]
- silent=1
- nodup=1
- continue
- fi
-
- if [ "${options[$n]}" = "-g" -o "${options[$n]}" = "--graph" ]; then
- unset options[$n]
- graphviz=1
- continue
- fi
-
- if [ "${options[$n]}" = "-c" -o "${options[$n]}" = "--color" ]; then
- unset options[$n]
- colored=1
- continue
- fi
-
- if [ "${options[$n]}" = "-r" -o "${options[$n]}" = "--reversed" ]; then
- unset options[$n]
- reversed_dep=1
- continue
- fi
-
- if [[ "${options[$n]}" =~ -d[[:digit:]]+ || "${options[$n]}" == "--depth" ]]; then
- if [[ "${options[$n]#-d}" =~ [[:digit:]]+ ]]; then
- max_depth="${options[$n]#-d}"
- elif [[ ${options[$((n+1))]} =~ [[:digit:]]+ ]]; then
- max_depth="${options[$((n+1))]}"
- unset options[$((n+1))]
- ((++n))
- fi
- unset options[$n]
- continue
- fi
-done
-# End of the dumb command line parser
-
-# Env
-colored=${colored:-0}
-max_depth=${max_depth:--10}
-linear=${linear:-0}
-silent=${silent:-0}
-nodup=${nodup:-0}
-graphviz=${graphviz:-0}
-reversed_dep=${reversed_dep:-0}
-
-if [ $colored -ne 1 ]; then
- unset branch1_color
- unset leaf_color
- unset leaf2_color
- unset branch2_color
-fi
-
-if [ $linear -eq 1 ]; then
- unset separator
- unset branch_tip1
- unset branch_tip2
- unset provides
-fi
-
-if [ $graphviz -eq 1 ]; then
- silent=1
- nodup=0
- if [ ! -f /usr/bin/dot ]; then
- echo "ERROR: package graphviz is not installed"
- echo " Run pacman -S graphviz to install it"
- exit 1
- fi
-fi
-
-if [ ! -r /etc/pacman.conf ]; then
- echo "ERROR: unable to read /etc/pacman.conf"
- exit 1
-else
- eval $(awk '/DBPath/ {print $1$2$3}' /etc/pacman.conf)
-fi
-
-pac_db="${DBPath:-/var/lib/pacman}/local"
-
-if [ ! -d "$pac_db" ] ; then
- echo "ERROR: pacman database directory ${pac_db} not found"
- exit 1
-fi
-# Env End
-
-
-# Program starts
-_main(){
- for pkg_name in ${options[@]} ; do
- [ $graphviz -eq 1 ] && echo -e "\"START\" -> \"$pkg_name\" ;"
- _tree "$pkg_name" 0
- if [ $nodup -eq 1 ]; then
- for pkg_tree in ${dep_list[@]} ; do
- echo "$pkg_tree"
- done
- fi
- done
- if [ $silent -eq 0 ]; then
- echo -ne '\033[0m' # return colors to normal?
- echo -ne '\033[?25h' #return cursor to normal?
- fi
-}
-
-
-if [ $graphviz -eq 1 ]; then
- root_pkgs="${options[@]}"
- # Uncomment for the "generated by pactree" node in graphviz
- #advert="xyz [height=0.07, fontsize=8.0, label=\"GENERATED WITH PACTREE\",shape=box,color="black",style=filled,fontcolor="white"];\n"
- if [ $reversed_dep -eq 0 ]; then
- file_extension="deps.$gformat"
- else
- file_extension="reqs.$gformat"
- fi
- echo -e "digraph G { START [color=$start_color, style=filled];\n node [style=filled, color=$nodes_color];\n$(_main)\n$advert}" | dot -T$gformat -o "${root_pkgs// /_}.$file_extension"
-else _main
-fi
-
-# vim: set ts=2 sw=2 noet:
diff --git a/contrib/wget-xdelta.sh b/contrib/wget-xdelta.sh.in
index 4656f4dd..f2ac1c87 100755
--- a/contrib/wget-xdelta.sh
+++ b/contrib/wget-xdelta.sh.in
@@ -1,7 +1,7 @@
-#!/bin/bash
+#!@BASH_SHELL@
-if [ -r "/etc/makepkg.conf" ]; then
- source /etc/makepkg.conf
+if [ -r "@sysconfdir@/makepkg.conf" ]; then
+ source @sysconfdir@/makepkg.conf
else
echo "wget-xdelta: Unable to find makepkg.conf"
exit 1
@@ -30,11 +30,11 @@ new_version=$(echo $pkg_data | cut -d ' ' -f 2)
base_url=${file_url%/*}
# Look for the last version
-for file in $(ls -r /var/cache/pacman/pkg/${pkgname}-*-*{,-$CARCH}$PKGEXT 2>/dev/null); do
+for file in $(ls -r @localstatedir@/cache/pacman/pkg/${pkgname}-*-*{,-$CARCH}$PKGEXT 2>/dev/null); do
[[ "$file" =~ "$CARCH" ]] && arch="-$CARCH" || arch=""
check_version=$(echo $file | \
sed "s|^.*/${pkgname}-\([[:alnum:]_\.]*-[[:alnum:]_\.]*\)${arch}$PKGEXT$|\1|" | \
- grep -v "^/var/cache/pacman/pkg")
+ grep -v "^@localstatedir@/cache/pacman/pkg")
[ "$check_version" = "" ] && continue
diff --git a/contrib/zsh_completion b/contrib/zsh_completion.in
index f69fe631..16919134 100644
--- a/contrib/zsh_completion
+++ b/contrib/zsh_completion.in
@@ -222,20 +222,20 @@ _pacman_completions_all_groups() {
_pacman_completions_all_packages() {
local -a cmd packages repositories packages_long
- repositories=(${(o)${${${(M)${(f)"$(</etc/pacman.conf)"}:#\[*}/\[/}/\]/}:#options})
+ repositories=(${(o)${${${(M)${(f)"$(<@sysconfdir@/pacman.conf)"}:#\[*}/\[/}/\]/}:#options})
typeset -U repositories
- packages_long=(/var/lib/pacman/sync/${^repositories}/*(/))
- packages=(${(o)${${packages_long/\/var\/lib\/pacman\/sync\//}#*/}%-*-*} )
+ packages_long=(@localstatedir@/lib/pacman/sync/${^repositories}/*(/))
+ packages=(${(o)${${packages_long#@localstatedir@/lib/pacman/sync/}#*/}%-*-*} )
typeset -U packages
_wanted packages expl "packages" compadd - "${(@)packages}"
if [[ $PREFIX != */* ]] ; then
- repositories=(${(o)${${${(M)${(f)"$(</etc/pacman.conf)"}:#\[*}/\[/}/\]/}:#options})
+ repositories=(${(o)${${${(M)${(f)"$(<@sysconfdir@/pacman.conf)"}:#\[*}/\[/}/\]/}:#options})
typeset -U repositories
_wanted repo_packages expl "repository/package" compadd -S "/" $repositories
else
compset -P '*/'
- packages_long=(/var/lib/pacman/sync/$IPREFIX*(/))
- packages=(${(o)${${packages_long/\/var\/lib\/pacman\/sync\//}#*/}%-*-*} )
+ packages_long=(@localstatedir@/lib/pacman/sync/$IPREFIX*(/))
+ packages=(${(o)${${packages_long#@localstatedir@/lib/pacman/sync/}#*/}%-*-*} )
typeset -U packages
_wanted repo_packages expl "repository/package" compadd ${(@)packages}
fi
@@ -253,15 +253,15 @@ _pacman_completions_installed_groups() {
# provides completions for installed packages
_pacman_completions_installed_packages() {
local -a cmd packages packages_long
- packages_long=(/var/lib/pacman/local/*(/))
- packages=( ${${packages_long/\/var\/lib\/pacman\/local\//}%-*-*} )
+ packages_long=(@localstatedir@/lib/pacman/local/*(/))
+ packages=( ${${packages_long#@localstatedir@/lib/pacman/local/}%-*-*} )
compadd "$@" -a packages
}
# provides completions for repository names
_pacman_completions_repositories() {
local -a cmd repositories
- repositories=(${(o)${${${(M)${(f)"$(</etc/pacman.conf)"}:#\[*}/\[/}/\]/}:#options})
+ repositories=(${(o)${${${(M)${(f)"$(<@sysconfdir@/pacman.conf)"}:#\[*}/\[/}/\]/}:#options})
# Uniq the array
typeset -U repositories
compadd "$@" -a repositories