Skip to content

Commit

Permalink
Add -R (Restricted) option
Browse files Browse the repository at this point in the history
  • Loading branch information
Christoph Willing committed Jan 30, 2016
1 parent 66d2bd8 commit 6694320
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
12 changes: 11 additions & 1 deletion hoorex
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ def main():
parser.add_argument("-r", "--reverse", action="store_true", dest="reverse_lookup",
default=default_config.getboolean('HooRex', 'reverse_lookup'),
help="show build dependencies for target package(s)")
parser.add_argument("-R", "--restricted", action="store_true", dest="output_only_input",
default=False,
help="show only packages from the input list")
parser.add_argument('-s', '--slackbuilds', dest='sbo_path', action='store',
help="set the full filesystem path to the local slackbuilds \
repository e.g. -s /home/jerry/slackbuilds")
Expand Down Expand Up @@ -256,14 +259,21 @@ def main():
if PkgRequires.has_key(prereq):
raw_output.append(prereq)
# Filter the list, if necessary
if args.output_installed or args.output_strictly_installed:
sorted_output = []
if args.output_only_input:
# -R option given
sorted_output = sort_output([name for name in targets if name in set(raw_output)], PkgRequires)
elif args.output_installed or args.output_strictly_installed:
repo_path = default_config.get('HooRex', 'slackware_repo')
if args.output_strictly_installed:
# -I option
all_installed = ['-'.join(pkgname.split('-')[:-3]) for pkgname in os.listdir(repo_path)]
else:
# -i option
all_installed = set(targets + ['-'.join(pkgname.split('-')[:-3]) for pkgname in os.listdir(repo_path)])
sorted_output = sort_output([name for name in all_installed if name in set(raw_output)], PkgRequires)
else:
# No filter on output
sorted_output = sort_output(list(set(raw_output)), PkgRequires)

# OUTPUT
Expand Down
3 changes: 3 additions & 0 deletions hoorex.1.in
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ OPTIONS
determining which other packages require the target package(s),
calculate which packages are required to build the target package(s).

*-R, --restricted*::
*Restrict* the output list to those packages named in the input list.

*-s, --slackbuilds* 'SBO_DIRECTORY'::
Specify full path to the *slackbuilds* directory containing
the full SlackBuilds.org repository tree.
Expand Down

0 comments on commit 6694320

Please sign in to comment.