Difference between revisions of "CleanupDebianPackages"

(Solution)
Ms (talk)
(Solution)
Zeile 13: Zeile 13:
 
Create a meta package (ubuntu-meta is a good start) with a lengthy dependency list.
 
Create a meta package (ubuntu-meta is a good start) with a lengthy dependency list.
 
./debian/rules binary
 
./debian/rules binary
  +
  +
The ubuntu/kubuntu meta package can be obtained with ''apt-get source ...''.
   
 
Install that package and make it sticky:
 
Install that package and make it sticky:
  +
apt-get install deborphan ms-desasterarea
 
sudo deborphan -A ms-desasterarea
 
sudo deborphan -A ms-desasterarea
   
 
Search for orphaned packages:
 
Search for orphaned packages:
deborphan -a | sort -k2,2
+
deborphan -a |grep -vE "^main/libdevel" | sort -k2,2
  +
  +
Development packages can be kept. Unwanted library packages can be deleted on a general basis:
  +
apt-get --purge remove `deborphan`
  +
  +
Run that command several times till no orphaned library package is left.
   
 
Any unwanted und not via dependency required package can be removed with ''apt-get --purge remove ...''.
 
Any unwanted und not via dependency required package can be removed with ''apt-get --purge remove ...''.

Version vom 14:06, 2 April 2006

The Problem

The number of installed packages tends to grow on a debian system (like with any other distribution and operating system). Packages are installed, dependent packages are installed, too. It becomes difficult to decide, which packages are really wanted.

Some people suggest the usage of aptitude since it keeps the information, if a package was installed on unser request or as a result of a dependency.

Solution

The deborphan tool lists any package that is not required by at least one other package.

So having a private meta package just containing dependencies and running deborphan helps.

Create a meta package (ubuntu-meta is a good start) with a lengthy dependency list.

 ./debian/rules binary

The ubuntu/kubuntu meta package can be obtained with apt-get source ....

Install that package and make it sticky:

 apt-get install deborphan ms-desasterarea
 sudo deborphan -A ms-desasterarea

Search for orphaned packages:

 deborphan -a |grep -vE "^main/libdevel" | sort -k2,2

Development packages can be kept. Unwanted library packages can be deleted on a general basis:

 apt-get --purge remove `deborphan`

Run that command several times till no orphaned library package is left.

Any unwanted und not via dependency required package can be removed with apt-get --purge remove .... After iterating that several times deborphan only returns development packages (that I do not include in my meta package).

Filesystem Layout

./debian
./debian/control
./debian/rules
./debian/copyright
./debian/compat
./debian/changelog
./trillian-i386
./desasterarea-i386

debian/rules

#!/usr/bin/make -f

#export DH_VERBOSE=1

clean:
        dh_testdir
        dh_clean

        rm -rf build-stamp *.old debootstrap-dir

DEB_BUILD_ARCH:=$(shell dpkg-architecture -qDEB_BUILD_ARCH)

build: build-stamp
build-stamp: desasterarea-$(DEB_BUILD_ARCH) trillian-$(DEB_BUILD_ARCH)
        dh_clean

        for seed in desasterarea trillian; do \
                package=ms-$$seed; \
                (printf "$$package:Depends="; grep -Ev '^#' $$seed-$(DEB_BUILD_ARCH) | grep -Ev '^ *$$' | perl -pe 's/\n/, /g'; echo) \
                        >> debian/$$package.substvars; \
        done
        touch $@

install: build-stamp

binary-arch: install
        dh_testdir -a
        dh_testroot -a
        dh_installdocs -a
        dh_installchangelogs -a
        dh_compress -a
        dh_fixperms -a
        dh_installdeb -a
        dh_gencontrol -a
        dh_md5sums -a
        dh_builddeb -a

binary-indep:

binary: binary-indep binary-arch

.PHONY: binary binary-arch binary-indep clean checkroot build

debian/control

Source: ms-meta
Section: base
Priority: optional
Maintainer: Martin Stechert <Martin.Stechert@web.de>
Standards-Version: 3.6.1
Build-Depends: debhelper (>= 4)

Package: ms-desasterarea
Architecture: any
Depends: ${ms-desasterarea:Depends}
Description: DesasterArea meta package
 meta package with dependencies for all DesasterArea packages
 DesasterArea is currently Debian SID based
 Based on ubuntu meta packages

Package: ms-trillian
Architecture: any
Depends: ${ms-trillian:Depends}
Description: Trillian meta package
 meta package with dependencies for all Trillian packages
 Trillian is currently (K)Ubuntu Hoary Hedgehog Ubuntu 5.04 based
 Based on ubuntu meta packages