Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
little script for displaying the emerge status...
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
mortus
n00b
n00b


Joined: 28 Nov 2003
Posts: 21
Location: Austria

PostPosted: Tue Jul 27, 2004 3:02 pm    Post subject: little script for displaying the emerge status... Reply with quote

...just play'in around with genlop... :wink:

Code:

#!/bin/bash
# tiny little script which shows you the status of emerge
#
clear
echo 'Show whats going on:'
echo '--------------------'
echo 'last 10 emerges...'
echo ''
genlop -l | tail -n 11
echo '--------------------'
echo 'emerging now...'
genlop --current
PKGNOW=`genlop --current | grep "*" | cut -d " " -f 3`
PKGREADY=`echo "[ebuild] $PKGNOW" | genlop --pretend | grep "Estimated"`
echo "    $PKGREADY"
echo '--------------------'
exit 0

_________________
Regular Matter, Dark Matter, Wassa Matter...
Back to top
View user's profile Send private message
GentooBox
Veteran
Veteran


Joined: 22 Jun 2003
Posts: 1168
Location: Denmark

PostPosted: Tue Jul 27, 2004 7:22 pm    Post subject: Reply with quote

just a note:

genlop -c or genlop --current dont work on AMD64 for some reason.
_________________
Encrypt, lock up everything and duct tape the rest
Back to top
View user's profile Send private message
AgenT
Apprentice
Apprentice


Joined: 18 May 2003
Posts: 280

PostPosted: Wed Jul 28, 2004 7:23 pm    Post subject: Reply with quote

Thanks, small but useful :)
Back to top
View user's profile Send private message
mil0t
n00b
n00b


Joined: 24 Jun 2003
Posts: 62

PostPosted: Tue Dec 20, 2005 8:12 pm    Post subject: Reply with quote

Here i wrote in python similar to mortus.

Code:

#!/usr/bin/python
##############################################
# Gentoo emerge status              #   
# This script requires genlop,           #   
# you can install it using `emerge genlop`.  #
# Milot Shala <milot@mymyah.com>        #
##############################################

import sys
import os
import time

#colors
color={}
color["r"]="\x1b[31;01m"
color["g"]="\x1b[32;01m"
color["b"]="\x1b[34;01m"
color["0"]="\x1b[0m"


def r(txt):
   return color["r"]+txt+color["0"]
def g(txt):
   return color["g"]+txt+color["0"]
def b(txt):
   return color["b"]+txt+color["0"]

# View Options
def view_opt():   
         
   print
   print
   print g("full-info - View full information for emerged package")
   print g("cur - View current emerge")
   print g("hist - View history of emerged packages by day")
   print g("hist-all - View full list of history of emerged packages")
   print g("rsync - View rsync history")
   print g("time - View time for compiling a package")
   print g("time-unmerged - View time of unmerged packages")
   print
   command = raw_input(r("Press Enter to return to main "))
   if command == '':
      c()
      program()
   else:
      c()
      program()

# system command 'clear'
def c():
   os.system('clear')


# Base program
def program():
   c()
   print g("Gentoo emerge status script")
   print ("---------------------------")
   print

   print ("1]") + g(" Enter options")
   print ("2]") + g(" View options")
   print ("3]") + g(" Exit")
   print
   command = input("[]> ")


   if command == 1:   
      print
      print r("""First of all  you must view options to know what to use, you can enter option name ( if you know any ) or type `view-opt` to view options.""")
      print
      time.sleep(2)
      command = raw_input(b("Option name: "))
      if (command == 'view-opt' or command == 'VIEW-OPT'):
         view_opt()


      elif command == 'full-info':
         c()
         print g("Full information for a single package")
         print ("-------------------------------------")
         print
         print b("Enter package name")
         command=raw_input("> ")
         c()
         print g("Full information for package"), b(command)
         print ("-----------------------------------")
         print
         pack=['genlop -i '+command]
         pack_=" ".join(pack)
         os.system(pack_)
         print
         print r("Press Enter to return to main.")
         command=raw_input()
         if command == '':
            c()
            program()

         else:
            c()
            program()


      elif command == 'cur':
         if command == 'cur':
            c()
            print g("Current emerge session(s)")
            print ("-------------------------")
            print
            print b("Listing current emerge session(s)")
            print
            time.sleep(1)
            os.system('genlop -c')
            print
            print r("Press Enter to return to main.")
            command = raw_input()
            if (command == ''):
               c()
               program()

            else:
               c()
               program()

            
      elif command == 'hist':
         if command == 'hist':
            c()
            print g("History of merged packages")
            print ("---------------------------")
            print
            time.sleep(1)
            print b("Enter number of how many days ago you want to see the packages")
            command = raw_input("> ")
            c()
            print g("Packages merged "+b(command)+ g(" day(s) before"))
            print ("------------------------------------")
            pkg=['genlop --list --date '+command+' days ago']
            pkg_=" ".join(pkg)
            os.system(pkg_)
            print
            print r("Press Enter to return to main.")
            command = raw_input()
            if command == '':
               c()
               program()

            else:
               c()
               program()


      elif command == 'hist-all':
            c()
            print g("Full history of merged individual packages")
            print ("--------------------------------------")
            print
            print b("Do you want to view individual package?")
            print r("YES/NO?")
            command = raw_input("> ")
            print
            if (command == 'yes' or command == 'YES'):
               print g("Enter package name")
               command = raw_input("> ")
               print
               pkg=['genlop -l | grep '+command+ ' | less']
               pkg_=" ".join(pkg)
               os.system(pkg_)
               print
               print r("Press Enter to return to main")
               command = raw_input()
               if command == '':
                  c()
                  program()
               else:
                  c()
                  program()
            
            elif (command == 'no' or command == 'NO'):
               pkg=['genlop -l | less']
               pkg_=" ".join(pkg)
               os.system(pkg_)
               print
               print r("Press Enter to return to main")
               command = raw_input()
               if command == '':
                  c()
                  program()
      
               else:
                  c()
                  program()

            else:
               c()
               program()
      

      elif command == 'rsync':
         print g("RSYNC updates")
         print
         print
         print
         print b("You can view rsynced time by year!")
         print r("Do you want this script to do it for you? (yes/no)")
         command = raw_input("> ")
         if (command == 'yes' or command == 'YES'):
            print
            print g("Enter year i.e"), b("2005")
            print
            command = raw_input("> ")
            rsync=['genlop -r | grep '+command+' | less']
            rsync_=" ".join(rsync)
            os.system(rsync_)
            print
            print r("Press Enter to return to main.")
            c()
            program()
         elif (command == 'no' or command == 'NO'):
            os.system('genlop -r | less')
            print
            print r("Press Enter to return to main.")
            command = raw_input()
            if command == '':
               c()
               program()
      
            else:
               c()
               program()
            
      elif command == 'time':
         c()
         print g("Time of package compilation")
         print ("---------------------------")
         print
         print

         print b("Enter package name")
         pkg_name = raw_input("> ")
         pkg=['emerge '+pkg_name+' -p | genlop -p | less']
         pkg_=" ".join(pkg)
         os.system(pkg_)
         print
         print r("Press Enter to return to main")
         time.sleep(2)
         command = raw_input()
         if command == '':
            c()
            program()
      
         else:
            c()
            program()


      elif command == 'time-unmerged':
         c()
         print g("Show when package(s) is/when is unmerged")
         print ("----------------------------------------")
         print
         
         print b("Enter package name: ")
         name = raw_input("> ")
         pkg=['genlop -u '+name]
         pkg_=" ".join(pkg)
         os.system(pkg_)
         print
         print r("Press Enter to return to main")
         time.sleep(2)
         command = raw_input()
         if command == '':
            c()
            program()
         
         else:
            c()
            program()

      else:
         print
         print r("Wrong Selection!")
         time.sleep(2)
         c()
         program()
         

   elif command == 2:
      view_opt()
      command = raw_input(r("Press Enter to return to main "))
      if command == '':
         c()
         program()
      else:
         c()
         program()


   elif command == 3:
      print
      print b("Thank you for using this script")
      print
      time.sleep(1)
      sys.exit()

   else:
      print
      print r("Wrong Selection!")
      time.sleep(2)
      c()
      program()
      command = ("")
   

program()




It's copyleft-ed :P
_________________
emerge --pretend love | genlop --pretend
Back to top
View user's profile Send private message
LoSeR_5150
Guru
Guru


Joined: 20 Mar 2005
Posts: 455
Location: San Francisco, CA

PostPosted: Tue Dec 20, 2005 9:01 pm    Post subject: Reply with quote

i use the amd64 acrh and it is true genlop-0-.30.3 doesnt execute genlop -c correctly, says no working merge found... however the unstable genlop-0.30.5 works perfectly...
_________________
Opteron 1356@2.4Ghz
6GB DDR2 800Mhz
128MB Quadro NVS 210S
640GB Western Digital HD
*Gentoo-x86_64-2.6.30-r1

Opteron175@2.2GHz
2GB DDR 400MHz
256MB Quadro 1400 Go
(2) 80GB Segate HDs: RAID0
*Gentoo-x86_64-2.6.30-r1
Back to top
View user's profile Send private message
thoffmeyer
Apprentice
Apprentice


Joined: 11 Apr 2004
Posts: 208
Location: GMT -5 Hours

PostPosted: Fri Dec 23, 2005 3:06 am    Post subject: Reply with quote

Nice scripts :)
_________________
Conrad Guide, Current Maintainer

Join us on IRC
Server: irc.freenode.net
Channel: #conrad
Back to top
View user's profile Send private message
redhook
n00b
n00b


Joined: 24 Jan 2005
Posts: 18

PostPosted: Fri Dec 23, 2005 12:04 pm    Post subject: Reply with quote

mil0t wrote:
Here i wrote in python similar to mortus.


I get this error when I run the script

Code:

hatori ~ # ./genstat.py
  File "./genstat.py", line 219
    elif (command Selection!")
                          ^
SyntaxError: invalid syntax
Back to top
View user's profile Send private message
mil0t
n00b
n00b


Joined: 24 Jun 2003
Posts: 62

PostPosted: Fri Dec 23, 2005 3:32 pm    Post subject: Reply with quote

redhook wrote:
mil0t wrote:
Here i wrote in python similar to mortus.


I get this error when I run the script

Code:

hatori ~ # ./genstat.py
  File "./genstat.py", line 219
    elif (command Selection!")
                          ^
SyntaxError: invalid syntax


It has some problems while i copied and paste it here, i uploaded the script and you can get it here:
http://milot.albanianit.org/genstat.py


the script works here on my computer (watch below):

Code:

root@monsterpenguin milot # python -v genstat.py
# installing zipimport hook
import zipimport # builtin
# installed zipimport hook
# /usr/lib/python2.4/site.pyc matches /usr/lib/python2.4/site.py
import site # precompiled from /usr/lib/python2.4/site.pyc
# /usr/lib/python2.4/os.pyc matches /usr/lib/python2.4/os.py
import os # precompiled from /usr/lib/python2.4/os.pyc
import posix # builtin
# /usr/lib/python2.4/posixpath.pyc matches /usr/lib/python2.4/posixpath.py
import posixpath # precompiled from /usr/lib/python2.4/posixpath.pyc
# /usr/lib/python2.4/stat.pyc matches /usr/lib/python2.4/stat.py
import stat # precompiled from /usr/lib/python2.4/stat.pyc
# /usr/lib/python2.4/UserDict.pyc matches /usr/lib/python2.4/UserDict.py
import UserDict # precompiled from /usr/lib/python2.4/UserDict.pyc
# /usr/lib/python2.4/copy_reg.pyc matches /usr/lib/python2.4/copy_reg.py
import copy_reg # precompiled from /usr/lib/python2.4/copy_reg.pyc
# /usr/lib/python2.4/types.pyc matches /usr/lib/python2.4/types.py
import types # precompiled from /usr/lib/python2.4/types.pyc
# /usr/lib/python2.4/warnings.pyc matches /usr/lib/python2.4/warnings.py
import warnings # precompiled from /usr/lib/python2.4/warnings.pyc
# /usr/lib/python2.4/linecache.pyc matches /usr/lib/python2.4/linecache.py
import linecache # precompiled from /usr/lib/python2.4/linecache.pyc
import encodings # directory /usr/lib/python2.4/encodings
# /usr/lib/python2.4/encodings/__init__.pyc matches /usr/lib/python2.4/encodings/__init__.py
import encodings # precompiled from /usr/lib/python2.4/encodings/__init__.pyc
# /usr/lib/python2.4/codecs.pyc matches /usr/lib/python2.4/codecs.py
import codecs # precompiled from /usr/lib/python2.4/codecs.pyc
import _codecs # builtin
# /usr/lib/python2.4/encodings/aliases.pyc matches /usr/lib/python2.4/encodings/aliases.py
import encodings.aliases # precompiled from /usr/lib/python2.4/encodings/aliases.pyc
# /usr/lib/python2.4/encodings/ascii.pyc matches /usr/lib/python2.4/encodings/ascii.py
import encodings.ascii # precompiled from /usr/lib/python2.4/encodings/ascii.pyc
Python 2.4.2 (#1, Nov 23 2005, 00:45:24)
[GCC 3.4.4 (Gentoo 3.4.4, ssp-3.4.4-1.0, pie-8.7.8)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
dlopen("/usr/lib/python2.4/lib-dynload/time.so", 2);
import time # dynamically loaded from /usr/lib/python2.4/lib-dynload/time.so




Gentoo emerge status script
---------------------------

1] Enter options
2] View options
3] Exit

[]> 3

Thank you for using this script

# clear __builtin__._
# clear sys.path
# clear sys.argv
# clear sys.ps1
# clear sys.ps2
# clear sys.exitfunc
# clear sys.exc_type
# clear sys.exc_value
# clear sys.exc_traceback
# clear sys.last_type
# clear sys.last_value
# clear sys.last_traceback
# clear sys.path_hooks
# clear sys.path_importer_cache
# clear sys.meta_path
# restore sys.stdin
# restore sys.stdout
# restore sys.stderr
# cleanup __main__
# cleanup[1] site
# cleanup[1] encodings
# cleanup[1] _codecs
# cleanup[1] zipimport
# cleanup[1] warnings
# cleanup[1] encodings.ascii
# cleanup[1] codecs
# cleanup[1] types
# cleanup[1] signal
# cleanup[1] linecache
# cleanup[1] posix
# cleanup[1] encodings.aliases
# cleanup[1] time
# cleanup[1] exceptions
# cleanup[2] copy_reg
# cleanup[2] posixpath
# cleanup[2] os.path
# cleanup[2] stat
# cleanup[2] UserDict
# cleanup[2] os
# cleanup sys
# cleanup __builtin__
# cleanup ints: 8 unfreed ints in 1 out of 3 blocks
# cleanup floats
root@monsterpenguin milot #

_________________
emerge --pretend love | genlop --pretend
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum