Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 96510 - Suggestion: `make mrproper` when unmerging kernel source ebuilds
Summary: Suggestion: `make mrproper` when unmerging kernel source ebuilds
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: x86 Linux
: High enhancement
Assignee: Gentoo Kernel Bug Wranglers and Kernel Maintainers
URL:
Whiteboard:
Keywords: Inclusion
Depends on:
Blocks:
 
Reported: 2005-06-19 01:55 UTC by Peter Gordon (RETIRED)
Modified: 2005-06-23 15:38 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
kernel-eclass-make-mrproper-before-unmerge.patch (kernel-eclass-make-mrproper-before-unmerge.patch,1.35 KB, patch)
2005-06-19 01:58 UTC, Peter Gordon (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Gordon (RETIRED) gentoo-dev 2005-06-19 01:55:54 UTC
When a kernel source tree is installed using ebuilds, Portage tracks and
maintains a list of all the files it installs. However, in the process of kernel
configuration and compilation, scripts and object code files are created. When
these kernel sources are uninstalled with Portage, only the files it placed
there originally are removed, leaving the created scripts and object code files
in place and thus the directory in /usr/src still remains. I will attach a patch
to the kernel-2 eclass which does this automatically using an exported pkg_prerm
function.

Reproducible: Always
Steps to Reproduce:




Portage 2.0.51.22-r1 (default-linux/x86/2005.0, gcc-3.4.4, glibc-2.3.5-r0,
2.6.12-gentoo i686)
=================================================================
System uname: 2.6.12-gentoo i686 AMD Athlon(tm) processor
Gentoo Base System version 1.6.12
ccache version 2.4 [enabled]
dev-lang/python:     2.3.5, 2.4.1-r1
sys-apps/sandbox:    1.2.9
sys-devel/autoconf:  2.13, 2.59-r6
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.5
sys-devel/binutils:  2.16.1
sys-devel/libtool:   1.5.18
virtual/os-headers:  2.6.11-r2
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-Os -march=athlon-tbird -pipe -fomit-frame-pointer -funit-at-a-time"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config
/usr/lib/X11/xkb /usr/lib/mozilla/defaults/pref /usr/share/config
/var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-Os -march=athlon-tbird -pipe -fomit-frame-pointer -funit-at-a-time"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig ccache distlocks sandbox sfperms strict"
GENTOO_MIRRORS="http://mirror.datapipe.net/gentoo http://distfiles.gentoo.org"
LANG="en_US.utf8"
LC_ALL="en_US.utf8"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.us.gentoo.org/gentoo-portage"
USE="3dnow 3dnowext X aalib acpi alsa apache2 artworkextra bash-completion
berkdb bzip2 cdparanoia cdr cjk crypt cscope cups curl eds encode erandom
extensions fbcon ffmpeg flac foomaticdb fpx gd gdbm ggi gif gimpprint glitz
gnome gnutls gpm graphviz gstreamer gtk gtk2 gtkhtml hal howl imap imlib ipv6
javascript jbig jpeg justify lcms libcaca logrotate lzo mad mbox mcal md5sum
mmap mmx mmxext mng mozdevelop mozilla moznomail mozsvg mozxmlterm mpeg
mpm-worker mysql ncurses nethack network nls nodrm nptl nptlonly ogg oggvorbis
opengl openntpd pam pam_console parse-clocks pcmcia pcre perl pic png ppds
python readline rhythmbox rtc sdk sdl silc skey slang slp speex spell ssl svg
symlink tcpd theora threads tiff truetype truetype-fonts type1-fonts unicode
vorbis wmf x86 xforms xine xml xml2 xprint xv xvid xvmc zero-penalty-hit zlib
userland_GNU kernel_linux elibc_glibc"
Unset:  ASFLAGS, CTARGET, LDFLAGS, LINGUAS
Comment 1 Peter Gordon (RETIRED) gentoo-dev 2005-06-19 01:58:10 UTC
Created attachment 61476 [details, diff]
kernel-eclass-make-mrproper-before-unmerge.patch

Adds an exported pkg_prerm function to the kernel-2 eclass to run `make
mrproper` in the given kernel source tree directory before unmerging.
Comment 2 John Mylchreest (RETIRED) gentoo-dev 2005-06-19 05:26:40 UTC
I Cant see any problem with doing this.
I have updated the eclass here, locally. The prerm function I would prefer to
use is:

kernel-2_pkg_prerm() {
	local KV_DIR=${ROOT}/usr/src/linux-${KV_FULL}

	if [[ ${ETYPE} == sources ]]; then
		# if we have a config for it then we should act on it.
		if [[ -f ${KV_DIR}/.config ]]; then
			cp ${KV_DIR}/.config ${KV_DIR}.config
			gzip ${KV_DIR}.config
		fi

		# have kbuild clean up for us.
		env -u ARCH make -C ${KV_DIR} mrproper
	fi
}

any objections?
Comment 3 Daniel Drake (RETIRED) gentoo-dev 2005-06-19 05:42:34 UTC
make mrproper does not always work (try running it twice) and we should do our
usual voodoo for ARCH for cross-compilers
Comment 4 Peter Gordon (RETIRED) gentoo-dev 2005-06-19 11:59:05 UTC
John,

Thanks for fixing up the pkg_prerm. That's much nicer. :-) 

Daniel, I just tried running it twice (after running `make allnoconfig && make`
on a gentoo-sources 2.6.11-r11 kernel tree that I've been using to test things,
and it failed with an error saying that "/include/linux/version.h" couldn't be
found. I've modified John's function to test for that first before running `make
mrproper`:
---snip---
kernel-2_pkg_prerm() {
	local KV_DIR=${ROOT}/usr/src/linux-${KV_FULL}

	if [[ ${ETYPE} == sources ]]; then
		# if we have a config for it then we should act on it.
		if [[ -f ${KV_DIR}/.config ]]; then
			cp ${KV_DIR}/.config ${KV_DIR}.config
			gzip ${KV_DIR}.config
		fi
		# have kbuild clean up for us.
		[[ -f ${KV_DIR}/include/linux/version.h ]] && env -u ARCH make -C ${KV_DIR}
mrproper
	fi
}
---/snip---

Thanks for the input. What do you mean by "usual voodoo for ARCH for
cross-compilers"? Could we simply set what ARCH to use for kbuild based on the
current GCC profile?
Comment 5 Daniel Drake (RETIRED) gentoo-dev 2005-06-19 12:07:55 UTC
Look at how tc-arch-kernel is used elsewhere in the eclass
Comment 6 Marcelo Goes (RETIRED) gentoo-dev 2005-06-19 13:51:30 UTC
This should probably be done with an USE flag, to prevent .config files and
other files to be wiped out without the users's consent.
Comment 7 John Mylchreest (RETIRED) gentoo-dev 2005-06-19 15:16:12 UTC
Im not sure how much the cross-compile stuff has effect here (ie: why I never
used it) although to take into account the previous comments please check:

kernel-2_pkg_prerm() {
	local KV_DIR=${ROOT}/usr/src/linux-${KV_FULL}

	if [[ ${ETYPE} == sources ]]; then
		# if we have a config for it then we should act on it.
		if [[ -f ${KV_DIR}/.config ]]; then
			gzip -c ${KV_DIR}/.config > ${KV_DIR}.config
		fi

		# have kbuild clean up for us.
		if [[ -f ${KV_DIR}/include/linux/version.h ]]; then
			ARCH=$(tc-arch-kernel)
			make -C ${KV_DIR} mrproper
		fi
	fi
}

which should solve everyones requirements hopefully.
Marcelo, I'm not sure if that would matter, since every kernel is SLOT'ed
${KV_FULL} anyways they would have to explicitly remove it. I asssume if they do
so, then they want it gone, completely.
However, the .config is backed up for courtesy if it exists.

any other comments?
Comment 8 Peter Gordon (RETIRED) gentoo-dev 2005-06-19 16:08:48 UTC
Heh. I was just going to post a similar function. Thanks, John. That Works
nicely, here. :-)
 
Comment 9 John Mylchreest (RETIRED) gentoo-dev 2005-06-23 13:24:28 UTC
comitted to CVS.
Comment 10 Peter Gordon (RETIRED) gentoo-dev 2005-06-23 15:38:19 UTC
Shweet. Thanks very much. :D