1 |
El 18/03/2010, a las 18:29, Lluís Forns escribió: |
2 |
|
3 |
> hace un año que no trabajo con gentoo, pero en el sistema había un |
4 |
> fichero llamado "world" con todos los paquetes instalados |
5 |
> especificamente (no contiene las dependencias instaladas). |
6 |
> |
7 |
|
8 |
Cierto, creo que se encuentra en el directorio de portage, en /usr/ |
9 |
portage. |
10 |
|
11 |
De todas formas, se puede obtener un listado exacto de todas los |
12 |
programas instalados parseando la salida del programa "eix". Hace |
13 |
algunos meses yo hice un pequeño parser para obtener los programas |
14 |
que necesitaban actualizarse (world no es muy fiable a veces). El |
15 |
código es este, está en python, con unas pequeñas modificaciones se |
16 |
podría obtener un listado legible de todos los programas instalados y |
17 |
sus respectivas versiones. Si a alguien le interesa el programa ese, |
18 |
se llama GUAU y está en http://halcyon.zapto.org/projects/guau aunque |
19 |
no está terminado, tiene un par de bugs. |
20 |
|
21 |
def make_report(file): |
22 |
from components import eix |
23 |
# Open and save the eix result in the file specified in the |
24 |
# configuration |
25 |
# NOTE: We must sync eix first to get an updated list |
26 |
eix.sync() |
27 |
eix = Popen('eix -uc >>' + file, shell=True) |
28 |
# Wait for the process to end |
29 |
eix.wait() |
30 |
# Start counting packages |
31 |
p = 0 |
32 |
print _('* Making update report...') |
33 |
# We iterate over the object |
34 |
for line in fileinput.input(file, inplace=1): |
35 |
package = line.split(' ') |
36 |
if len(line.strip()) and not line.startswith('Found') and |
37 |
not line[1].isdigit(): |
38 |
try: |
39 |
# Count a new package |
40 |
p += 1 |
41 |
# Write package name, since output |
42 |
# is redirected to file, print is |
43 |
# enough. We insert a space |
44 |
# see the update function |
45 |
print package[1] |
46 |
except: |
47 |
log.error('Couldn\'t write the reportfile. Aborting') |
48 |
print ERROR |
49 |
sys.exit(1) |
50 |
# Open the packages file |
51 |
mssg = open(file, 'r').read() |
52 |
externalmail.send(_('Portage tree and eix database updated. |
53 |
There are') + str(p) + _(' packages to update:\n\n') + mssg + _ |
54 |
('\nGenerated by Gentoo Universal Automatic Updater v.') + VERSION) |
55 |
log.debug('Report made succesfully.') |
56 |
print _('* Report sent by email.') |