From e967bfd71a068d6c3f5831cfa93de92d78136065 Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Mon, 16 Jun 2008 14:43:03 -0400 Subject: Autoconfify razor. --- data/.gitignore | 2 ++ data/Makefile.am | 11 +++++++++++ data/bash-completion.sh | 47 +++++++++++++++++++++++++++++++++++++++++++++++ data/razor.pc.in | 12 ++++++++++++ 4 files changed, 72 insertions(+) create mode 100644 data/.gitignore create mode 100644 data/Makefile.am create mode 100644 data/bash-completion.sh create mode 100644 data/razor.pc.in (limited to 'data') diff --git a/data/.gitignore b/data/.gitignore new file mode 100644 index 0000000..16bc098 --- /dev/null +++ b/data/.gitignore @@ -0,0 +1,2 @@ +razor.pc + diff --git a/data/Makefile.am b/data/Makefile.am new file mode 100644 index 0000000..9405c68 --- /dev/null +++ b/data/Makefile.am @@ -0,0 +1,11 @@ +## Process this file with automake to produce Makefile.in + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = razor.pc + +bashcompletiondir = ${SYSCONFDIR}/bash_completion.d +dist_bashcompletion_DATA = bash-completion.sh + +clean-local : + rm -f *~ + diff --git a/data/bash-completion.sh b/data/bash-completion.sh new file mode 100644 index 0000000..a4e9f4e --- /dev/null +++ b/data/bash-completion.sh @@ -0,0 +1,47 @@ +__razor_commands () { + local IFS=$'\n' + COMPREPLY=($(IFS=: compgen -S' ' -W "list-requires:list-provides:list-files:list-file-packages:list-package-files:what-requires:what-provides:import-yum:import-rpmdb:validate:update:diff:install:init:download" -- $1)) +} + +__razor_packages () { + local IFS=$'\n' + + COMPREPLY=($(./razor list --only-names "$1*" | while read p; do echo "$p "; done)) +} + +__razor_upstream_packages () { + local IFS=$'\n' + + COMPREPLY=($(RAZOR_REPO=rawhide.repo ./razor list --only-names "$1*" | while read p; do echo "$p "; done)) +} + +__razor_files() { + COMPREPLY=($(./razor list-files "$1*")) +} + +__razor_requires() { + COMPREPLY=($(compgen -W "$(./razor list-requires)" -- $1)) +} + +__razor_provides() { + COMPREPLY=($(compgen -W "$(./razor list-provides)" -- $1)) +} + +__razor() { + local cur="${COMP_WORDS[COMP_CWORD]}" + + if [ $COMP_CWORD = 1 ]; then + __razor_commands $cur + else + case "${COMP_WORDS[1]}" in + list-requires|list-provides|list-package-files) + __razor_packages $cur ;; + list-files|list-file-packages) __razor_files $cur ;; + what-requires) __razor_requires $cur ;; + what-provides) __razor_provides $cur ;; + install|download) __razor_upstream_packages $cur ;; + esac + fi +} + +complete -o nospace -F __razor razor diff --git a/data/razor.pc.in b/data/razor.pc.in new file mode 100644 index 0000000..ddf0ba0 --- /dev/null +++ b/data/razor.pc.in @@ -0,0 +1,12 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: razor +Description: library for depsolving, installing and removing packages +Version: @VERSION@ +Requires: expat curl +Libs: -L${libdir} -lexpat -lz -lcurl +Cflags: -I${includedir}/razor + -- cgit v1.2.3