Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
cwilling committed Jun 6, 2018
2 parents 67cccd4 + 400269c commit 3903081
Show file tree
Hide file tree
Showing 7 changed files with 152 additions and 10 deletions.
9 changes: 8 additions & 1 deletion INSTALL.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
A Makefile is provided for installation of the hoorex application
A Makefile is provided for installation of the HooRex application
and manpage. Run (as root):
make install


REQUIREMENTS.
- the a2x utility (a Python script) is used to generate the man page
so the python and linuxdoc-tools packages will need to be installed.
- for commandline tab completion under bash, the bash-completion package
(found in the Slackware CD's "extra" directory) must be installed. Only
terminals instantiated after installing both bash-completion and HooRex
will have tab completion enabled. Existing terminals may be enabled by
running the command:
. /usr/share/bash-completion/bash_completion

16 changes: 9 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ all: hoorex man
man: hoorex.1


hoorex: VERSION.txt
sed -i -e "s/^HOOREX_VERSION.*/HOOREX_VERSION = \'$$(cat VERSION.txt)\'/" hoorex
hoorex: VERSION.txt hoorex.in
sed -e "s/^HOOREX_VERSION.*/HOOREX_VERSION = \'$$(cat VERSION.txt)\'/" hoorex.in > hoorex
chmod a+x hoorex

hoorex.1: hoorex.1.in
a2x -f manpage $?
Expand All @@ -15,15 +16,16 @@ install: hoorex man
install -m 0755 -D hoorex $(DESTDIR)/usr/bin/hoorex
install -m 0644 -D hoorex.1 $(DESTDIR)/usr/man/man1/hoorex.1
install -m 0644 -D completions/zsh/_hoorex $(DESTDIR)/usr/share/zsh/site-functions/_hoorex
install -m 0644 -D completions/bash/hoorex $(DESTDIR)/usr/share/bash-completion/completions/hoorex

uninstall:
rm $(DESTDIR)/usr/bin/hoorex
rm $(DESTDIR)/usr/man/man1/hoorex.1
rm $(DESTDIR)/usr/share/zsh/site-functions/_hoorex
rm -f $(DESTDIR)/usr/bin/hoorex
rm -f $(DESTDIR)/usr/man/man1/hoorex.1*
rm -f $(DESTDIR)/usr/share/zsh/site-functions/_hoorex
rm -f $(DESTDIR)/usr/share/bash-completion/completions/hoorex

clean:
rm -f hoorex.1
sed -i -e "s/^HOOREX_VERSION.*/HOOREX_VERSION = 'X.Y.Z'/" hoorex
rm -f hoorex.1 hoorex

.PHONY: clean
.PHONY: hoorex
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@ HooRex addresses these issues (and more) by generating and cacheing the
dependency relationships between all packages in the repository, enabling a
rapid response to dependency queries.

Command line Tab completion is now available for bash and zsh. Completions for
HooRex should just work for any new zsh instances invoked after HooRex has been
installed. For completions using bash, ensure that the bash-completions package
(available from the Slackware repo's "extra" section) has been installed.
2 changes: 1 addition & 1 deletion VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.6.1
0.6.2
111 changes: 111 additions & 0 deletions completions/bash/hoorex
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
#!/bin/sh


# If "sbo_path" is already set in config file, all options are available
grep sbo_path ~/.config/hoorex/defaults.cfg >/dev/null
if [ "$?" = "0" ]; then
# Master array of options
_comp_descriptions=(
'-d --debug (Enable additional debugging output)'
'-f --force (Recalculate all internal cross reference index)'
'-g --group (Use a predefined group of packages as input)'
'-h --help (Show help)'
'-1 --column (Single column output of results)'
'-p --dataPath (Alternate directory to store reference index file)'
'-i --installed (Restrict output to packages already installed)'
'-I --installed_strict (Restrict output to packages already installed - not even the initial target)'
'-l --long (Include category of each result output)'
'-m --multilevel (Show dependencies beyond the first level)'
'-r --reverse (Reverse display direction of dependencies i.e. show packages required to build the target)'
'-R --restricted (Restrict results to those named in the input list)'
'-s --slackbuilds (Specify full path to SBo repo)'
'-U --unknown_strict (Announce unknown packages and exit)'
'-V --version (Show version number and exit)'
);

# find out which SBO repo hoorex is configured for
_comp_sborepo="$(grep 'sbo_path' ~/.config/hoorex/defaults.cfg | cut -d= -f2 | xargs)"

# Find the top level directories of repo (SBo groups: games, network, etc. + "all")
_comp_sbogroups="$(find $_comp_sborepo -not -path '*/\.*' -type d -mindepth 1 -maxdepth 1 -printf '%f ') all"

# Listing of all slackbuilds
_comp_sbobuilds=$(hoorex -g all -1 |sort)
else
# "sbo_path" not set in config file => only -s|--slackbuilds option should be offered
_comp_descriptions=( '-s --slackbuilds (Specify full path to SBo repo)' );
fi

# Create an array of short options based on the master above
_comp_dcount=0
while [ "x${_comp_descriptions[_comp_dcount]}" != "x" ]
do
# Add 1st element of each entry in _comp_descriptions array
_comp_short_opts[$_comp_dcount]=$(echo ${_comp_descriptions[_comp_dcount]} | cut -d ' ' -f 1);

_comp_dcount=$(( $_comp_dcount + 1 ));
done

_hoorex ()
{
local cur prev

cur=${COMP_WORDS[COMP_CWORD]}

if [[ $COMP_CWORD -gt 1 ]] ; then
prev=${COMP_WORDS[COMP_CWORD-1]};
case $prev in
-g*|--group*)
COMPREPLY=($(compgen -W '${_comp_sbogroups}' -- "$cur"));
return;
;;
-h*|--help*)
return;
;;
-p*|--dataPath*)
#echo -n " N.B. The -p|--dataPath option needs full path to alternate directory to store reference index file";
return 1;
;;
-s*|--slackbuilds*)
#echo -n " N.B. The -s|--slackbuilds option needs full path to SBo slackbuilds tree";
return 1;
;;
-d|-f|-h|-1|-i|-I|-l|-m|-r|-R|-U|-V|\
--debug|--force|--help|--column|--installed|--installed_strict|\
--long|--multilevel|--reverse|--restricted|--unknown_strict|--version)
COMPREPLY=($(compgen -W '${_comp_sbobuilds}' -- "$cur"));
;;
-*)
COMPREPLY=($(compgen -W '${_comp_short_opts[*]}' -- "$cur"));
return;
;;
esac
case $cur in
--*)
COMPREPLY=($(compgen -W '${_comp_descriptions[*]}' -- "$cur"));
;;
-*)
COMPREPLY=($(compgen -W '${_comp_short_opts[*]}' -- "$cur"));
;;
*)
COMPREPLY=($(compgen -W '${_comp_sbobuilds}' -- "$cur"));
;;
esac
else
case $cur in
--*)
COMPREPLY=($(compgen -W '${_comp_descriptions[*]}' -- "$cur"));
;;
-*)
COMPREPLY=($(compgen -W '${_comp_short_opts[*]}' -- "$cur"));
;;
*)
COMPREPLY=($(compgen -W '${_comp_sbobuilds}' -- "$cur"));
;;
esac
fi

}
complete -F _hoorex hoorex

# ex:set ai shiftwidth=2 inputtab=spaces smarttab noautotab:
2 changes: 1 addition & 1 deletion completions/zsh/_hoorex
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if [ -f ~/.config/hoorex/defaults.cfg ]; then
# find out which SBO repo hoorex is configured for
sborepo="$(grep 'sbo_path' ~/.config/hoorex/defaults.cfg | cut -d= -f2 | xargs)"
# get the top level directories of repo (SBo groups, games, network, etc.)
sbogroups=( ${(uf)"$(find $sborepo -type d -mindepth 1 -maxdepth 1 -printf '%f\n')"} )
sbogroups=( ${(uf)"$(find $sborepo -not -path '*/\.*' -type d -mindepth 1 -maxdepth 1 -printf '%f\n')"} )
# hoorex also recognises the group "all"
sbogroups="${sbogroups} all"
# grab a listing of all slackbuilds (just use the directory names)
Expand Down
18 changes: 18 additions & 0 deletions hoorex → hoorex.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,24 @@
#
# ex:set ai shiftwidth=4 inputtab=spaces smarttab noautotab:

"""
Copyright (c) 2017-18 Christoph Willing, Brisbane Australia
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 3 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 (see LICENSE.md). If not,
see <http://www.gnu.org/licenses/>.
"""

from __future__ import print_function

import sys, os
Expand Down

0 comments on commit 3903081

Please sign in to comment.