Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 103457 Details for
Bug 157103
[PATCH - NEW FEATURE] app-portage/genlop - show compile times for not yet installed packages
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
new version of patch with bug fixes, 2nd try
genlop.diff (text/plain), 5.09 KB, created by
Sascha Nitsch
on 2006-12-06 08:38:42 UTC
(
hide
)
Description:
new version of patch with bug fixes, 2nd try
Filename:
MIME Type:
Creator:
Sascha Nitsch
Created:
2006-12-06 08:38:42 UTC
Size:
5.09 KB
patch
obsolete
>--- genlop.org 2005-08-17 13:40:33.000000000 +0200 >+++ genlop 2006-12-06 17:32:47.929903552 +0100 >@@ -23,6 +23,7 @@ > use POSIX; > use Term::ANSIColor; > use Date::Manip; >+use LWP::Simple; > > my $version = "0.30.4"; > my @logfiles = ("/var/log/emerge.log"); >@@ -37,7 +38,7 @@ > $search_found, $unmerge_found, $list_found, $file_found, > $time_found, $help_found, $current_found, $pretend_found, > $version_found, $info_found, $gmt_found, $rsync_found, >- $info_ok, $info_target, $ssearch_found >+ $info_ok, $info_target, $ssearch_found, $lhtomsg > ); > # variabili globali del programma > my ($e_start, $e_end, $search_string, $m_count, $ebuild_found); >@@ -216,6 +217,7 @@ > $unmerge_found = 1, last SSWITCH if ($opt eq "u"); > $ENV{'ANSI_COLORS_DISABLED'} = 1, last SSWITCH if ($opt eq "n"); > $list_found = 1, last SSWITCH if ($opt eq "l"); >+ $online_query = 1, last SSWITCH if ($opt eq "q"); > $search_found = 1, last SSWITCH if ($opt eq "s"); > $version_found = 1, last SSWITCH if ($opt eq "v"); > $info_found = 1, last SSWITCH if ($opt eq "i"); >@@ -291,6 +293,8 @@ > colored(" -n ", $COLORS{'green'}), "no color in output\n", > colored(" -p ", $COLORS{'green'}), > "estimate build time from a piped \"emerge -p\" output\n", >+ colored(" -q ", $COLORS{'green'}), >+ "query gentoo.linuxhowtos.org database if no local emerge was found\n", > colored(" -r ", $COLORS{'green'}), > "search for portage tree sync/rsync history.\n", > colored(" -s ", $COLORS{'green'}), >@@ -418,6 +422,49 @@ > return "$regexp"; > } > >+sub lhtoquery($$) >+{ >+ my $vcpu=0,$pcpu=0,$opcpu=-1; >+ my $modelname=""; >+ $packet=shift(@_); >+ $countref=shift(@_); >+ open(my $cmdline, "/proc/cpuinfo"); >+ while (<$cmdline>) { >+ if (m/processor\s*:\s*(\d*)/) >+ { >+ $vcpu=$1 if ($1>$vcpu); >+ } >+ if (m/model name\s*:\s*(.*)$/) >+ { >+ $modelname=$1; >+ } >+ if (m/cache size\s*:\s*(.*)$/) >+ { >+ $cachesize=$1; >+ } >+ if (m/physical id\s*:\s*(\d*)$/) >+ { >+ $pcpu++ if ($1!=$opcpu); >+ $opcpu=$1; >+ } >+ } >+ $vcpu++; >+ $pcpu=1 if ($pcpu==0); >+ $cpuname=$pcpu."x $modelname $cachesize"; >+ $cpuname=~ s/ /%20/g; >+ $retval=LWP::Simple::get("http://gentoo.linuxhowtos.org/query.php?cpuname=$cpuname&vcpu=$vcpu&packetname=$packet"); >+ if ($retval =~ m/estimate: (\d*) seconds/) >+ { >+ $$countref=1; >+ return $1; >+ } >+ if ($retval =~ /unknown cpu/) >+ { >+ $lhtomsg="Your CPU is not yet known, please add it by following the instructions on http://gentoo.linuxhowtos.org/compiletimeestimator/"; >+ } >+ return 0; >+} >+ > # --pretend or -p takes an emerge -p `-e -D world, system`, anything you want > # and elaborates its output. for each package is calculated the average build > # time and summed together. this is the estimated merge time >@@ -453,6 +500,13 @@ > } > } > if ($e_count == 0) { >+ if ($online_query) >+ { >+ #query gentoo.linuxhowtos.org >+ $tm_secondi+=lhtoquery($last_ebuild,\$e_count); >+ } >+ } >+ if ($e_count == 0) { > $ebuild_arg =~ s/\\//g; > print "\n!!! Error: couldn't get previous ", > "merge of $ebuild_arg; skipping..."; >@@ -475,6 +529,13 @@ > "estimated time unknown."; > print color 'reset'; > print "\n"; >+ if ($lhtomsg) >+ { >+ print color 'bold yellow'; >+ print "$lhtomsg\n"; >+ print color 'reset'; >+ } >+ > exit; > } > print "\n\nEstimated update time: "; >@@ -555,6 +616,12 @@ > $current_found = 1; > print "\n"; > print " ETA: "; >+ if (!$e_count &&$online_query) >+ { >+ #query gentoo.linuxhowtos.org >+ $tm_secondi=lhtoquery($ebuild_arg,\$e_count); >+ $e_count=1; >+ } > > if ($e_count && $e_start) { > >ime(($tm_secondi / $e_count) - ($e_end - $e_start)); >@@ -832,9 +899,23 @@ > } > } > if (!$e_count and !$list_found and !$rsync_found) { >- print color 'bold red'; >- print "!!! Error: no merge found for \'$ebuild_arg\'"; >- print color 'reset'; >+ if ($e_count == 0) { >+ if ($online_query) { >+ #query gentoo.linuxhowtos.org >+ $tm_secondi+=lhtoquery($ebuild_arg,\$e_count); >+ } >+ } >+ if ($e_count >0) { >+ print "Estimated merge time: "; >+ >ime($tm_secondi); >+ &print_gtime(); >+ } >+ else >+ { >+ print color 'bold red'; >+ print "!!! Error: no merge found for \'$ebuild_arg\'"; >+ print color 'reset'; >+ } > print "\n"; > } elsif ($info_found) { > &info($info_target); >@@ -842,4 +923,11 @@ > $e_count = 0; > } > } >+if ($lhtomsg) >+{ >+ print color 'bold yellow'; >+ print "$lhtomsg\n"; >+ print color 'reset'; >+} >+ >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 157103
:
103329
|
103456
| 103457