Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 205118 - equery b file should return 1 if file not found to be used in scripts
Summary: equery b file should return 1 if file not found to be used in scripts
Status: RESOLVED DUPLICATE of bug 114086
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Tools (show other bugs)
Hardware: All Linux
: High enhancement (vote)
Assignee: Portage Tools Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-01-09 21:04 UTC by Maciej Piechotka
Modified: 2008-02-24 23:09 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
equery_false_if_no_results.patch (equery_false_if_no_results.patch,2.35 KB, patch)
2008-02-22 23:50 UTC, michael@smith-li.com
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Maciej Piechotka 2008-01-09 21:04:15 UTC
If equery b file would return non-zero return code if no package owning the file it can be used in scripts (for example in form if equery b file; then) and in interactive scripting. If it is not possible from interface reasons the special option (like --script) would be mostly welcome.

PS.
Such convention may be used in other tools.

Reproducible: Always
Comment 1 Andrew Gaffney (RETIRED) gentoo-dev 2008-01-09 21:24:48 UTC
What's wrong with:

[ "$(equery -q b ${file})" = "" ]
Comment 2 michael@smith-li.com 2008-02-22 23:50:38 UTC
Created attachment 144396 [details, diff]
equery_false_if_no_results.patch

(In reply to comment #1)
> What's wrong with:
> 
> [ "$(equery -q b ${file})" = "" ]

Well, that requires both a subshell and a call to test, which is more overhead than should be required. Furthermore it's generally verbose and error prone. (What if an overzealous dev decides to output "no results found" and forgets about the -q?)

Tracking whether or not we got results inside equery seems like a worthwhile step on the way to future enhancements anyway. Here's a patch against SVN revision 474
Comment 3 michael@smith-li.com 2008-02-22 23:54:45 UTC
I should've mentioned in comment #2 that that patch only applies to equery 'belongs' -- if you want me to apply it to other features, say so.

Furthermore it consolidates the dumpToScreen(pkg) and dumpToPipe(pkg) functions, because they were almost entirely the same.

Sorry for the bugspam.
Comment 4 michael@smith-li.com 2008-02-24 04:06:31 UTC
I think this bug is a dupe of 114086
Comment 5 Bo Ørsted Andresen (RETIRED) gentoo-dev 2008-02-24 23:09:48 UTC

*** This bug has been marked as a duplicate of bug 114086 ***