Unifix knowledge database - The original one

Dashboard - News - Search - List - About - Admin


Watch emerge progress

Author:ino - Mon Nov 29 20:37:23 2004

Introduction

From Gentoo Forums: http://forums.gentoo.org/viewtopic.php?t=139562

It is possible to get approximate measures of how far emerge has compiled chosen package. The method used is based on file count (compiled/total).
[edit]
Making the Script

Create file /usr/bin/emerge-progress and paste in it following lines (based on the current emerge log format):


File: emerge-progress

#!/bin/sh
FULL=`tail -n 2 /var/log/emerge.log | grep Compiling | sed "s/\(.*\)Compiling\/Packaging \(.*\)::.*/\2/" | sed \
"s/(\([a-zA-Z].*\)\/\(.*\)/\1\/\2/"`
CUR=`echo $FULL | sed "s/\(.*\)\/\(.*\)/\2/"`
TOT=`find /var/tmp/portage/$CUR -iname "*.c*" | wc -l`
PROG=`find /var/tmp/portage/$CUR -iname "*.o*" | wc -l`
PRE_PER=`echo $PROG $TOT | gawk '{ sum += $1 / $2 }; END { print sum }' -`
PER=`echo $PRE_PER | gawk '{ sum += $1 * 100 }; END { print sum }' -`
echo "Currently Compiling Package: " $FULL " ("$PER"%)" 


The same for the older emerge log format ("Packaging" -> "Merging"). Choose this if the above doesn't work for you:
File: alternative emerge-progress

#!/bin/sh
FULL=`tail -n 2 /var/log/emerge.log | grep Compiling | sed "s/\(.*\)Compiling\/Merging \(.*\)::.*/\2/" | sed \
"s/(\([a-zA-Z].*\)\/\(.*\)/\1\/\2/"`
CUR=`echo $FULL | sed "s/\(.*\)\/\(.*\)/\2/"`
TOT=`find /var/tmp/portage/$CUR -iname "*.c*" | wc -l`
PROG=`find /var/tmp/portage/$CUR -iname "*.o*" | wc -l`
PRE_PER=`echo $PROG $TOT | gawk '{ sum += $1 / $2 }; END { print sum }' -`
PER=`echo $PRE_PER | gawk '{ sum += $1 * 100 }; END { print sum }' -`
echo "Currently Compiling Package: " $FULL " ("$PER"%)" 


Then make it executable:
$ chmod +x /usr/bin/emerge-progress
[edit]
Running the Script

After that you can watch progress in %, by executing following command:
$ watch -n 5 --no-title emerge-progress

-n 5 sets refresh interval to 5 seconds
--no-title removes title


If you have osd_cat (emerge xosd), you can do this:
$ emerge-progress

Set that to a hotkey in your WM, and you have an OSD emerge progress hotkey :) 
Copyright(c) Unifix.org 2002-2011


Dashboard - News - Search - List - About - Admin
 
Powered by Mikjaer Consulting Solutions - Hosted by Specialhosting.dk