View previous topic :: View next topic |
Author |
Message |
morellik l33t
![l33t l33t](/images/ranks/rank_rect_4.gif)
![](images/avatars/gallery/Loony Toons/Looney_Toons_-_Sylvester.gif)
Joined: 03 Feb 2003 Posts: 629 Location: Firenze
|
Posted: Thu Oct 30, 2003 10:17 am Post subject: [UTILITYina] Avere la size dei pacchetti da scaricare |
|
|
Dalla ML gentoo-user un'utility che calcola la size totale da scaricare di un pacchetto da installare incluse le dipendenze (non so che ho detto, ma l'ho detto... )
es:
Code: |
# get_size mozilla
dev-libs/libIDL-0.8.2
247Kb libIDL-0.8.2.tar.bz2 (ok)
Pkg size: 247Kb Download: 0
net-www/mozilla-1.4-r3
31120Kb mozilla-source-1.4.tar.bz2
206Kb enigmail-0.76.4.tar.gz
229Kb ipc-1.0.3.tar.gz
Pkg size: 31556Kb Download: 31556Kb
Total Size: 31803Kb Download: 31556Kb
|
Ecco lo script:
Code: |
#!/bin/sh
print_size()
{
SIZE=$1
OUT_SIZE=$SIZE
# if [ $SIZE -gt 1500000 ]; then
# OUT_SIZE=`expr $SIZE / 1024 / 1024`Mb
if [ $SIZE -gt 10000 ]; then
OUT_SIZE=`expr $SIZE / 1024`Kb
fi
# fi
echo $OUT_SIZE;
}
PKG=$1
if [ -z "$PKG" ]; then
echo pack
exit 1
fi
PKGS=`emerge -p $PKG | grep '^\[' | sed 's/^................//' | sed 's/ \[.*$//'`
TOTAL_SIZE=0
TOTAL_SIZE_DOWNLOAD=0
for P in $PKGS; do
GROUP=`echo $P | sed 's/\/.*$//'`
CP=`echo $P | sed 's/^.*\///'`
PK=`echo $CP | sed 's/-[0-9].*$//'`
echo "$GROUP/$CP"
if [ -e /usr/portage/$GROUP/$PK/$CP.ebuild ]; then
DIGEST="/usr/portage/$GROUP/$PK/files/digest-$CP"
if [ -e $DIGEST ]; then
FILES=`cat $DIGEST | awk '{print $4_"|"_$3}'`
PKG_SIZE=0
PKG_SIZE_DOWNLOAD=0
for F in $FILES; do
FILE=`echo $F | sed 's/^.*|//'`
SIZE=`echo $F | sed 's/|.*$//'`
OUT_SIZE=`print_size $SIZE`
OUT_EX=''
if [ ! -e /usr/portage/distfiles/$FILE ]; then
PKG_SIZE_DOWNLOAD=`expr $PKG_SIZE_DOWNLOAD + $SIZE`
else
OUT_EX=' (ok)'
fi
echo -e "\t\t\t" $OUT_SIZE "\t" $FILE $OUT_EX
PKG_SIZE=`expr $PKG_SIZE + $SIZE`
done
echo " Pkg size: `print_size $PKG_SIZE` " " Download: `print_size $PKG_SIZE_DOWNLOAD`"
TOTAL_SIZE=`expr $TOTAL_SIZE + $PKG_SIZE`
TOTAL_SIZE_DOWNLOAD=`expr $TOTAL_SIZE_DOWNLOAD + $PKG_SIZE_DOWNLOAD`
else
echo digest- Not found
fi
else
echo .ebuild Not found
fi
done
echo Total Size: `print_size $TOTAL_SIZE` " " Download: `print_size $TOTAL_SIZE_DOWNLOAD`
|
Ciauz
morellik |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
shev Bodhisattva
![Bodhisattva Bodhisattva](/images/ranks/rank-bodhisattva.gif)
![](images/avatars/8449159314dcae72b62db4.jpg)
Joined: 03 Feb 2003 Posts: 4084 Location: Italy
|
Posted: Thu Oct 30, 2003 10:55 am Post subject: |
|
|
Figo, grazie mille ![Very Happy :D](images/smiles/icon_biggrin.gif) _________________ Se per vivere ti dicono "siediti e stai zitto" tu alzati e muori combattendo |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
fedeliallalinea Administrator
![Administrator Administrator](/images/ranks/rank-admin.gif)
![](images/avatars/161653968057192eb39329f.jpg)
Joined: 08 Mar 2003 Posts: 31474 Location: here
|
Posted: Thu Oct 30, 2003 11:01 am Post subject: |
|
|
Wow ecco un'altra utility che puo' servire... Grazie _________________ Questions are guaranteed in life; Answers aren't. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
paolo l33t
![l33t l33t](/images/ranks/rank_rect_4.gif)
![](images/avatars/3152398534026854723eba.jpg)
Joined: 23 Jul 2002 Posts: 768 Location: SBT (AP)
|
Posted: Thu Oct 30, 2003 11:20 am Post subject: |
|
|
Ottimo script!
Direi che DEBBA essere inglobata nello script "emerge"...
Paolo _________________ Nihil sine magno labore |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
teknux Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
![](images/avatars/gallery/Southpark/avatar36.gif)
Joined: 19 Feb 2003 Posts: 517 Location: Rome, IT
|
Posted: Thu Oct 30, 2003 2:44 pm Post subject: |
|
|
paolo wrote: | Ottimo script!
Direi che DEBBA essere inglobata nello script "emerge"...
|
veramente ho letto sul forum (sezione tips) che qualcuno ha proposto proprio questa feature in emerge. anzi il tizio lo ha proposto come patch ed ha mostrato l'output proprio sul forum. in pratica usando "emerge -vp" vengono visualizzate le dipendneze e la grandezza del file da scaricare kissà quando la inseriranno...
nel frattempo userò lo script di morellik, visto che tutte le volte devo fare svariati giri per sapere la grandezza dei pacchetti da scaricare
saluti,
tek |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
shev Bodhisattva
![Bodhisattva Bodhisattva](/images/ranks/rank-bodhisattva.gif)
![](images/avatars/8449159314dcae72b62db4.jpg)
Joined: 03 Feb 2003 Posts: 4084 Location: Italy
|
Posted: Thu Oct 30, 2003 3:32 pm Post subject: |
|
|
teknux wrote: |
nel frattempo userò lo script di morellik, visto che tutte le volte devo fare svariati giri per sapere la grandezza dei pacchetti da scaricare
|
Io fino ad oggi usavo le opzioni -s -S di emerge, che tra le altre cose danno la dimensione del pacchetto da scaricare. Però non è ne precisa ne elegante come soluzione, speriamo accettino la patch presto. _________________ Se per vivere ti dicono "siediti e stai zitto" tu alzati e muori combattendo |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
teknux Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
![](images/avatars/gallery/Southpark/avatar36.gif)
Joined: 19 Feb 2003 Posts: 517 Location: Rome, IT
|
Posted: Thu Oct 30, 2003 4:09 pm Post subject: |
|
|
Shev wrote: |
Io fino ad oggi usavo le opzioni -s -S di emerge |
gli "svariati giri" sono proprio quelli...
saluti,
tek |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
hardskin1 Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
![](images/avatars/9908106173fcdd9277aa75.jpg)
Joined: 08 Oct 2003 Posts: 82
|
Posted: Thu Oct 30, 2003 7:11 pm Post subject: |
|
|
notevole, veramente notevole. Da mettere in rilievo e inserie nei tips&tricks di gentoo.it _________________ "Life 's a bitch / Life's a whore / Nothing less nothing more" Iced Earth
Se il destino ci e' avverso, peggio per lui. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
leon_73 Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
![](images/avatars/19948170973f0c226f51d37.jpg)
Joined: 13 Mar 2003 Posts: 505 Location: Milano
|
Posted: Fri Oct 31, 2003 11:57 am Post subject: |
|
|
hardskin1 wrote: | notevole, veramente notevole. Da mettere in rilievo e inserie nei tips&tricks di gentoo.it |
Un grazie da tutti gli users connessi ancora a 56k
Leo |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
koma Advocate
![Advocate Advocate](/images/ranks/rank-G-1-advocate.gif)
![](images/avatars/208407359441b4bbd170574.jpg)
Joined: 06 Jun 2003 Posts: 2702 Location: Italy
|
Posted: Fri Oct 31, 2003 12:41 pm Post subject: |
|
|
Code: | KomaPC root # ./sizepkg mozilla
Uso: sed [OPZIONE]... {script-solo-se-manca-un-altro-script} [file-input]...
-n, --quiet, --silent
sopprime la stampa automatica del pattern space
-e script, --expression=script
aggiunge lo script ai comandi da eseguire
-f script-file, --file=file-script
aggiunge il contenuto di file-script ai comandi da eseguire
-i[suffix], --in-place[=suffix]
scrive il risultato sul file originale (facendo una copia
di backup se si fornisce un'estensione)
-l N, --line-length=N
specifica la lunghezza delle linee generate dal comando `l'
-r, --regexp-extended
usa la sintassi di `egrep' per le espressioni regolari
-s, --separate
considera i file di input come separati invece che come un
unico file lungo.
-u, --unbuffered
carica e visualizza i dati una a pezzetti piu' piccoli --he
lp mostra questo aiuto ed esce
--version stampa le informazioni sulla versione ed esce
Se non è usata nessuna delle opzioni -e, --expression, -f o --file allora il
primo argomento che non è una opzione sarà usato come lo script sed da
interpretare. Tutti gli argomenti rimanenti sono nomi di file di input; se non
sono specificati file di input sarà letto lo standard input.
Segnalare eventuali bug a: bonzini@gnu.org .
Assicurarsi di includere la parola ``sed'' nell'oggetto del messaggio.
./sizepkg: line 2: s/ \[.*$//: No such file or directory
./sizepkg: line 9: [: -gt: unary operator expected
./sizepkg: line 2: 0: command not found
Total Size: 0 Download:
|
come si fa? :°° _________________ http://www.youtube.com/watch?v=_yoJI-Tl94g GLORY GLORY HYPNOTOAD |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|