Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 15771 - qpkg One oversight (bug) resulting in increased work/slow speed + one performance fix to qpkg
Summary: qpkg One oversight (bug) resulting in increased work/slow speed + one perform...
Status: RESOLVED WONTFIX
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Tools (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Portage Tools Team
URL: http://forums.gentoo.org/viewtopic.ph...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-02-16 03:32 UTC by Josh Goebel
Modified: 2004-08-21 13:43 UTC (History)
3 users (show)

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


Attachments
Diff between slighly patched qpkg and original (qpkg.diff,1.24 KB, patch)
2003-05-05 11:25 UTC, Josh Goebel
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Josh Goebel 2003-02-16 03:32:39 UTC
Sorry if this is messy, but I would have just included a diff but i've made ALL
sorts of changes/improvements to my qpkg.  These are just the ones that I think
it would be easy to agree on.

Here's what I think is the bug inside the dup checking code.
---- START CODE ----
#Next get all the exact versions
duppak=`cat /tmp/qpkg.lst | fgrep "${dups}"`

#Now cut that down to the directory name so we can be smart
# !! fixing bug to keep from bring ALL the packages back in
# !! again when we just went through the trouble to filter them above
#  dirs=`sed -e 's:/[^/]*$::' /tmp/qpkg.lst`
dirs=`echo ${duppak} " " | sed -e "s:/[^/ ]* : :g"`
---- STOP CODE ----
And here is my speed increase (tested with no probs on x86).  It's way faster to
use BASH's string manipulation inside the loop than call both sed and dirname.
---- START CODE ----
#	n=`echo $p | sed -e "s:^/var/db/pkg/${X}/${X}/${X}.ebuild:iii \1/\3:" \
#		-e "s:^/usr/portage/${X}/${X}/${X}\.ebuild:uuu \1/\3:"`
#	accomplishes the same as the above sed command except
#  bash parameter completetion is used to eliminate external calls
n=${p%.ebuild}
var_db_pkg="/var/db/pkg/"
n=${n/${var_db_pkg}/iii }
usr_portage="/usr/portage/"
n=${n/${usr_portage}/uuu }
n=${n/\/*\//\/}

...

d=${p%\/*.ebuild} # faster d=`dirname ${p}`
---- STOP CODE ----

Reproducible: Always
Steps to Reproduce:
For first bug: any time qpkg is run in duplication checking mode will see a speed up
For second speed increase: any parameters that utilize the for that loops
through packages will see a speed up


Actual Results:  
Slower speed that we could have, though always correct info.

Expected Results:  
Faster speed.
Comment 1 Josh Goebel 2003-02-16 03:35:02 UTC
In the code I pasted I had your original code commented out and my code uncommented...
Comment 2 Josh Goebel 2003-02-16 04:01:09 UTC
See http://forums.gentoo.org/viewtopic.php?p=132434#132434 for some additional details and the full extent of my improvements/modifications with a write-up.
Comment 3 Brandon Low (RETIRED) gentoo-dev 2003-04-19 11:26:20 UTC
You've made other local enhancements to qpkg you say?  Do share!  I would love it if you posted a complete diff, I can pick and choose hunks, and test locally before committing to gentoolkit.

Of course please make the diff based on the latest qpkg at /usr/portage/app-admin/gentoolkit/files/scripts/

Thanks for your help!

(Sorry it's been so long on this, I'm a lamer.)
Comment 4 Josh Goebel 2003-04-20 22:05:27 UTC
Way busier now than I was back then :( though when I have a second I will glance over the latest code and see if my two biggest _simple_ improvements are still valid and will send you a diff.
Comment 5 Josh Goebel 2003-05-05 11:25:09 UTC
Created attachment 11528 [details, diff]
Diff between slighly patched qpkg and original

*CHANGES*
Fixes qpkg db pulling in every package because grep matches /var/"db"/pkg...

Speedups by no longer calling dirname and sed inside the main loop...
Try "oldqpkg -v" compared to "newqpkg -v"... this speed up is only apparent
with large lists... not just with one or two items shown...

Drop from main loops sooner if no params are passed...
Comment 6 Josh Goebel 2003-05-05 11:29:49 UTC
The qpkg I still use (modified) has caching build in as well as other features like -du (disk usage), -cl (changelog), etc... I can upload the whole thing if your interested but I don't have time to port all my changes to the latest version.  Honestly qpkg seems to have changed only slightly anyways since I made my changes... a diff of my changed version vs the latest wasn't SUPER off... mostly typos and spacing corrections and stuff...

Let me know.
Comment 7 Brandon Low (RETIRED) gentoo-dev 2003-05-31 23:06:52 UTC
Please do upload your whole file, and I'll try to forward port any other changes and get it into the next gentoolkit version, thanks.  Look around bugzilla, I think someone is working on a python replacement for gentoolkit you might be interested in working on it.

later
Comment 8 Martin Holzer (RETIRED) gentoo-dev 2003-09-09 14:42:00 UTC
one more qpkg bug
Comment 9 Marius Mauch (RETIRED) gentoo-dev 2004-08-21 13:43:46 UTC
this tool is deprecated