Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[UTILITYina] Avere la size dei pacchetti da scaricare
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)
View previous topic :: View next topic  
Author Message
morellik
l33t
l33t


Joined: 03 Feb 2003
Posts: 629
Location: Firenze

PostPosted: Thu Oct 30, 2003 10:17 am    Post subject: [UTILITYina] Avere la size dei pacchetti da scaricare Reply with quote

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... 8O )
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
View user's profile Send private message
shev
Bodhisattva
Bodhisattva


Joined: 03 Feb 2003
Posts: 4084
Location: Italy

PostPosted: Thu Oct 30, 2003 10:55 am    Post subject: Reply with quote

Figo, grazie mille :D
_________________
Se per vivere ti dicono "siediti e stai zitto" tu alzati e muori combattendo
Back to top
View user's profile Send private message
fedeliallalinea
Administrator
Administrator


Joined: 08 Mar 2003
Posts: 31474
Location: here

PostPosted: Thu Oct 30, 2003 11:01 am    Post subject: Reply with quote

Wow ecco un'altra utility che puo' servire... Grazie
_________________
Questions are guaranteed in life; Answers aren't.
Back to top
View user's profile Send private message
paolo
l33t
l33t


Joined: 23 Jul 2002
Posts: 768
Location: SBT (AP)

PostPosted: Thu Oct 30, 2003 11:20 am    Post subject: Reply with quote

Ottimo script!
Direi che DEBBA essere inglobata nello script "emerge"...


Paolo
_________________
Nihil sine magno labore
Back to top
View user's profile Send private message
teknux
Guru
Guru


Joined: 19 Feb 2003
Posts: 517
Location: Rome, IT

PostPosted: Thu Oct 30, 2003 2:44 pm    Post subject: Reply with quote

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 :D kissà quando la inseriranno... :roll:

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
View user's profile Send private message
shev
Bodhisattva
Bodhisattva


Joined: 03 Feb 2003
Posts: 4084
Location: Italy

PostPosted: Thu Oct 30, 2003 3:32 pm    Post subject: Reply with quote

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
View user's profile Send private message
teknux
Guru
Guru


Joined: 19 Feb 2003
Posts: 517
Location: Rome, IT

PostPosted: Thu Oct 30, 2003 4:09 pm    Post subject: Reply with quote

Shev wrote:

Io fino ad oggi usavo le opzioni -s -S di emerge


gli "svariati giri" sono proprio quelli... ;)

saluti,
tek
Back to top
View user's profile Send private message
hardskin1
Tux's lil' helper
Tux's lil' helper


Joined: 08 Oct 2003
Posts: 82

PostPosted: Thu Oct 30, 2003 7:11 pm    Post subject: Reply with quote

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
View user's profile Send private message
leon_73
Guru
Guru


Joined: 13 Mar 2003
Posts: 505
Location: Milano

PostPosted: Fri Oct 31, 2003 11:57 am    Post subject: Reply with quote

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 :wink:
Leo
Back to top
View user's profile Send private message
koma
Advocate
Advocate


Joined: 06 Jun 2003
Posts: 2702
Location: Italy

PostPosted: Fri Oct 31, 2003 12:41 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Forum italiano (Italian) 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