You are not logged in.

#26 2010-11-20 01:04:40

655321
Member
From: Costa Rica
Registered: 2009-12-08
Posts: 412
Website

Re: bigpkg - find packages that require a lot of space on your system

Hi, I cant get it to work, I downloaded, give it executable permissions and change the .txt extension to .sh, first I ran:

sh bigpkg.sh

and got

bigpkg.sh: line 26: syntax error near unexpected token `('
bigpkg.sh: line 26: `def strip_versioning(pkg):'

and then tried with:

./bigpkg.sh

and got:

/usr/bin/env: python: No such file or directory

Python is installed on my system.

How to solve this?

cheers

Last edited by 655321 (2010-11-20 01:05:42)


Linux user #498977
With microsoft you get windows and gates, with linux you get the whole house!
My Blog about ArchLinux and other stuff

Offline

#27 2010-11-20 01:09:43

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,472
Website

Re: bigpkg - find packages that require a lot of space on your system

change "python" to "python2" on the top line.

Edit: I should rewrite it in python3...  tongue

Offline

#28 2010-11-20 02:28:29

655321
Member
From: Costa Rica
Registered: 2009-12-08
Posts: 412
Website

Re: bigpkg - find packages that require a lot of space on your system

Allan wrote:

change "python" to "python2" on the top line.

Edit: I should rewrite it in python3...  tongue

Thx! changing to python2 on the script helped big_smile

cheers.

PS: I really have some big ass packages lol


Linux user #498977
With microsoft you get windows and gates, with linux you get the whole house!
My Blog about ArchLinux and other stuff

Offline

#29 2010-11-21 09:30:39

vinc
Member
Registered: 2010-11-21
Posts: 5

Re: bigpkg - find packages that require a lot of space on your system

Nice app, my system is 2.5GB smaller now!

Offline

#30 2010-11-21 10:01:44

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,643
Website

Re: bigpkg - find packages that require a lot of space on your system

Very nice, script, Allan.  I placed it in the AUR.  Before this script, I have been using pacgraph to accomplish this task. (pacgraph -c), but I think your method is more elegant and more accurately captures the true size.

Two suggestions to improve the output IMO:
1) Format the output with the size in MB rather than in K
2) Reverse the order of the pkgname and size and separate the two by a tab to make the output look a bit cleaner


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Online

#31 2010-11-21 10:06:47

litemotiv
Forum Fellow
Registered: 2008-08-01
Posts: 5,026

Re: bigpkg - find packages that require a lot of space on your system

bigpkg seems to crash on dependencies that have been removed locally with pacman -Rd.


ᶘ ᵒᴥᵒᶅ

Offline

#32 2010-11-21 10:13:58

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,472
Website

Re: bigpkg - find packages that require a lot of space on your system

I have not touched this script in over a year...    so feel free to do what you want to it.   I will probably adjust it once pacman-3.5 is release as it will be nicely broken then!

Offline

#33 2010-11-21 11:26:10

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,472
Website

Re: bigpkg - find packages that require a lot of space on your system

litemotiv wrote:

bigpkg seems to crash on dependencies that have been removed locally with pacman -Rd.

That is because you pacman database is inconsistent...  one package says you have a dependency installed but there is not database entry.   Again, not likely to get fixed any time soon... tongue

Offline

#34 2011-07-19 10:07:48

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: bigpkg - find packages that require a lot of space on your system

Just for the record:

Allan wrote:

v0.3.0 is now on my site with pacman-3.5 fixes

The package in the AUR has been updated.

Offline

#35 2011-07-29 18:47:17

markbabc
Member
Registered: 2010-11-06
Posts: 157

Re: bigpkg - find packages that require a lot of space on your system

@graysky

I posted in the aur how I edited to add KB, MB, and GB then I read this post and decided to implement your other idea:

http://paste.pocoo.org/show/448968/

(oh and I changed it from /usr/bin/env python2 to /use/bin/env python since its python 3.x now)

Offline

#36 2011-07-29 18:55:25

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: bigpkg - find packages that require a lot of space on your system

markbabc wrote:

(oh and I changed it from /usr/bin/env python2 to /use/bin/env python since its python 3.x now)

Seems to work fine with python2 if you keep the 'python2' part.
Not sure if '953.00KB' is helpful - do I really care about every byte?

Offline

#37 2011-07-29 19:04:50

markbabc
Member
Registered: 2010-11-06
Posts: 157

Re: bigpkg - find packages that require a lot of space on your system

karol wrote:
markbabc wrote:

(oh and I changed it from /usr/bin/env python2 to /use/bin/env python since its python 3.x now)

Seems to work fine with python2 if you keep the 'python2' part.
Not sure if '953.00KB' is helpful - do I really care about every byte?

just checked and .format() works in 2.6 and up so everything should work in python2 or python

and the .00 is for the MB/GB ones but if it makes you feel better you can modify it to not show if there is no decimal....

Actually upon consideration it is sorta pointless to have all that .00 for KB's so here you go: http://paste.pocoo.org/show/448980/

Last edited by markbabc (2011-07-29 19:10:36)

Offline

#38 2011-07-29 19:27:24

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: bigpkg - find packages that require a lot of space on your system

Unfortunately it causes formatting problems:

Size         PKG

20.0KB:        downgrade
20.0KB:        mozilla-common
52.0KB:        resourceproto
68.0KB:        xf86driproto
76.0KB:        bigreqsproto
76.0KB:        xcmiscproto
140.0KB:        xf86-video-fbdev
140.0KB:        xf86-video-vesa
148.0KB:        xf86-input-keyboard
152.0KB:        mingetty
...
852.0KB:        pkg-config
884.0KB:        hunspell
946.0KB:        sxiv
972.0KB:        fakeroot
1.06MB:        lsof
1.08MB:        xorg-xinit
1.12MB:        libidl2
1.12MB:        sfarkxtc
...
7.14MB:        mbrola-voices-us3
8.67MB:        xorg-server
9.39MB:        initscripts
10.71MB:        arch-wiki-lite
12.09MB:        festival-pl-em
12.99MB:        quickserve
13.12MB:        iotop
...
85.86MB:        kernel26
95.27MB:        arch-wiki-docs
133.37MB:        android-notifier-desktop
141.69MB:        fluidr3
158.37MB:        festival-jmk-arctic
224.84MB:        festival-us-awb-multisyn

Edit: Grrr, In my terminal the columns are not off by one character, they are off by eight.
I "fixed it" by piping the output of your script to 'column -t'.

./bp | column -t

Last edited by karol (2011-07-29 19:32:51)

Offline

#39 2011-07-29 19:33:19

markbabc
Member
Registered: 2010-11-06
Posts: 157

Re: bigpkg - find packages that require a lot of space on your system

not sure why you still have .0KB heres what i get:

Size         PKG

28KB:        modprobed_db
80KB:        zd1211-firmware
105KB:        gen-init-cpio
113KB:        xf86-video-vesa
129KB:        acpi
153KB:        tree
153KB:        sl
189KB:        ncdu
233KB:        patch
241KB:        dash
...
1.56MB:        ntfs-3g
1.58MB:        sudo
1.59MB:        nano
1.64MB:        xorg-server-utils
1.66MB:        clyde-git
1.73MB:        cryptsetup
1.76MB:        xmlto
...
14.80MB:        man-pages
16.06MB:        xorg-fonts-75dpi
17.31MB:        openmotif
17.32MB:        xorg-fonts-100dpi
17.36MB:        docbook-xsl
18.06MB:        transmission-gtk
19.18MB:        ruby
19.34MB:        comix
19.83MB:        imagemagick
...
93.55MB:        boost
98.43MB:        chromium
98.84MB:        jre
279.72MB:        libreoffice
535.45MB:        ghc

for some odd reason its treating \t\t really weird making some tabs bigger than others... unless theres preceeding whitespace before the pkg names?

Offline

#40 2011-07-29 19:36:44

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: bigpkg - find packages that require a lot of space on your system

markbabc wrote:

not sure why you still have .0KB

python2 :-)
With python3 the zeroes are gone.

Offline

#41 2011-07-29 19:42:55

markbabc
Member
Registered: 2010-11-06
Posts: 157

Re: bigpkg - find packages that require a lot of space on your system

Alright I forgot python2.x and 3.x division acts differently... if you want the same thing that im coding (why bother with 2.x when 3.x is default in arch?) do from __future__ import division

http://paste.pocoo.org/show/448999/

Thats it with adjusted spaces so the pkg names are all lined up

Last edited by markbabc (2011-07-29 19:43:32)

Offline

#42 2011-07-29 20:17:17

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: bigpkg - find packages that require a lot of space on your system

I only said it worked OK with python2 - I considered it a bonus :-)

I've changed the format a bit to suit my preferences:

[karol@black test]$ diff -Naur a/bp2 b/bp2
--- a/bp2    2011-07-29 20:17:32.000000000 +0000
+++ b/bp2    2011-07-29 20:17:55.000000000 +0000
@@ -25,7 +25,7 @@
 
 def adjust_space(pkg, size):
     size_l = len(size)
-    spaces = (16-size_l)*" "
+    spaces = (12-size_l)*" "
     return "{0}:{1}{2}".format(size, spaces, pkg)
 
 def find_pkg_size(size, options=["KB", "MB", "GB"], count=0):
@@ -33,8 +33,8 @@
         count += 1
         return find_pkg_size(size/1024, options, count)
     else: 
-        if count == 0: return "{0}{1}".format(size, options[count])
-        else: return "{0:0.2f}{1}".format(size, options[count])
+        if count == 0: return "{0:5,} {1}".format(size, options[count])
+        else: return "{0:5,.1f} {1}".format(size, options[count])
 def strip_versioning(pkg):
     r = re.compile('[^=,^<,^>]+')
     m = r.match(pkg)
@@ -116,6 +116,7 @@
 
 pkg_usage = [ [v[1],v[0]] for v in pkg_usage.items()]
 pkg_usage.sort()
-print("Size \t\tPKG\n")
+print("    SIZE     PKG")
 for pkg in range(len(pkg_usage)):
     print("{0}".format(adjust_space(pkg_usage[pkg][1], find_pkg_size(round(pkg_usage[pkg][0])))))
+print("    SIZE     PKG")
    SIZE     PKG
   20 KB:    downgrade
   20 KB:    mozilla-common
   52 KB:    resourceproto
   68 KB:    xf86driproto
   76 KB:    bigreqsproto
   76 KB:    xcmiscproto
  142 KB:    xf86-video-fbdev
  142 KB:    xf86-video-vesa
  827 KB:    abs
  855 KB:    pkg-config
  888 KB:    hunspell
  957 KB:    sxiv
1,001 KB:    fakeroot
  1.1 MB:    lsof
  1.1 MB:    xorg-xinit
  1.1 MB:    sfarkxtc
  1.1 MB:    libidl2
  7.1 MB:    mbrola-voices-us3
  8.7 MB:    xorg-server
  9.4 MB:    initscripts
 10.7 MB:    arch-wiki-lite
 12.1 MB:    festival-pl-em
 13.0 MB:    quickserve
 13.2 MB:    iotop
 85.9 MB:    kernel26
 95.3 MB:    arch-wiki-docs
133.5 MB:    android-notifier-desktop
141.7 MB:    fluidr3
158.4 MB:    festival-jmk-arctic
224.9 MB:    festival-us-awb-multisyn
    SIZE     PKG

Thanks!

Offline

#43 2011-07-29 20:43:23

markbabc
Member
Registered: 2010-11-06
Posts: 157

Re: bigpkg - find packages that require a lot of space on your system

nice! didnt think to do the {0:num,} thing! although in your what if a pkg is 1000.1 MB large? you have to make it 6 instead of 5 (I went with 7 because I kept the two decimal places)

Offline

Board footer

Powered by FluxBB