You are not logged in.

#1 2006-03-21 12:57:25

evdvelde
Member
From: Antwerp - BELGIUM
Registered: 2005-12-02
Posts: 57

Cleaning up the package cache

Hi,

for me, the pacman -Sc and pacman -Scc calls are too primitive to do what I want to do. e.g. pacman -Sc removes outdated packages, but not packages removed from the system (and still up to date with the repository). Therefore I have written the following tiny script: it removes all packages that are not currently installed or are outdated and then it downloads all packages you have installed (in case you want to have a complete cache of all installed packages).

#!/bin/bash

pacman -Sc

pacman -Q | sed s/' '/-/g > /tmp/installed


for pkg in `ls /var/cache/pacman/pkg`
do
        name=${pkg%%.pkg.tar.gz}
        if [[ ! `grep $name /tmp/installed` ]]
        then
                echo Removing $name
                rm -f /var/cache/pacman/pkg/$pkg
        fi
done

pacman -Q | cut -d ' ' -f 1 > /tmp/installed
pacman -Sl | cut -d ' ' -f 2 >> /tmp/installed

pacman -Sw `sort /tmp/installed | uniq -d`

It is still basic, but feel free to comment on it smile

Offline

#2 2006-03-21 13:09:33

Sigi
Member
From: Thurgau, Switzerland
Registered: 2005-09-22
Posts: 1,131

Re: Cleaning up the package cache

I haven't tried it yet but I like the idea. Good work


Haven't been here in a while. Still rocking Arch. smile

Offline

#3 2006-03-21 13:51:26

brain0
Developer
From: Aachen - Germany
Registered: 2005-01-03
Posts: 1,382

Re: Cleaning up the package cache

Offline

#4 2006-03-22 03:58:13

McQueen
Member
From: Arizona
Registered: 2006-03-20
Posts: 387

Re: Cleaning up the package cache

evdvelde wrote:

It is still basic, but feel free to comment on it smile

Seems to have a problem with mkinitramfs-1.3-5

# pac-cache
removing old packages from cache... done.
Removing mkinitramfs-1.3-5

Targets: a52dec-0.7.4-3 acl-2.2.34-1 acpi-0.09-1 acpid-1.0.4-1 alltray-0.65-1
         alsa-lib-1.0.10-1 alsa-oss-1.0.10-1 alsa-utils-1.0.10-1 apmd-3.0.2-5
         archlinux-menus-1.1-1 archstats-4.1-1 arts-1.5.1-1 artwiz-fonts-1.3-2
         aspell-0.60.4-1 aspell-en-6.0-1 at-3.1.9-1 atk-1.10.3-1 attr-2.4.28-1
         audiofile-0.2.6-3 autoconf-2.59-1 autofs-4.1.4-2 automake-1.9.6-1
         azureus-2.4.0.2-1 bash-3.1-1 bc-1.06-2 bftpd-1.2-1 bin86-0.16.17-1
         bind-9.3.2-2 binutils-2.16.1-2 bison-2.1-1 bluez-libs-2.25-1
         bluez-utils-2.25-1 bzip2-1.0.3-2 cabextract-1.1-1 cairo-1.0.4-1

<snip>

Total Package Size:   610.6 MB

Proceed with download? [Y/n] y

:: Retrieving packages from extra...
 mkinitramfs-1.3-5        [################] 100%     370K   135.0K/s  00:00:02

checking package integrity... done.

/path/to/Truth

Offline

#5 2006-03-22 08:58:00

evdvelde
Member
From: Antwerp - BELGIUM
Registered: 2005-12-02
Posts: 57

Re: Cleaning up the package cache

McQueen wrote:
evdvelde wrote:

It is still basic, but feel free to comment on it smile

Seems to have a problem with mkinitramfs-1.3-5

The mysterious world of computers... it does not happen with me. I'll have a look at it.

Offline

Board footer

Powered by FluxBB