[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#693242: live-build: apt-get autoclean doesn't remove old versions



Package: live-build
Version: 3.0~a67-1
Severity: normal
Tags: patch

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

The apt-get autoclean command removes extra packages in the chroot but
the cache has an incremental and growing size, which can be seen with
this command that shows only same-packagenames:  ls -1 cache/packages.chroot/ | sort | sed 's|_.*$||g' | uniq -d

A patch is included for fix this problem, which maintains only the last
versions in the cache directory


- -- Package-specific info:

- -- System Information:
Debian Release: wheezy/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)

Kernel: Linux 3.2.0-3-686-pae (SMP w/2 CPU cores)
Locale: LANG=es_ES.UTF-8, LC_CTYPE=es_ES.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages live-build depends on:
ii  debootstrap  1.0.42

Versions of packages live-build recommends:
ii  cpio                            2.11-8
ii  gnu-fdisk                       1.2.4-3.1
ii  live-boot-doc                   3.0~a35-1
ii  live-config-doc                 3.0~a43-1
ii  live-manual-html [live-manual]  1:3.0~a13-1

Versions of packages live-build suggests:
ii  dosfstools       3.0.13-1
ii  fakeroot         1.18.4-2
ii  genisoimage      9:1.1.11-2
ii  git              1:1.7.10.4-1
pn  loadlin          <none>
ii  memtest86+       4.20-1.1
ii  mtools           4.0.17-1
ii  parted           2.3-11
ii  squashfs-tools   1:4.2-5
ii  sudo             1.8.5p2-1
pn  syslinux | grub  <none>
ii  uuid-runtime     2.20.1-5.2
pn  win32-loader     <none>

- -- no debconf information

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iQIcBAEBCAAGBQJQo8CsAAoJEKLHmb/f+NfClmkP/RYODVQbzMWHi4z2jUoYpgJf
Xid0JPI+/LgfqywLd3beJ63uNd0/YqUDmb6mJmPpWLzVRbFejhjZq0rRlzJh6IAn
jrnVangG/x0A2oIZZ2yrZLBJ89YIwR4J5U/2AxIk2NJ3xBG/MNX5tJ9Y7yHtS0pK
bcTrdLr6RTEixjVMHKM6rvaBuU4orQGjD+3NayGbH8JM61mNFluHX248ZqLlfT50
BLrHm+BmHGNeQMeMpl0YREU0TBDvWeLH7jW5OdwLLDTlLPkiXNTiO2YqXeQI10ke
9ipzRtWDb5zm80ttdbUyW1s04ia4a4hBA8IblQ0IJbXv8JaR2kaAV2r1KhKHDu32
oGxRkzxDxKBj2mwCapsa7Gjl1H0qOdBeunmErUOzLmvZ6AAd5F1hk0Dh1ChCYgWy
h6P7LjOnFMZHRJU8i4E57XDg8QF/2Gwlh9ogqam8/F6nZ41pwWtjJFJYMK2UPJSz
fNNZsqpGLs2X65n2jlVFJ9VBJs33hd1EgLnk8ESj7JF6GDrtFXqvXGxLHwW3Sfzw
gI1Xsxt8mh6R36jLLzaFSWLLeGOoOwFmW+QN6ZYnUDChndLYjJ37moK+2GJ6GrJ7
OKTCKqAVlBHWiCygH1zNB7jdbmUjbp7YowIEPoPU8BaUkzasJNV3Z2qO7dvA/k2A
DNZ+Bwy5QwA7nIhC0kWb
=fyi7
-----END PGP SIGNATURE-----
--- a/functions/cache.sh
+++ b/functions/cache.sh
@@ -48,12 +48,15 @@ Save_cache ()
 			# Saving new cache
 			for PACKAGE in chroot/var/cache/apt/archives/*.deb
 			do
-				if [ -e "${DIRECTORY}"/"$(basename ${PACKAGE})" ]
-				then
-					rm -f "${PACKAGE}"
-				else
-					mv "${PACKAGE}" "${DIRECTORY}"
-				fi
+				# get the package name only
+				PACKAGENAME="$(basename ${PACKAGE%%_*})"
+				SUFFIX="$(basename ${PACKAGE##*_})"
+
+				# delete all the versions of this package
+				rm -f ${DIRECTORY}/${PACKAGENAME}_*_${SUFFIX}
+
+				# move to cache, which maintains only the last version
+				mv "${PACKAGE}" "${DIRECTORY}"
 			done
 		fi
 	else

Reply to: