Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[TOOL][PORTAGE] ebuildcopy
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Forum italiano (Italian) Risorse italiane (documentazione e tools)
View previous topic :: View next topic  
Author Message
FonderiaDigitale
Veteran
Veteran


Joined: 06 Nov 2003
Posts: 1710
Location: Rome, Italy

PostPosted: Mon Jun 21, 2004 12:55 am    Post subject: [TOOL][PORTAGE] ebuildcopy Reply with quote

Versione 0.1.1

Salve, era un po' che non partorivo ma ogni tanto ci vuole, altrimenti mi arrugginisco :P

Questo script risponde a un'esigenza che mi capita spesso di avere, ovvero quella di forgiare una versione variata di un pacchetto che sta in portage.
Perche'? Esempi:
- E' uscita una versione nuova di XYZ che ha delle fix/feature che mi servono, ma nel portage il pacchetto non viene aggiornato da [n] tempo;
- Ho la necessita' di installare un pacchetto con delle opzioni non incluse nell'ebuild di portage o con delle patch particolari.

In questi casi non si deve mai mettere le mani nel tree di portage per due motivi importanti:
- il tree verrebbe sovrascritto (in caso di file con nomi uguali, ovviamente) ad ogni sync
- e' sempre meglio e sicuramente piu pulito tenere i file personalizzati nell'overlay anche per evitare di mandare alle ortiche il vostro db

Quindi l'uso principale di questo script e' prendere un ebuild di un pacchetto, copiarlo nella overlay, modificare la versione, aprire un editor per fare le modifiche all'ebuild, chiudere e fare il digest del nuovo pacchetto.
Fa anche dei controlli (basilari) sull'input e sui file.

spero vi sia utile.

Auguri e figli masculi.

Code:

#!/bin/sh
versione="0.1"
source /etc/make.conf
function die
{
 echo "$1"
 exit 0
}

function help
{
 echo "Ebuildcopy $versione by Giovanni Ferri <fonderiadigitale@gechi.it"
 echo "License: GPL-2"
 echo "Usage: ebuildcopy [=]package-version new_version_number"
 echo "It will copy the old ebuild in your portage overlay (${PORTDIR_OVERLAY})"
 echo "with the new version number and optionally, let you edit it."
 exit 1
}
function ask
{
 echo -n "Do you want to edit it right now?"
 read a
 case "$a" in
  "y"|"yes")
          [ -z "$EDITOR" ] && EDITOR=/bin/nano
     $EDITOR ${NEWEBUILD}
  ;;
  "n"|"no") continue
  ;;
  *)
        echo  "Wrong answer."
        ask
  ;;
 esac
}
[ -z "$1" ] && help
[ -z "$2" ] && help

oldpkg=${1/=/}
ver=${oldpkg##*[a-Z]*-}
item=${oldpkg%%-$ver}
[ "$item" == "$ver" ] && help

[ -z "${PORTDIR}" ] && PORTDIR=/usr/portage
[ -z "${DISTDIR}" ] && DISTDIR=/usr/portage/distfiles
t=`expr  "${PORTAGE_TMPDIR}" : "${PORTDIR}"`
[ "$t" > 0 ] &&  PURGETMP="-type d -name ${PORTAGE_TMPDIR} -prune"

if [ -z "${PORTDIR_OVERLAY}" ]
then
 die "You need to set your overlay directory!"
else
 MATCHLIST="`find ${PORTDIR} -type d -name ${PORTDIR_OVERLAY} -prune -type d -name ${DISTDIR} -prune $PURGETMP -o -iname $item -type d -maxdepth 2 -print`"
 [ -z "$MATCHLIST" ] && die "No matches."
 echo -e "\n\nFound package portage directory."
 PACKAGE=`basename $MATCHLIST`
 e=`dirname $MATCHLIST`
 CATEGORY=`basename $e`
 NEWDIR="${PORTDIR_OVERLAY}/$CATEGORY/$PACKAGE"
 mkdir -p $NEWDIR/files
 EBUILD=$MATCHLIST/$item-$ver.ebuild
 NEWEBUILD=$NEWDIR/$item-$2.ebuild
 [ -f ${EBUILD} ] || die "No ebuild found for the package specified. Sorry."
 cp ${EBUILD} ${NEWEBUILD}
 find $MATCHLIST/files -name *digest* -prune -o -type f -exec cp {} $NEWDIR/files \;
 echo -e "Found package version. Ebuild copied and renamed.\n\n`ls -l --color ${NEWEBUILD}`"
fi
ask
echo -e "\nCreating digest for $PACKAGE version $2...\n"
ebuild ${NEWEBUILD} digest
echo "Done copying ebuild :)"


esempio di output:
Code:
# ebuildcopy apache-2.0.49-r1 2.0.49-r5
 
 
Found package portage directory.
Found package version. Ebuild copied and renamed.
 
-rw-r--r--  1 root root 12686 21 giu 02:14 /usr/portage/overlay/net-www/apache/apache-2.0.49-r5.ebuild
 
Do you want to edit it right now?
Wrong answer.
Do you want to edit it right now?y
 
Creating digest for apache version 2.0.49-r5...
 
>>> Generating digest file...
<<< httpd-2.0.49.tar.gz
>>> Generating manifest file...
<<< apache-2.0.49-r5.ebuild
<<< files/digest-apache-1.3.29-r2
<<< files/digest-apache-1.3.31
<<< files/digest-apache-2.0.49-r1
<<< files/digest-apache-1.3.31-r1
<<< files/digest-apache-1.3.31-r2
<<< files/digest-apache-2.0.49-r3
<<< files/digest-apache-2.0.49-r5
#

_________________
Come disse un amico, i sistemisti sono un po' come gli artigiani per l'informatica :)


Last edited by FonderiaDigitale on Wed Jun 23, 2004 2:37 am; edited 1 time in total
Back to top
View user's profile Send private message
codadilupo
Advocate
Advocate


Joined: 05 Aug 2003
Posts: 3135

PostPosted: Mon Jun 21, 2004 8:39 am    Post subject: Reply with quote

propongo l'ebuild award 8)

Coda
Back to top
View user's profile Send private message
fedeliallalinea
Administrator
Administrator


Joined: 08 Mar 2003
Posts: 30822
Location: here

PostPosted: Mon Jun 21, 2004 8:52 am    Post subject: Reply with quote

Ancora un po' di script e possiamo fare un pachhetoo gechitoolkit
_________________
Questions are guaranteed in life; Answers aren't.
Back to top
View user's profile Send private message
X-Drum
Advocate
Advocate


Joined: 24 Aug 2003
Posts: 2517
Location: ('Modica','Trieste','Ferrara') Italy

PostPosted: Mon Jun 21, 2004 9:09 am    Post subject: Reply with quote

concordo, very cool 8)
_________________
"...There are two sort of lies, lies and benchmarks..."
Back to top
View user's profile Send private message
assente
Guru
Guru


Joined: 12 Apr 2004
Posts: 570
Location: Torino, italia, New Europe

PostPosted: Mon Jun 21, 2004 12:18 pm    Post subject: Reply with quote

Carino; è veramente un peccato che questi script siano solo per questo forum.
Quand'è che verrà aggiunto in emerge la possibiltà di gestire dipendenze inverse tipo depcleaner?
_________________
Blog
E8400, 4850, P5q
Back to top
View user's profile Send private message
zUgLiO
l33t
l33t


Joined: 12 Aug 2003
Posts: 754
Location: Ferrara (Italy)

PostPosted: Mon Jun 21, 2004 1:30 pm    Post subject: Reply with quote

fedeliallalinea wrote:
Ancora un po' di script e possiamo fare un pachhetoo gechitoolkit

mica male come idea..
_________________

voglio poi dire che il tempo mi avrà fatto abituare,

ma io non trovo nemmeno brutta la stiva buia di questa nave
Back to top
View user's profile Send private message
federico
Advocate
Advocate


Joined: 18 Feb 2003
Posts: 3272
Location: Italy, Milano

PostPosted: Mon Jun 21, 2004 2:44 pm    Post subject: Reply with quote

Io potrei lavorare a qualche script se me ne venissero in mente, penso fonderia pure..
Propongo che se qualcuno ha delle idee veramente buone su cosa sarebbe utile avere, che si faccia avanti :)
_________________
Sideralis www.sideralis.org
Pic http://blackman.amicofigo.com/gallery
Arduino http://www.arduino.cc
Chi aveva potuto aveva spaccato
2000 pezzi buttati là
Molti saluti,qualche domanda
Semplice come musica punk
Back to top
View user's profile Send private message
FonderiaDigitale
Veteran
Veteran


Joined: 06 Nov 2003
Posts: 1710
Location: Rome, Italy

PostPosted: Tue Jun 22, 2004 7:59 pm    Post subject: Reply with quote

tutte le critiche sono ben accette, cosi come i suggerimenti e le wishlist...

Ovviamente ci tengo a ribadire che tutto cio che viene creato da noi, va TESTATO. questo script in particolare e' stato testato solo sul mio pc (piu che altro per motivi di mancanza di tempo) e quindi qualunque anima pia voglia stressarlo, e' benvenuto :)

Per quanto riguarda l'internazionalizzazione, penso sia prematuro parlarne adesso: quando tutti i vari programmi saranno in uno stadio di sviluppo pseudo-stabile, si puo' pensare a tradurli; per adesso no.
_________________
Come disse un amico, i sistemisti sono un po' come gli artigiani per l'informatica :)
Back to top
View user's profile Send private message
X-Drum
Advocate
Advocate


Joined: 24 Aug 2003
Posts: 2517
Location: ('Modica','Trieste','Ferrara') Italy

PostPosted: Wed Jun 23, 2004 8:36 pm    Post subject: Reply with quote

ho avuto modo di provarlo adesso!

generato l'ebuild per il nuvo skype che nn è ancora in portage a quanto pare....
ottimo!
_________________
"...There are two sort of lies, lies and benchmarks..."
Back to top
View user's profile Send private message
FonderiaDigitale
Veteran
Veteran


Joined: 06 Nov 2003
Posts: 1710
Location: Rome, Italy

PostPosted: Thu Jun 24, 2004 9:19 pm    Post subject: Reply with quote

attenzione xche alcuni ebuild sono scritti senza rispettare le convenzioni dei dev e non funzionano bene copiandoli e rinominandoli. editatelo e vedete.
_________________
Come disse un amico, i sistemisti sono un po' come gli artigiani per l'informatica :)
Back to top
View user's profile Send private message
n3m0
l33t
l33t


Joined: 08 Feb 2004
Posts: 798
Location: Richville, Naples, Italy, Europe

PostPosted: Thu Jun 24, 2004 9:34 pm    Post subject: Reply with quote

federico wrote:
Io potrei lavorare a qualche script se me ne venissero in mente, penso fonderia pure..


Pure io ;)
Pero' anche io sono a corto di idee (anche perche' sobbarcato dagli esami come sempre mal disposti del mio CDL).
_________________
L’energia è la civiltà. Lasciarla in mano ai piromani/petrolieri è criminale. Perché aspettare che finisca il petrolio?
L’età della pietra non è mica finita per mancanza di pietre. - B.G.


Site/Blog: http://www.neminis.org
Back to top
View user's profile Send private message
silian87
Advocate
Advocate


Joined: 06 Oct 2003
Posts: 2318
Location: Treviso, Italy

PostPosted: Tue Aug 03, 2004 5:14 pm    Post subject: Reply with quote

Non mi va proprio!!!!! Ho provato con lo script copiato a mano o emergendo il gekit, ma sempre lo stesso errore...

Code:
ebuildcopy pcb-20040530 20040530a
Ebuildcopy 0.1 by Giovanni Ferri <fonderiadigitale@gechi.it
License: GPL-2
Usage: ebuildcopy [=]package-version new_version_number
It will copy the old ebuild in your portage overlay (/usr/local/portage)
with the new version number and optionally, let you edit it.
FireTux bin # ebuildcopy apache-2.0.49-r1 2.0.49-r5
Ebuildcopy 0.1 by Giovanni Ferri <fonderiadigitale@gechi.it
License: GPL-2
Usage: ebuildcopy [=]package-version new_version_number
It will copy the old ebuild in your portage overlay (/usr/local/portage)
with the new version number and optionally, let you edit it.

_________________
Musica che ascolto: http://www.last.fm/user/silian87/

Silian87 FAQs: http://marentax.homelinux.org/~silian87/silian87-faq.txt

GTalk: silian87@gmail.com
Back to top
View user's profile Send private message
FonderiaDigitale
Veteran
Veteran


Joined: 06 Nov 2003
Posts: 1710
Location: Rome, Italy

PostPosted: Tue Aug 03, 2004 9:15 pm    Post subject: Reply with quote

arg. lo metto nel TODO.
in soldoni, quel formato di versione (YYYYMMDD) non e' gestito come dovrebbe. appena posso cambio e uploado :)
_________________
Come disse un amico, i sistemisti sono un po' come gli artigiani per l'informatica :)
Back to top
View user's profile Send private message
silian87
Advocate
Advocate


Joined: 06 Oct 2003
Posts: 2318
Location: Treviso, Italy

PostPosted: Tue Aug 03, 2004 9:48 pm    Post subject: Reply with quote

SI però se noti bene...

Code:
FireTux bin # ebuildcopy apache-2.0.49-r1 2.0.49-r5
Ebuildcopy 0.1 by Giovanni Ferri <fonderiadigitale@gechi.it
License: GPL-2
Usage: ebuildcopy [=]package-version new_version_number
It will copy the old ebuild in your portage overlay (/usr/local/portage)
with the new version number and optionally, let you edit it.


Non mi va nenche l'esempio di apache...
_________________
Musica che ascolto: http://www.last.fm/user/silian87/

Silian87 FAQs: http://marentax.homelinux.org/~silian87/silian87-faq.txt

GTalk: silian87@gmail.com
Back to top
View user's profile Send private message
FonderiaDigitale
Veteran
Veteran


Joined: 06 Nov 2003
Posts: 1710
Location: Rome, Italy

PostPosted: Wed Aug 04, 2004 1:19 am    Post subject: Reply with quote

va bene, HO CAPITO! :P
_________________
Come disse un amico, i sistemisti sono un po' come gli artigiani per l'informatica :)
Back to top
View user's profile Send private message
silian87
Advocate
Advocate


Joined: 06 Oct 2003
Posts: 2318
Location: Treviso, Italy

PostPosted: Thu Aug 05, 2004 11:06 am    Post subject: Reply with quote

ma apache non e' nel formato YYYYMMDD.... il problema e' che sono io che non ho capito! :P
_________________
Musica che ascolto: http://www.last.fm/user/silian87/

Silian87 FAQs: http://marentax.homelinux.org/~silian87/silian87-faq.txt

GTalk: silian87@gmail.com
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
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