Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[portage]Come ricavare il nome del pacchetto senza versione?
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

Goto page Previous  1, 2, 3  Next  
Reply to topic    Gentoo Forums Forum Index Forum italiano (Italian) Forum di discussione italiano
View previous topic :: View next topic  
Author Message
mouser
Veteran
Veteran


Joined: 10 Aug 2004
Posts: 1419
Location: Milano

PostPosted: Wed Jan 24, 2007 11:17 am    Post subject: Reply with quote

ProT-0-TypE wrote:
Con pacchetti tipo questo non funziona:

Code:
echo font-bitstream-100dpi-1.0.0 | sed -e 's|\-[[:digit:]].*$||'
font-bitstream


Però quello in perl va..... hmmm mi sa che alla fine utilizzerò quello.... tra l'altro noto che nonostante utilizzi il perl l'esecuzione è praticamente immediata

Ciauz
mouser :wink:

edit:
NOOOOO :cry: :cry: :cry: :cry:
ProT-0-TypE wrote:
Se ne era parlato qua

Possibile??? Apro un thread ogni morte di papa.... ed è pure duplicato!!!!

Mi sto mobilitando per sostituire la sedia con uno sgabello di chiodi :oops: :oops:
Back to top
View user's profile Send private message
makoomba
Bodhisattva
Bodhisattva


Joined: 03 Jun 2004
Posts: 1856

PostPosted: Wed Jan 24, 2007 11:27 am    Post subject: Reply with quote

ProT-0-TypE wrote:
Con pacchetti tipo questo non funziona:
Code:
echo font-bitstream-100dpi-1.0.0 | sed -e 's|\-[[:digit:]].*$||'
font-bitstream

vedo il tuo font-bitstream e rilancio con
Code:
echo font-bitstream-100dpi-1.0.0 | sed -e 's|\-[[:digit:]]*\..*$||'
font-bitstream-100dpi


edit:
fatto il merge dei due topic
_________________
When all else fails, read the instructions.
Back to top
View user's profile Send private message
ProT-0-TypE
Veteran
Veteran


Joined: 20 Dec 2003
Posts: 1624
Location: Cagliari

PostPosted: Wed Jan 24, 2007 11:37 am    Post subject: Reply with quote

Code:
echo vimap-2002c-r3 | perl -p -e 's/\-\d+\..+//'
vimap-2002c-r3


Code:
echo vimap-2002c-r3 | sed -e 's|\-[[:digit:]]*\..*$||'
vimap-2002c-r3


c'è sempre qualche pacchetto che da problemi :!:
_________________
[Vuoi guadagnare navigando?]
Back to top
View user's profile Send private message
crisandbea
Veteran
Veteran


Joined: 03 Jul 2005
Posts: 1778
Location: BOSCO (SA) ... ma domiciliato a Bologna....

PostPosted: Wed Jan 24, 2007 11:39 am    Post subject: Reply with quote

ProT-0-TypE wrote:

Non mi sembra proprio più semplice... comunqe hai provato se per pacchetti tipo font-bitstream-100dpi-1.0.0 funziona?


beh basta aggiungere un .
Code:

emerge -pvt font-bitstream-100dpi| sed -e 's|\-[[:digit:]]..*$||' | grep ebuild | awk '{ print $4}'


ciauz
Back to top
View user's profile Send private message
ProT-0-TypE
Veteran
Veteran


Joined: 20 Dec 2003
Posts: 1624
Location: Cagliari

PostPosted: Wed Jan 24, 2007 11:41 am    Post subject: Reply with quote

che fai copi makoomba? :lol:

Comunqe prova con vimap-2002c-r3 (che era un altro dei pacchetti che creavano problemi).

(non sono a casa e non posso provare)
_________________
[Vuoi guadagnare navigando?]
Back to top
View user's profile Send private message
makoomba
Bodhisattva
Bodhisattva


Joined: 03 Jun 2004
Posts: 1856

PostPosted: Wed Jan 24, 2007 11:48 am    Post subject: Reply with quote

ProT-0-TypE wrote:
che fai copi makoomba?

prr! non avevo letto l'altro post....
[TODO]
trovare quanto prima scusa per appioppare ban a ProT-0-TypE
[/TODO]
_________________
When all else fails, read the instructions.
Back to top
View user's profile Send private message
ProT-0-TypE
Veteran
Veteran


Joined: 20 Dec 2003
Posts: 1624
Location: Cagliari

PostPosted: Wed Jan 24, 2007 11:50 am    Post subject: Reply with quote

makoomba wrote:
ProT-0-TypE wrote:
che fai copi makoomba?

prr! non avevo letto l'altro post....
[TODO]
trovare quanto prima scusa per appioppare ban a ProT-0-TypE
[/TODO]



ahahahahah :P
_________________
[Vuoi guadagnare navigando?]
Back to top
View user's profile Send private message
makoomba
Bodhisattva
Bodhisattva


Joined: 03 Jun 2004
Posts: 1856

PostPosted: Wed Jan 24, 2007 12:05 pm    Post subject: Reply with quote

sed the 3rd
Code:
cat ebuilds | sed -re 's|-[0-9]+[^-]+(-r[0-9])?$||'
font-bitstream-100dpi
vimap

_________________
When all else fails, read the instructions.
Back to top
View user's profile Send private message
gioi
Apprentice
Apprentice


Joined: 14 Feb 2006
Posts: 236

PostPosted: Wed Jan 24, 2007 12:12 pm    Post subject: Reply with quote

makoomba wrote:
sed the 3rd
Code:
cat ebuilds | sed -re 's|-[0-9]+[^-]+(-r[0-9])?$||'
font-bitstream-100dpi
vimap


ma scusate a questo punto il
Code:
perl -p -e 's/\-\d\..+//'
da dare in pasto ad una pipe cos'ha che non va?

- funziona anche con i pacchetti tipo font-bitstrema-100dpi
- è semplice e compatto
Back to top
View user's profile Send private message
Kernel78
Moderator
Moderator


Joined: 24 Jun 2005
Posts: 3654

PostPosted: Wed Jan 24, 2007 12:24 pm    Post subject: Reply with quote

gioi wrote:
ma scusate a questo punto il
Code:
perl -p -e 's/\-\d\..+//'
da dare in pasto ad una pipe cos'ha che non va?

- funziona anche con i pacchetti tipo font-bitstrema-100dpi
- è semplice e compatto

Non funziona con numeri di versione tipo app-emulation/wine-20050930
_________________
Le tre grandi virtù di un programmatore: pigrizia, impazienza e arroganza. (Larry Wall).
Prima di postare un file togli i commenti con
Code:
grep -vE '(^[[:space:]]*($|(#|!|;|//)))'
Back to top
View user's profile Send private message
ProT-0-TypE
Veteran
Veteran


Joined: 20 Dec 2003
Posts: 1624
Location: Cagliari

PostPosted: Wed Jan 24, 2007 12:26 pm    Post subject: Reply with quote

gioi wrote:
makoomba wrote:
sed the 3rd
Code:
cat ebuilds | sed -re 's|-[0-9]+[^-]+(-r[0-9])?$||'
font-bitstream-100dpi
vimap


ma scusate a questo punto il
Code:
perl -p -e 's/\-\d\..+//'
da dare in pasto ad una pipe cos'ha che non va?

- funziona anche con i pacchetti tipo font-bitstrema-100dpi
- è semplice e compatto


si ma con pacchetti tipo vimap non funziona:
Code:
echo vimap-2002c-r3 |perl -p -e 's/\-\d\..+//'
vimap-2002c-r3

_________________
[Vuoi guadagnare navigando?]
Back to top
View user's profile Send private message
ProT-0-TypE
Veteran
Veteran


Joined: 20 Dec 2003
Posts: 1624
Location: Cagliari

PostPosted: Wed Jan 24, 2007 12:31 pm    Post subject: Reply with quote

makoomba wrote:
sed the 3rd
Code:
cat ebuilds | sed -re 's|-[0-9]+[^-]+(-r[0-9])?$||'
font-bitstream-100dpi
vimap


questo è duro da battere :lol:

EDIT:
Code:
echo ilbc-rfc3951-0-r1 | sed -re 's|-[0-9]+[^-]+(-r[0-9])?$||'
ilbc-rfc3951-0-r1

_________________
[Vuoi guadagnare navigando?]
Back to top
View user's profile Send private message
mouser
Veteran
Veteran


Joined: 10 Aug 2004
Posts: 1419
Location: Milano

PostPosted: Wed Jan 24, 2007 1:14 pm    Post subject: Reply with quote

ProT-0-TypE wrote:
questo è duro da battere :lol:

EDIT:
Code:
echo ilbc-rfc3951-0-r1 | sed -re 's|-[0-9]+[^-]+(-r[0-9])?$||'
ilbc-rfc3951-0-r1


Cribbio, ma ci sarà pure qualche modo che funzia con tutto!!! :evil:
E' così infame portage???

Ciriciao
mouser :wink:
Back to top
View user's profile Send private message
makoomba
Bodhisattva
Bodhisattva


Joined: 03 Jun 2004
Posts: 1856

PostPosted: Wed Jan 24, 2007 1:49 pm    Post subject: Reply with quote

ProT-0-TypE wrote:
Code:
echo ilbc-rfc3951-0-r1 | sed -re 's|-[0-9]+[^-]+(-r[0-9])?$||'
ilbc-rfc3951-0-r1

tiè
Code:
[root@backup root]# cat ebuilds  | sed -re 's|-[0-9]+[^-]*(-r[0-9])?$||'
font-bitstream-100dpi
vimap
ilbc-rfc3951

_________________
When all else fails, read the instructions.
Back to top
View user's profile Send private message
Scen
Retired Dev
Retired Dev


Joined: 29 Jul 2003
Posts: 2470
Location: Padova, Italy

PostPosted: Wed Jan 24, 2007 1:51 pm    Post subject: Reply with quote

A me sembra che la soluzione tramite il binario pkgname incluso in Portage funziona a dovere! 8)

Code:

/usr/lib/portage/bin/pkgname <category>/<pkg-name>-<pkg-version> | awk {'print $1'}


Esempi:
Code:

# /usr/lib/portage/bin/pkgname dev-libs/ilbc-rfc3951-0-r1 | awk {'print $1'}
dev-libs/ilbc-rfc3951
# /usr/lib/portage/bin/pkgname vimap-2002c-r3 | awk {'print $1'}
vimap
# /usr/lib/portage/bin/pkgname font-bitstream-100dpi-1.0.0  | awk {'print $1'}
font-bitstream-100dpi
# /usr/lib/portage/bin/pkgname wine-20050930  | awk {'print $1'}
wine

_________________
I was born in a deep forest/I wish I could live here all my life/I am made from stones and roots/My home, these woods and roads
All my life I loved this sound/Of the woods all around/Eagles flies where the winds blows free
Journey is my destiny
Back to top
View user's profile Send private message
ProT-0-TypE
Veteran
Veteran


Joined: 20 Dec 2003
Posts: 1624
Location: Cagliari

PostPosted: Wed Jan 24, 2007 1:55 pm    Post subject: Reply with quote

Scen wrote:
A me sembra che la soluzione tramite il binario pkgname incluso in Portage funziona a dovere! 8)

Code:

/usr/lib/portage/bin/pkgname <category>/<pkg-name>-<pkg-version> | awk {'print $1'}


Esempi:
Code:

# /usr/lib/portage/bin/pkgname dev-libs/ilbc-rfc3951-0-r1 | awk {'print $1'}
dev-libs/ilbc-rfc3951
# /usr/lib/portage/bin/pkgname vimap-2002c-r3 | awk {'print $1'}
vimap
# /usr/lib/portage/bin/pkgname font-bitstream-100dpi-1.0.0  | awk {'print $1'}
font-bitstream-100dpi
# /usr/lib/portage/bin/pkgname wine-20050930  | awk {'print $1'}
wine


si l'avevo già scritto su... 8)

stavolta mi sa che makoomba mi ha battuto.. :P
_________________
[Vuoi guadagnare navigando?]


Last edited by ProT-0-TypE on Wed Jan 24, 2007 1:58 pm; edited 1 time in total
Back to top
View user's profile Send private message
cloc3
Advocate
Advocate


Joined: 13 Jan 2004
Posts: 4811
Location: http://www.gentoo-users.org/user/cloc3/

PostPosted: Wed Jan 24, 2007 1:57 pm    Post subject: Reply with quote

mouser wrote:

Cribbio, ma ci sarà pure qualche modo che funzia con tutto!!! :evil:

per me, sicuramente no.

In portage esistono decine di migliaia di pacchetti.
I più assumono denominazioni che rispettano una ben precisa sintassi. Altri se ne distaccano a causa di ragioni incidentali che non dipendono da gentoo, ma da questioni esterne. Una distribuzione usa software di altri, e non può determinare i nomi.

L'unica è definire una regola di massima e organizzare un database delle eccezioni, come fossero verbi irregolari.
_________________
vu vu vu
gentù
mi piaci tu
Back to top
View user's profile Send private message
gioi
Apprentice
Apprentice


Joined: 14 Feb 2006
Posts: 236

PostPosted: Wed Jan 24, 2007 2:14 pm    Post subject: Reply with quote

ProT-0-TypE wrote:
gioi wrote:
makoomba wrote:
sed the 3rd
Code:
cat ebuilds | sed -re 's|-[0-9]+[^-]+(-r[0-9])?$||'
font-bitstream-100dpi
vimap


ma scusate a questo punto il
Code:
perl -p -e 's/\-\d\..+//'
da dare in pasto ad una pipe cos'ha che non va?

- funziona anche con i pacchetti tipo font-bitstrema-100dpi
- è semplice e compatto


si ma con pacchetti tipo vimap non funziona:
Code:
echo vimap-2002c-r3 |perl -p -e 's/\-\d\..+//'
vimap-2002c-r3


Prima cosa: mi sono scordato il "+" dopo il "\d" la stringa esatta (come da originale) è:

Code:
s/\-\d+\..+//


Capisco il problema... ma quelli più che versioni vere e proprie dovrebbero essere degli snapshot...

Cmq basta modificarla aggiungendo due caratteri e sostituendone 1:

Code:
s/\-\d+\.?.*$//


Così va meglio?
Back to top
View user's profile Send private message
gioi
Apprentice
Apprentice


Joined: 14 Feb 2006
Posts: 236

PostPosted: Wed Jan 24, 2007 2:21 pm    Post subject: Reply with quote

[OT]
So che a molti sembrerà una minkiata, ma secondo me sarebbe interessante proporre un contest sulle regexp... il confronto di idee insegna molto più del contenuto di 1000 libri conosciuto a menadito!

IMHO, per esempio, avrei ritenuto il "$" una direttiva ridondante, ma a pensarci bene lo è solo 99 volte su 100... e quindi va assolutamente aggiunto!

[/OT]
Back to top
View user's profile Send private message
makoomba
Bodhisattva
Bodhisattva


Joined: 03 Jun 2004
Posts: 1856

PostPosted: Wed Jan 24, 2007 2:21 pm    Post subject: Reply with quote

@gioi
non va con font-bitstream-100dpi.

prendendo spunto da pkgname
Code:
#!/usr/bin/python
import sys
import portage
for line in sys.stdin.readlines():print portage.pkgsplit(line)[0]

Code:
cat ebuild | ./test.py
font-bitstream-100dpi
vimap
ilbc-rfc3951
wine

_________________
When all else fails, read the instructions.
Back to top
View user's profile Send private message
gioi
Apprentice
Apprentice


Joined: 14 Feb 2006
Posts: 236

PostPosted: Wed Jan 24, 2007 2:25 pm    Post subject: Reply with quote

makoomba wrote:
@gioi
non va con font-bitstream-100dpi.


Umh... non ho gentoo sotto mano... ma quindi font-bitstream-100dpi è un pacchetto a sè stante e non una "versione" del più generico font-bitstream?

Scusate, ma per capire cosa eliminare devo capire cos'è una label identificativa di una determinata versione, e cosa invece fa parte del nome...
Back to top
View user's profile Send private message
mouser
Veteran
Veteran


Joined: 10 Aug 2004
Posts: 1419
Location: Milano

PostPosted: Wed Jan 24, 2007 2:33 pm    Post subject: Reply with quote

Purtroppo pkgname non mi va molto bene..... la comodità è quella di mandare 'emerge --pretend' in output, parsare per togliere le versioni ed infine ributtare il tutto in una variable....

Con pkgname devo per forza fare un ciclo for/while per ogni voce dell'emerge --pretend ed eseguire ogni volta una chiamata a pkgname.... il che vuol dire che se in output ho gnome (circa 48 software) devo, oltre al ciclo for/while, lanciare 48 volte pkgname.... con il sed/perl lancio una volta, parso e sono a posto... in termini di performance non ci dovrebbero essere paragoni (poi, non ho fatto debugging, vado solo a logica).

La soluzione di massima + db (o similare) delle eccezioni può essere una soluzione, ma per questa prima release (la 0.1) del mio programma pensavo di buttare fuori qualcosa di funzionante che potesse essere testato da molti.... per implementare una cosa del genere devo inventarmi anche un modo per gestire il db..... potrebbe essere un'ottima features semmai ci fossero delle release successive.

Per ora mi preme trovare qualcosa che sia il più generico possibile, e che quindi funzioni con la stra-grande maggioranza dei "pacchetti" presenti in portage.

L'unico problema è che sono una frana con le regexp :cry:

Ciriciao
mouser :wink:
Back to top
View user's profile Send private message
makoomba
Bodhisattva
Bodhisattva


Joined: 03 Jun 2004
Posts: 1856

PostPosted: Wed Jan 24, 2007 2:36 pm    Post subject: Reply with quote

gioi wrote:
Umh... non ho gentoo sotto mano... ma quindi font-bitstream-100dpi è un pacchetto a sè stante e non una "versione" del più generico font-bitstream?
Scusate, ma per capire cosa eliminare devo capire cos'è una label identificativa di una determinata versione, e cosa invece fa parte del nome...

Code:
* media-fonts/font-bitstream-100dpi
     Available versions:  ~1.0.0

il problema è che i nomi non seguono una regola ben definita.
appena pensi di aver trovato la regexp definitiva,
ti salta fuori ProT-0-TypE con l'eccezione.

@mouser
lo script (in python) che ho postato lo usi in pipe, quindi viene eseguito solo una volta ;)
_________________
When all else fails, read the instructions.
Back to top
View user's profile Send private message
ProT-0-TypE
Veteran
Veteran


Joined: 20 Dec 2003
Posts: 1624
Location: Cagliari

PostPosted: Wed Jan 24, 2007 2:38 pm    Post subject: Reply with quote

con pkgname + xargs non credo che dovresti avere problemi (sempre se ho capito bene qual è il problema :lol: ).

Altrimenti l'ultima di makoomba sembra andare bene per tutto
_________________
[Vuoi guadagnare navigando?]
Back to top
View user's profile Send private message
gioi
Apprentice
Apprentice


Joined: 14 Feb 2006
Posts: 236

PostPosted: Wed Jan 24, 2007 2:38 pm    Post subject: Reply with quote

Vediamo se ci siamo...

Torniamo alla sringa originale

Code:
 s/\-\d+\..+//


e questo funziona con tutto tranne che con i pacchetti "snapshot" cioè quelli che contengono una data come versione...

quelli si possono eliminare con un secondo filtro:

Code:
 s/\-\d{4,}.+//


Per cui il comando diventa:

Code:
comando_per_generare_la_lista | perl -p -e 's/\-\d+\..+//' | perl -p -e 's/\-\d{4,}.+//'


Se ci sono altre eccezioni segnalatemele, per favore! 'sta cosa mi sta prendendo...


Last edited by gioi on Wed Jan 24, 2007 2:40 pm; edited 1 time in total
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Forum italiano (Italian) Forum di discussione italiano All times are GMT
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
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