Skip to content

Commit

Permalink
add zypper-fsearch fast search tool
Browse files Browse the repository at this point in the history
this uses solv.idx files created from recent libzypp
  • Loading branch information
bmwiedemann committed May 27, 2015
1 parent 295342b commit c780dde
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ INSTALL(

# zypper-aptitude compat tool
INSTALL(
PROGRAMS tools/aptitude
PROGRAMS tools/aptitude tools/zypper-fsearch
DESTINATION ${INSTALL_PREFIX}/bin
)
INSTALL(
Expand Down
15 changes: 15 additions & 0 deletions tools/zypper-fsearch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/perl -w
use strict;

my $pattern=shift;
chdir("/var/cache/zypp/solv") or die;
my @idx=<*/solv.idx> or die "no solv.idx files";
open(my $pipe, "-|", "grep", "--with-filename", "--", $pattern, @idx) or die $!;

print "Name\t\tVersion\t\tArch\tRepository\n" if -t STDOUT;
while(<$pipe>) {
chop;
s{^([^/]+)/solv.idx:}{};
print "$_\t$1\n";
}

1 change: 1 addition & 0 deletions zypper.spec.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ rm -rf "$RPM_BUILD_ROOT"
%config(noreplace) %{_sysconfdir}/logrotate.d/zypp-refresh.lr
%{_sysconfdir}/bash_completion.d/zypper.sh
%{_bindir}/zypper
%{_bindir}/zypper-fsearch
%{_bindir}/yzpper
%{_bindir}/installation_sources
%{_sbindir}/zypp-refresh
Expand Down

0 comments on commit c780dde

Please sign in to comment.