First Last Prev Next    No search results available      Search page      Enter new bug
Bug#: 172240
Alias:
Product:
Component:
Status: RESOLVED
Resolution: FIXED
Assigned To: portage-utils <portage-utils@gentoo.org>
Hardware:
OS:
Version:
Priority:
Severity:
Reporter: TGL <tom.gl@free.fr>
Add CC:
CC:
Remove selected CCs
URL:
Summary:
Status Whiteboard:
Keywords:

Filename Description Type Creator Created Size Actions
qgrep-08_add_-A_and_-B_options.patch qgrep-08_add_-A_and_-B_options.patch patch TGL 2007-03-25 22:03 0000 11.96 KB Details | Diff
qgrep-context-names.diff qgrep-context-names.diff patch solar 2007-03-26 18:53 0000 2.16 KB Details | Diff
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 172240 depends on: 171374 Show dependency tree
Bug 172240 blocks:
Votes: 0    Show votes for this bug    Vote for this bug

Additional Comments: (this is where you put emerge --info)


Not eligible to see or edit group visibility for this bug.






View Bug Activity   |   Format For Printing   |   XML   |   Clone This Bug


Description:   Opened: 2007-03-25 22:02 0000
Here is a patch which adds --before-context/--after-context options to qgrep:
% ./qgrep -Evs -B2 -A1 myconf vim
eclass/vim.eclass-
eclass/vim.eclass-vim_src_compile() {
eclass/vim.eclass:      local myconf confrule
eclass/vim.eclass-
--
eclass/vim.eclass-      if [[ "${MY_PN}" == "vim-core" ]] ||
eclass/vim.eclass-                      ( [[ "${MY_PN}" == "vim" ]] && use
minimal ); then
eclass/vim.eclass:              myconf="--with-features=tiny \
eclass/vim.eclass-                      --enable-gui=no \
--
eclass/vim.eclass-              fi
eclass/vim.eclass-
eclass/vim.eclass:              myconf="--with-features=huge \
eclass/vim.eclass-                      --enable-multibyte"
eclass/vim.eclass:              myconf="${myconf} `use_enable cscope`"
eclass/vim.eclass:              myconf="${myconf} `use_enable gpm`"
eclass/vim.eclass:              myconf="${myconf} `use_enable perl perlinterp`"
eclass/vim.eclass:              myconf="${myconf} `use_enable python
pythoninterp`"
eclass/vim.eclass:              myconf="${myconf} `use_enable ruby rubyinterp`"
eclass/vim.eclass-              # tclinterp is broken; when you
--enable-tclinterp flag, then
--
<snip>

The patch applies on top of the 7 ones from bug #171374. It also adds various
comments in the code, since it was starting to get a bit complicated.

------- Comment #1 From TGL 2007-03-25 22:03:04 0000 -------
Created an attachment (id=114433) [edit]
qgrep-08_add_-A_and_-B_options.patch

------- Comment #2 From TGL 2007-03-25 22:19:30 0000 -------
Oh, and also this patch makes exit status being 0 when there was some matches,
and 1 when there was none. (That's actually because i was in need of such a
status variable in the code, and then i've thought it might be useful to return
it.)

------- Comment #3 From solar 2007-03-26 16:20:32 0000 -------
solar@onyx /var/cvsroot/gentoo-projects/portage-utils $ cvs ci -m '- This
commit adds -A/-B options for qgrep (context lines) from TGL bug 172240' 
...
/var/cvsroot/gentoo-projects/portage-utils/qgrep.c,v  <--  qgrep.c
new revision: 1.19; previous revision: 1.18

------- Comment #4 From solar 2007-03-26 18:46:02 0000 -------
The long options names are a little to long and mess up the display.

Options: -[IiHNclLexEsS:B:A:vqChV]
  -I, --invert-match   * Select non-matching lines
  -i, --ignore-case    * Ignore case distinctions
  -H, --with-filename  * Print the filename for each match
  -N, --with-name      * Print the package or eclass name for each match
  -c, --count          * Only print a count of matching lines per FILE
  -l, --list           * Only print FILE names containing matches
  -L, --invert-list    * Only print FILE names containing no match
  -e, --regexp         * Use PATTERN as a regular expression
  -x, --extended       * Use PATTERN as an extended regular expression
  -E, --eclass         * Search in eclasses instead of ebuilds
  -s, --skip-comments  * Skip comments lines
  -S, --skip     <arg> * Skip lines matching <arg>
  -B, --before-context <arg> * Print <arg> lines of leading context
  -A, --after-context <arg> * Print <arg> lines of trailing context
  -v, --verbose        * Make a lot of noise
  -q, --quiet          * Tighter output; suppress warnings
  -C, --nocolor        * Don't output color
  -h, --help           * Print this help and exit
  -V, --version        * Print version and exit

-----------------------------------------

How about we shorten them to --before/--after ? Granted we can make the
alignments wider but I'd like to keep the display short and to the point when
using a console size of 23 79

------- Comment #5 From solar 2007-03-26 18:53:03 0000 -------
Created an attachment (id=114536) [edit]
qgrep-context-names.diff

Shortened names. (pending your input). After this it's probably about time for
us to push a new portage-utils to the tree.

------- Comment #6 From TGL 2007-03-26 20:03:38 0000 -------
(In reply to comment #4)
> 
> How about we shorten them to --before/--after ?

Yup, sure, go ahead.  Your patch looks good (and i've checked it was
exhaustive).

(In reply to comment #5)
> 
> After this it's probably about time for us to push a new
> portage-utils to the tree.

Can you wait just a sec?  I have one more patch ready, for which i was about to
open a new report.  It adds an option for grepping in the ebuilds stored in
VDB. 
(And then there will still be colorized output left on my TODO, but for this
one i will have to find more time, so don't hold your breath or release.)

------- Comment #7 From solar 2007-03-26 21:13:24 0000 -------
(In reply to comment #5)
> Created an attachment (id=114536) [edit]
> qgrep-context-names.diff
> 
> Shortened names. (pending your input). After this it's probably about time for
> us to push a new portage-utils to the tree.


/var/cvsroot/gentoo-projects/portage-utils/qgrep.c,v  <--  qgrep.c
new revision: 1.20; previous revision: 1.19

------- Comment #8 From solar 2007-04-05 18:42:20 0000 -------
This is released in 0.1.25

Bug #168334 ; q -r dies with a segfault after emerge --sync
Bug #168442 ; does not  properly parse the profile location
Bug #170795 ; add a -E/--eclass option to qgrep
Bug #170797 ; add a -s/--skip-comments option to qgrep
Bug #171024 ; opening '/usr/portage/.metadata.x' failed
Bug #171374 ; Misc enhancements for qgrep
Bug #172240 ; -A/-B options for qgrep (context lines) 
Bug #172338 ; qgrepping through installed ebuilds (in the VDB) 
Bug #173005 ; Colorized output for qgrep.

------- Comment #9 From solar 2007-04-05 18:43:06 0000 -------
Closing

First Last Prev Next    No search results available      Search page      Enter new bug