[zypp-devel] [PATCH 2/2] Support searching file with full path
This patch enable zypper searching file with full path, which is the function as 'yum provides'. --- src/Zypper.cc | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/src/Zypper.cc b/src/Zypper.cc index a43ec47..1bb5608 100644 --- a/src/Zypper.cc +++ b/src/Zypper.cc @@ -1795,6 +1795,7 @@ void Zypper::processCommandOptions() {"match-words", no_argument, 0, 0}, {"match-exact", no_argument, 0, 0}, {"search-descriptions", no_argument, 0, 'd'}, + {"search-file", no_argument, 0, 'f'}, {"case-sensitive", no_argument, 0, 'C'}, {"type", required_argument, 0, 't'}, {"sort-by-name", no_argument, 0, 0}, @@ -1821,6 +1822,7 @@ void Zypper::processCommandOptions() " --match-words Search for a match to whole words only.\n" " --match-exact Searches for an exact package name.\n" "-d, --search-descriptions Search also in package summaries and descriptions.\n" + "-f, --search-file Search also in package file list.\n" "-C, --case-sensitive Perform case-sensitive search.\n" "-i, --installed-only Show only packages that are already installed.\n" "-u, --uninstalled-only Show only packages that are not currently installed.\n" @@ -2390,6 +2392,7 @@ void Zypper::processCommandOptions() {"match-words", no_argument, 0, 0}, {"match-exact", no_argument, 0, 0}, {"search-descriptions", no_argument, 0, 'd'}, + {"search-file", no_argument, 0, 'f'}, {"case-sensitive", no_argument, 0, 'C'}, {"sort-by-name", no_argument, 0, 0}, {"sort-by-catalog", no_argument, 0, 0}, @@ -3653,6 +3656,12 @@ void Zypper::doCommand() query.addAttribute(sat::SolvAttr::summary); query.addAttribute(sat::SolvAttr::description); } + if (cOpts().count("search-file")) + { + query.addAttribute(sat::SolvAttr::filelist); + query.setFilesMatchFullPath(true); + query.setMatchExact(); + } init_target(*this); -- 1.7.2.2 -- To unsubscribe, e-mail: zypp-devel+unsubscribe@opensuse.org For additional commands, e-mail: zypp-devel+help@opensuse.org
On Fri, Dec 10, 2010 at 01:06:13PM +0800, Zhang Qiang wrote:
This patch enable zypper searching file with full path, which is the function as 'yum provides'. [...] {"search-descriptions", no_argument, 0, 'd'}, + {"search-file", no_argument, 0, 'f'}, {"case-sensitive", no_argument, 0, 'C'},
Do we really need an extra option for this? If it starts with a '/' it's obviously a file. Cheers, Michael. -- Michael Schroeder mls@suse.de SUSE LINUX Products GmbH, GF Markus Rex, HRB 16746 AG Nuernberg main(_){while(_=~getchar())putchar(~_-1/(~(_|32)/13*2-11)*13);} -- To unsubscribe, e-mail: zypp-devel+unsubscribe@opensuse.org For additional commands, e-mail: zypp-devel+help@opensuse.org
On 12/10/2010 10:53 AM, Michael Schroeder wrote:
On Fri, Dec 10, 2010 at 01:06:13PM +0800, Zhang Qiang wrote:
This patch enable zypper searching file with full path, which is the function as 'yum provides'. [...] {"search-descriptions", no_argument, 0, 'd'}, + {"search-file", no_argument, 0, 'f'}, {"case-sensitive", no_argument, 0, 'C'},
Do we really need an extra option for this? If it starts with a '/' it's obviously a file.
Cheers, Michael.
Agreed, I don't see the need for an extra option -- Duncan Mac-Vicar P. - Novell® Making IT Work As One™ SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nuernberg) -- To unsubscribe, e-mail: zypp-devel+unsubscribe@opensuse.org For additional commands, e-mail: zypp-devel+help@opensuse.org
Thanks for your comments, attached is the new patch. Please review. Thanks Qiang -----Original Message----- From: Duncan Mac-Vicar P. [mailto:dmacvicar@suse.de] Sent: Monday, December 13, 2010 5:41 PM To: Michael Schroeder Cc: Zhang, Qiang Z; jkupec@suse.cz; zypp-devel@opensuse.org Subject: Re: [zypp-devel] [PATCH 2/2] Support searching file with full path On 12/10/2010 10:53 AM, Michael Schroeder wrote:
On Fri, Dec 10, 2010 at 01:06:13PM +0800, Zhang Qiang wrote:
This patch enable zypper searching file with full path, which is the function as 'yum provides'. [...] {"search-descriptions", no_argument, 0, 'd'}, + {"search-file", no_argument, 0, 'f'}, {"case-sensitive", no_argument, 0, 'C'},
Do we really need an extra option for this? If it starts with a '/' it's obviously a file.
Cheers, Michael.
Agreed, I don't see the need for an extra option -- Duncan Mac-Vicar P. - Novell(r) Making IT Work As One(tm) SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nuernberg)
participants (4)
-
Duncan Mac-Vicar P.
-
Michael Schroeder
-
Zhang Qiang
-
Zhang, Qiang Z