Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[TOOL] EWO - emerge (-e) world optimizer
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

Goto page Previous  1, 2  
Reply to topic    Gentoo Forums Forum Index Forum italiano (Italian) Risorse italiane (documentazione e tools)
View previous topic :: View next topic  
Author Message
fabius
Guru
Guru


Joined: 29 Nov 2004
Posts: 525

PostPosted: Sat Jan 06, 2007 2:28 pm    Post subject: Reply with quote

Ho leggermente modificato lo script per specificare la data di partenza da linea di comando.

Code:
#! /usr/bin/env python
#
#    This program is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
# Emerge (-e) World Optimizer (EWO)
# EWO 0.1 Copyright 2006 Frittella Laurento <mrfree@infinito.it>

import re, commands, sys, getopt, os
from portage import pkgsplit

world = []
alreadydone = []
toskip = []
todo = []

def fill_world_ng():
   global world
   raw_emerge_pattern = re.compile('\[.+\]\s+([^\s]+).*')

   raw_pkglist = commands.getstatusoutput('emerge -ep --quiet --nospinner world')
   if raw_pkglist[0] == 0:
      pkglist = raw_pkglist[1].split('\n')   

      for pkg in pkglist:
         match = raw_emerge_pattern.match(pkg)
         if match:
            world.append(match.group(1))
   else:
      raise Exception('Oops! No world packages list...')

def fill_alreadydone(from_date):
   global alreadydone
   raw_genlop_pattern = re.compile('.+>>>\s+([^\s]+).*')

   raw_alreadydone_pkglist = commands.getstatusoutput('genlop -ln --date ' + from_date)
   if raw_alreadydone_pkglist[0] == 0:
      alreadydone_pkglist = raw_alreadydone_pkglist[1].split('\n')

      for pkg in alreadydone_pkglist:
         match = raw_genlop_pattern.match(pkg)
         if match:
            alreadydone.append(match.group(1))
   else:
      raise Exception('Oops! No already-done packages list...')

def usage():
   print "Usage: " + os.path.basename(sys.argv[0]) + " [-h] -d date\n"
   print "  -d date: set the starting date"
   print "       -h: print this help message"

def main():
   try:
      opts, args = getopt.getopt(sys.argv[1:], "d:h", ["date=", "help"])
   except getopt.GetoptError:
      print "Wrong syntax!!!\n"
      usage()
      sys.exit(2)

   from_date = ''

   for o, a in opts:
      if o in ("-h", "--help"):
         usage()
         sys.exit()
      if o in ("-d", "--date"):
         from_date = a

   if from_date == '':
      usage()
      sys.exit()

   fill_world_ng()
   fill_alreadydone(from_date)
     
   for pkg in world:
      if alreadydone.count(pkg) == 0 and toskip.count(pkg) == 0:
         todo.append(pkg)

   out = ''
   for pkg in todo:
      if toskip.count(pkgsplit(pkg)[0]) == 0:
         out += '=' + pkg + ' '

   print out

if __name__ == "__main__":
   main()


Ora mancherebbe un'opzione per caricare la blacklist da file o da linea di comando
Back to top
View user's profile Send private message
mrfree
Veteran
Veteran


Joined: 15 Mar 2003
Posts: 1303
Location: Europe.Italy.Sulmona

PostPosted: Sat Jan 06, 2007 2:44 pm    Post subject: Reply with quote

fabius wrote:
Ho leggermente modificato lo script per specificare la data di partenza da linea di comando.
[...]
Ora mancherebbe un'opzione per caricare la blacklist da file o da linea di comando

Bene, mi fa piacere che lo script risulti utile ;)

Implementerò le nuove funzionalità appena possibile, approfittando di questa occasione per raffinare le mie conoscenze di python ;)
_________________
Please EU, pimp my country!

ICE: /etc/init.d/iptables panic
Back to top
View user's profile Send private message
fabius
Guru
Guru


Joined: 29 Nov 2004
Posts: 525

PostPosted: Sat Jan 06, 2007 3:38 pm    Post subject: Reply with quote

mrfree wrote:
Implementerò le nuove funzionalità appena possibile, approfittando di questa occasione per raffinare le mie conoscenze di python ;)

Per me, invece, sono state le prime righe di codice scritte in python :lol:
Back to top
View user's profile Send private message
mrfree
Veteran
Veteran


Joined: 15 Mar 2003
Posts: 1303
Location: Europe.Italy.Sulmona

PostPosted: Sat Jan 06, 2007 4:57 pm    Post subject: Reply with quote

fabius wrote:
Per me, invece, sono state le prime righe di codice scritte in python :lol:

Beh allora l'ewo porta bene, per me è stato il primo script scritto in python ;)
_________________
Please EU, pimp my country!

ICE: /etc/init.d/iptables panic
Back to top
View user's profile Send private message
mrfree
Veteran
Veteran


Joined: 15 Mar 2003
Posts: 1303
Location: Europe.Italy.Sulmona

PostPosted: Fri Feb 23, 2007 11:32 am    Post subject: Reply with quote

Ecco la nuova versione 0.2 con alcune migliorie, tra le principali:
* migliore gestione della data di inzio ricompilazione termonucleareglobale (opzioni {-s, -P, -v})
* utilizzo della directory ~/.ewo per i file utilizzati dal programma
* non è più necessario modificare manualmente lo script per specificare pacchetti da "skippare" e data di inizio

Ho scelto di non postare il codice direttamente sul forum, potere scaricarlo (e verificarlo) in questo modo
Code:
$ wget http://sulmonalug.altervista.org/mrfree/ewo-0.2.py http://sulmonalug.altervista.org/mrfree/ewo-0.2.py.DIGEST
$ md5sum -c ewo-0.2.py.DIGEST

Code:
$ ./ewo-0.2.py --help
EWO - Emerge (-e) World Optimizer (v0.2)

usage: ewo-0.2.py [options]

options:
  --version             show program's version number and exit
  -h, --help            show this help message and exit
  -s TOUCH_FROMDATE, --setstart=TOUCH_FROMDATE
                        set the starting point (possible values are 'NOW' or a
                        genlop-style date like 'Mon Jun 05 11:09:37 2007')
  -P, --purgestart      remove the previously set starting point
  -v, --showstart       show the already set starting point
  -f, --fetchonly       use the --fetchonly option in the emerge command
  -m MODE, --mode=MODE  using mode 'exec' an 'emerge -1 [...]' will start
                        automatically; using 'pretend' ewo simply shows the
                        todo packages list on the stdout and using 'emerge-
                        pretend' (Default) the output of 'emerge -1vp [...] |
                        less' will be shown

Dovrebbe essere abbastanza intuitivo, in caso contrario postate pure le vostre osservazioni e modificherò EWO di conseguenza (oppure mi deciderò a scrivere una guida sul wiki) ;)

Code:
~/.ewo/package.skip

Questo file da utilizzare per specificare gli ebuild che non si intende ricompilare (pacchetti binari tipo openoffice-bin ad esempio), un file di esempio viene creato alla prima esecuzione di EWO


Uno "screenshot"... che non guasta mai:
Code:
$ ./ewo_ng.py
EWO - Emerge (-e) World Optimizer (v0.2)

Using 'Mon Feb 05 12:15:38 2007' as starting date

Checking ALL installed packages...
Checking Already-Done (re-compiled) packages...

'-e world' packages   : 876
Already done packages : 49
TODO packages         : 833
Skipped packages      : 2
   media-tv/democracy
   media-sound/hydrogen-0.9.3

Here is the todo package list:
(start EWO with '--mode=exec' to automatically start a convenient emerge)

_________________
Please EU, pimp my country!

ICE: /etc/init.d/iptables panic


Last edited by mrfree on Fri Mar 02, 2007 10:53 am; edited 2 times in total
Back to top
View user's profile Send private message
Luca89
Advocate
Advocate


Joined: 27 Apr 2005
Posts: 2107
Location: Agrigento (Italy)

PostPosted: Fri Feb 23, 2007 12:01 pm    Post subject: Reply with quote

mrfree wrote:
Ho scelto di non postare il codice direttamente sul forum, potere scaricarlo (e verificarlo) in questo modo

Se vuoi possiamo aggiungerlo al gechi-overlay per rendere l'installazione ancora più semplice per gli utenti ;)

Code:
~/.ewo/pck_to_skip

Io vedrei più leggibile "~/.ewo/package.skip", così è in linea con gli altri file di portage, volendo lo si potrebbe mettere direttamente nella directory /etc/portage.
_________________
Running Fast!
Back to top
View user's profile Send private message
mrfree
Veteran
Veteran


Joined: 15 Mar 2003
Posts: 1303
Location: Europe.Italy.Sulmona

PostPosted: Fri Feb 23, 2007 4:39 pm    Post subject: Reply with quote

Luca89 wrote:
Se vuoi possiamo aggiungerlo al gechi-overlay per rendere l'installazione ancora più semplice per gli utenti
Benissimo. Non può che farmi piacere 8)

Luca89 wrote:
Io vedrei più leggibile "~/.ewo/package.skip", così è in linea con gli altri file di portage, volendo lo si potrebbe mettere direttamente nella directory /etc/portage.
Si in effetti hai ragione (ho modificato il sorgente linkato)
Per il path per adesso manterrei ~/.ewo e ci penso un po', vediamo magari anche gli altri cosa ne pensano ;)
_________________
Please EU, pimp my country!

ICE: /etc/init.d/iptables panic
Back to top
View user's profile Send private message
Luca89
Advocate
Advocate


Joined: 27 Apr 2005
Posts: 2107
Location: Agrigento (Italy)

PostPosted: Sat Mar 03, 2007 10:39 pm    Post subject: Reply with quote

mrfree wrote:
Luca89 wrote:
Se vuoi possiamo aggiungerlo al gechi-overlay per rendere l'installazione ancora più semplice per gli utenti
Benissimo. Non può che farmi piacere 8)


Fatto. :wink:
_________________
Running Fast!
Back to top
View user's profile Send private message
lopio
Veteran
Veteran


Joined: 22 Dec 2003
Posts: 1161
Location: savona, Italy

PostPosted: Tue Sep 04, 2007 6:24 am    Post subject: Reply with quote

ciao
vi risulta che ewo versione 2 funzioni anche nel sync attuale (stabile)?
Ho avuto come molti problemi con aggiornamento expat alla versione 2 e visto che non ne vengo fuori volevo ricompilare il tutto con ewo ma ottengo degli errori iniziali relativi al comando emerge (per ora non posso postare nulla).
grazie ciao
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Forum italiano (Italian) Risorse italiane (documentazione e tools) All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
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