Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 35837

Summary: debug eclass usability and global inherit
Product: Portage Development Reporter: Jeremy Huddleston (RETIRED) <eradicator>
Component: UnclassifiedAssignee: Portage team <dev-portage>
Status: RESOLVED INVALID    
Severity: normal    
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Jeremy Huddleston (RETIRED) gentoo-dev 2003-12-14 15:49:56 UTC
I'd like to be able to do something like this in my ebuilds:

if [ `use debug` ] ; then
  inherit debug
fi

But this doesn't seem to work... am I simply doing it incorrectly?  Also, it would be nice to have an auto-inherited eclass that lives outside the portage tree so that I could do things like the above code or things like:

if [ `use aggressivecflags` ]; then
  CFLAGS="${CFLAGS} -O3 -fomit-frame-pointer"
fi

this would allow for a somewhat more dynamic control than the current make.conf

Reproducible: Always
Steps to Reproduce:
1.
2.
3.




Portage 2.0.49-r15 (default-x86-1.4, gcc-3.2.3, glibc-2.3.2-r3, 2.4.
22-gentoo-r1)
=================================================================
System uname: 2.4.22-gentoo-r1 i686 Celeron (Mendocino)
Gentoo Base System version 1.4.3.10p1
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CFLAGS="-march=pentium2 -mcpu=pentium2 -O3 -pipe -fomit-frame-pointer 
-falign-functions=4 -falign-jumps=4 -falign-loops=4"
CHOST="i686-pc-linux-gnu"
COMPILER="gcc3"
CONFIG_PROTECT="/etc /var/qmail/control /usr/kde/2/share/config 
/usr/kde/3/share/config /var/bind /usr/X11R6/lib/X11/xkb /usr/kde/3.
1/share/config /usr/share/texmf/tex/generic/config/ 
/usr/share/texmf/tex/platex/config/ /usr/share/config"
CONFIG_PROTECT_MASK="/etc/gconf /etc/afs/C /etc/afs/afsws /etc/env.d"
CXXFLAGS="-march=pentium2 -mcpu=pentium2 -O3 -pipe -fomit-frame-pointer 
-falign-functions=4 -falign-jumps=4 -falign-loops=4"
DISTDIR="/usr/local/download/portage/distfiles"
FEATURES="ccache autoaddcvs sandbox buildpkg userpriv usersandbox"
GENTOO_MIRRORS="http://gentoo.oregonstate.edu http://distro.ibiblio.
org/pub/Linux/distributions/gentoo"
MAKEOPTS="-j2"
PKGDIR="/usr/local/download/portage/packages-pentium2"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/download/portage"
SYNC="rsync://localhost/gentoo-portage"
USE="x86 oss apm avi crypt cups encode foomaticdb gif gtk2 jpeg libg++ mad 
mikmod mpeg ncurses nls pdflib png quicktime spell truetype xml2 xmms xv zlib 
directfb gtkhtml alsa gdbm berkdb slang readline arts tetex aalib nas bonobo 
svga ggi tcltk guile ruby mysql postgres X sdl gpm tcpd pam libwww ssl perl 
python esd imlib oggvorbis gnome gtk qt kde motif opengl mozilla gphoto2 ldap 
snmp cdr scanner 3ds acl altivec amd apache2 ardour-ksi artswrappersuid atlas 
autofs avantgo bidi bindist caps cgi clamav clisp cmucl cscope curl dedicated 
dga dnd doc dv dvd dvdr emacs emacs-w3 ethereal evo expat faad fam fax fbcon 
fbdev ffmpeg flash freetype fs gb gcl gd gd-external glut gmtfull gmthigh 
gmtsuppl gmttria gnomedb gps gstreamer hbci icc imagemagick imap imlib2 innodb 
ipalias ipv6 jack java javascript jbig jikes joystick js junit justify kerberos 
ladcca lcd lcms ldam leim libdsk libg libgda lids lirc lmtp ltsp lua lucid 
maildir matroska mcal md5sum menu milter mmx mng mozaccess mozcalendar mozctl 
mozinterfaceinfo mozp3p mozsvg mozxmlterm mpi msn mule music neXt nvidia nviz 
oav objc oci8 odbc offensive ofx oldworld openal openssh parse-clocks passfile 
pcap pcmcia pda php pic plotutils pnp ppds prelude psyco qhull rplay ruby18 S3TC 
samba sasl sdk skey slp socks5 sox sqlite src tiff transcode transparent-proxy 
trusted type1 unicode usb videos vim-with-x wmf wxwin wxwindows X509 Xaw3d 
xchattext xine xinerama xml xosd xvid yahoo zeo"
Comment 1 Nicholas Jones (RETIRED) gentoo-dev 2003-12-20 17:08:27 UTC
Wrapping an inherit call in bash conditionals
isn't supported. And 'if use debug' is prefered to
using a [ "" ] style.

As far as it working, it should, although it violates DB
key limitations. Try it per normal.

You can always specify CFLAGS in your make.conf or command line.
Comment 2 Jeremy Huddleston (RETIRED) gentoo-dev 2003-12-20 22:29:20 UTC
Uhm... I don't think you got what I'm saying here... it's simply a feature request, so I know it can't be done in current portage, but I think it would be useful (maybe something for portage-ng if it is too much for current portage).

The debug eclass is not automatically inherited when the debug use flag is active, but it would be nice to have it automatically inherited (or atleast the option to).

As for putting the CFLAGS in make.conf or in the environment when calling emerge, I know about that, but as I showed that is very limiting.  It would be nice to have a way to setup different CFLAGS (and other variables) based on the package or USE flags.
Comment 3 Nicholas Jones (RETIRED) gentoo-dev 2003-12-22 23:23:20 UTC
Make the eclass handle the flag.
INHERIT is a DB key. It cannot be conditionalized.

Submit the "inherit wherever/however I please" to either the
portage-ng list if you really have reason/motive to have it
added. I do not like the idea.