I want to maintain two gentoo-sources trees. I want to have the tree corresponding to the kernel I am running. I also want to have whatever the latest tree is in case I have time to actually configure, install, and test a new kernel (which is almost never).
I want emerge -uvDN world to install the latest gentoo-sources each time. I want emerge --depclean to preserve the version corresponding to my current kernel. I also want it to preserve the latest version. I want it to uninstall any other kernels.
I was accomplishing this using an ebuild that looks like this:
DESCRIPTION="which kernels should be installed on amarna"
That used to work as I described and wanted.
I recently was upgrading packages and discovered that depclean wants to remove the most recent gentoo-sources (at least it preserves the kernel source for what I am currently running).
amarna gentoo-sources # equery depends gentoo-sources
[ Searching for packages depending on gentoo-sources... ]
amarna gentoo-sources # emerge -p --depclean
>>> These are the packages that would be unmerged:
All selected packages: sys-kernel/gentoo-sources-2.6.36-r5
I installed a dummy ebuild for 2.6.29 (which has been removed from portage), but that didn't solve the problem.
How do I construct an ebuild to express this desire to preserve two versions of a slotted ebuild and discard the others?
amarna gentoo-sources # emerge --info
Portage 126.96.36.199 (default/linux/x86/10.0, gcc-4.4.4, glibc-2.11.2-r3, 2.6.29-gentoo-r5 i686)
System uname: Linux-2.6.29-gentoo-r5-i686-AMD_Athlon-tm-_Processor_LE-1640-with-gentoo-1.12.14
Timestamp of tree: Mon, 24 Jan 2011 19:00:01 +0000
dev-lang/python: 2.6.6-r1, 3.1.2-r4
sys-devel/autoconf: 2.13, 2.65-r1
sys-devel/automake: 1.9.6-r2, 1.11.1
virtual/os-headers: 2.6.30-r1 (sys-kernel/linux-headers)
CFLAGS="-O2 -mtune=i686 -pipe"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -mtune=i686 -pipe"
FEATURES="assume-digests binpkg-logs distlocks fixlafiles fixpackages news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
USE="X acl berkdb bzip2 cli cracklib crypt cxx dbus device-mapper dri encode faac faad fortran gdbm gpm iconv ipv6 mng modules mp3 mudflap ncurses nls nptl nptlonly openmp pam pcre perl png pnm pppd python quicktime readline session ssl svg sysfs tcpd theora unicode vorbis x264 x86 xorg xvid zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="ati vesa fbdev" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset: CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LANG, LC_ALL, MAKEOPTS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Why don't you just add the SLOT you want to your world file? That way depclean won't remove the SLOTed version because you have stated that you EXPLICITLY want it.
emerge --noreplace gentoo-sources:2.6.29-r5
You could change your ebuild to
I guess the behavior change comes from bug 285767, in this commit:
The new behavior should be preferable to the old, so I agree with the suggestion in comment #2.
(In reply to comment #1)
> Why don't you just add the SLOT you want to your world file? That way depclean
> won't remove the SLOTed version because you have stated that you EXPLICITLY
> want it.
Well, I don't think they had that syntax when I first figured out this method using ebuilds.
Also, I suspect that if I had gentoo-sources and gentoo-sources:2.6.29-r5 in /var/lib/portage/world then it would never unmerge the stale gentoo-sources. I haven't studied the enhancements to the world file that might make it possible to express "only the most recent of this slotted build".
Perhaps my old syntax working the way I wanted was just a historical accident.
I can see why the fix referenced in comment #3 would affect me, and agree that its behavior is probably preferrable.
The solution in comment #2 would work, assuming there is a more recent version of gentoo-sources. There's just an awkward phase where I transition to the latest kernel. What would the ebuild look like (since there wouldn't be anything more recent, the atom would lead to a failure?)
(In reply to comment #4)
> Also, I suspect that if I had gentoo-sources and gentoo-sources:2.6.29-r5 in
> /var/lib/portage/world then it would never unmerge the stale gentoo-sources. I
> haven't studied the enhancements to the world file that might make it possible
> to express "only the most recent of this slotted build".
It should work, since world atoms are not greedy. That's why we have (unsolved) bug 198200, since some people want to keep "stale gentoo-sources" and don't want to manage it via non-greedy atoms in the world file.