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

Bug 249166

Summary: use dependencies should allow specification of default assumptions about flags missing from IUSE
Product: Gentoo Linux Reporter: Pacho Ramos <pacho>
Component: Current packagesAssignee: PMS/EAPI <pms>
Status: RESOLVED FIXED    
Severity: normal CC: esigra, kde
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://bugs.gentoo.org/show_bug.cgi?id=916952
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 174380, 245954    

Description Pacho Ramos gentoo-dev 2008-11-28 13:59:09 UTC
I have merged kile with LINGUAS="es":
[ebuild   R   ] app-editors/kile-2.0.2  USE="-debug -kde -xinerama" LINGUAS="es -ar -bg -br -ca -cs -cy -da -de -el -en_GB -et -eu -fi -fr -ga -gl -hi -hu -is -it -ja -lt -ms -mt -nb -nds -nl -nn -pa -pl -pt -pt_BR -ro -ru -rw -sk -sr -sr@Latn -sv -ta -th -tr -uk -zh_CN" 5,311 kB

But it also needs kde-i18n for being fully translated, if it's not installed, most of menus are still in english

Thanks a lot

Portage 2.1.6_rc2 (default/linux/amd64/2008.0/desktop, gcc-4.1.2, glibc-2.6.1-r0, 2.6.27-gentoo-r4 x86_64)
=================================================================
System uname: Linux-2.6.27-gentoo-r4-x86_64-AMD_Athlon-tm-_64_Processor_3200+-with-glibc2.2.5
Timestamp of tree: Thu, 27 Nov 2008 19:37:03 +0000
ccache version 2.4 [enabled]
app-shells/bash:     3.2_p33
dev-java/java-config: 1.3.7, 2.1.6
dev-lang/python:     2.5.2-r7
dev-util/ccache:     2.4-r7
dev-util/cmake:      2.4.8
sys-apps/baselayout: 1.12.11.1
sys-apps/sandbox:    1.2.18.1-r2
sys-devel/autoconf:  2.13, 2.61-r2
sys-devel/automake:  1.5, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10.1-r1
sys-devel/binutils:  2.18-r3
sys-devel/gcc-config: 1.4.0-r4
sys-devel/libtool:   1.5.26
virtual/os-headers:  2.6.23-r3
ACCEPT_KEYWORDS="amd64"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=k8 -O2 -pipe -msse3"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/config /var/lib/hsqldb"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/revdep-rebuild /etc/terminfo /etc/texmf/web2c /etc/udev/rules.d"
CXXFLAGS="-march=k8 -O2 -pipe -msse3"
DISTDIR="/usr/distfiles"
FEATURES="autoaddcvs ccache collision-protect cvs distlocks fixpackages multilib-strict parallel-fetch protect-owned sandbox sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="ftp://ftp.free.fr/mirrors/ftp.gentoo.org"
LANG="es_ES.UTF-8"
LC_ALL="es_ES.UTF-8"
LDFLAGS="-Wl,-O1"
LINGUAS="es es_ES en_US"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage/layman/sunrise /usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="3dnow 3dnowext X a52 aac acl acpi alsa amd64 amr asf audiofile avahi bash-completion beagle berkdb bzip2 bzlib cairo caps cdb cdda cddb cdinstall cdparanoia cdr cli consolekit cpdflib cpudetection cracklib cross crypt css cups curl daap dbus dga dirac divx4linux djvu dlloader dri dts dv dvb dvd dvdr dvdread dvi eds emboss encode epiphany erandom escreen evo evolution exif fam fame fbcon ffmpeg flac foomaticdb fortran ftp fuse galago gb gcj gd ggi gif gimp gimpprint git glitz glut glx gnome gnome-keyring gnome-print gphoto2 gpm gsm gstreamer gtk gtk2 hal hddtemp iconv idn imagemagick imlib inotify isdnlog ithreads jabber java java6 jpeg kdeenablefinal kdehiddenvisibility kpathsea ladspa lame latex lcms libnotify lm_sensors logrotate lzma mad madwifi midi mikmod mime mjpeg mmx mmxext mng mono moonlight motif mp3 mpeg mpi mplayer mudflap multilib musepack musicbrainz nas nautilus ncurses nethack network nls nocardbus nptl nptlonly ntp nvidia ogg oggvorbis openal opengl openmp pam pango pch pcre pdf perl plotutils png posix postscript ppds pppd python qt3 qt3support qt4 quicktime readline reflection remote rtc scanner schroedinger scrobbler sdl session slang slp sockets speex spell spl sse sse2 sse3 ssl ssse3 startup-notification subversion svg sysfs sysvipc t1lib tcpd theora threads thunderbird tiff timidity totem trayicon truetype unicode usb v4l2 vcd vhook videos vim vorbis wma wmf x264 xattr xcb xcomposite xft xine xml xml2 xorg xpm xulrunner xv xvid xvmc zlib" ALSA_CARDS="via82xx" 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 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" ELIBC="glibc" INPUT_DEVICES="keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="es es_ES en_US" USERLAND="GNU" VIDEO_CARDS="nvidia nv vesa fbdev vga"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS


Reproducible: Always
Comment 1 Carsten Lohrke (RETIRED) gentoo-dev 2009-02-22 14:09:04 UTC
This is basically a shortcomming of the current USE_EXPAND system. Requiring to have the dead ugly IUSE+=linguas_FOO additions before setting the dependencies, to be able to test accordingly is even more messy.

Well, this affects lots of packages...
Comment 2 Tomáš Chvátal (RETIRED) gentoo-dev 2009-02-22 14:25:31 UTC
Well kde4 eclasses tell the user to emerge the package if detect some misc package with linguas enabled.
Maybe we should do the same for kde3 :]
Comment 3 Carsten Lohrke (RETIRED) gentoo-dev 2009-02-22 16:20:37 UTC
This is equally broken, since it requires user interaction, Thomas.

The requirement is "foo[?bar?baz?]" with foo _not_ being a dependency in the case neither bar nor baz being enabled. I could live with another modifier than the first "?" of course (e.g. "*" and maybe also "+" to denote "one of" with the latter requiring at least one use flag to be set, which would be really useful), but this is more a deficiency in Portage, otherwise the following example code excerpt would work, without adding the kde-i18n dependency, unless needed.

LANGS="de es fr it
LANGS_IUSE=""
for X in ${LANGS} ; do
        LANGS_IUSE="${LANGS_IUSE} linguas_${X}"
done

IUSE="${IUSE} ${LANGS_IUSE}"

if [ -n "${LANGS_IUSE}" ] ; then
        RDEPEND="${RDEPEND}
                kde-base/kde-i18n[`echo ${LANGS_IUSE} |sed -e "s: :?,:g"`?]"
fi


The more I think about it, this is a Portage issue. Not tex specific, so un'cc'ing you, tex team. Please readd yourself, in case you're interested in this bug.
Comment 4 Tomáš Chvátal (RETIRED) gentoo-dev 2009-02-22 16:30:35 UTC
Well with usedep it is maybe good idea but then you get to the dependency issue due to not knowing if i18n and l10n has the specified lingua in iuse. :(
I will ask Zac about it... Will report his suggestions later :]
Comment 5 Tomáš Chvátal (RETIRED) gentoo-dev 2009-02-22 20:50:04 UTC
Ok after discusion with Zac he suggested this:
|| ( cat/app[flag] cat/app )
so result for kde4 is this:
http://git.overlays.gentoo.org/gitweb/?p=proj/kde.git;a=commit;h=d126640d3551ff1eb76073b772eb4ddaecdbcdf6

for kde3 we have to eapi2fy the eclass first and even then it must be sadly handled by has_use

basic eapi2fing of kde3 eclasses is sent to tampakrap and yngwin (missing src_prepare calls [can be blank ones calling only base_apply_patches]) :]
Comment 6 Ciaran McCreesh 2009-02-22 22:50:32 UTC
(In reply to comment #3)
> The requirement is "foo[?bar?baz?]" with foo _not_ being a dependency in the
> case neither bar nor baz being enabled.

So, uh, "bar? ( foo[bar][baz] ) baz? ( foo[bar][baz] )" or what?

(In reply to comment #5)
> Ok after discusion with Zac he suggested this:
> || ( cat/app[flag] cat/app )

No, that's illegal. app[flag] when app doesn't have flag explicitly listed in IUSE is undefined behaviour, and the package manager should be warning or erroring if it encounters it.
Comment 7 Zac Medico gentoo-dev 2009-02-22 23:16:44 UTC
(In reply to comment #6)
> (In reply to comment #5)
> > Ok after discusion with Zac he suggested this:
> > || ( cat/app[flag] cat/app )
> 
> No, that's illegal. app[flag] when app doesn't have flag explicitly listed in
> IUSE is undefined behaviour, and the package manager should be warning or
> erroring if it encounters it.

If the flag isn't in IUSE, portage just treats it like any other unsatisfiable dependency. Doesn't that seem reasonable?
Comment 8 Ciaran McCreesh 2009-02-22 23:20:17 UTC
(In reply to comment #7)
> If the flag isn't in IUSE, portage just treats it like any other unsatisfiable
> dependency. Doesn't that seem reasonable?

Not really. It was deliberately specified as undefined behaviour because there are several 'reasonable' interpretations of what it could mean. You could just as easily argue that if there's no flag, the package manager should pretend that flag is there but off.
Comment 9 Zac Medico gentoo-dev 2009-02-22 23:30:53 UTC
(In reply to comment #8)
> You could just
> as easily argue that if there's no flag, the package manager should pretend
> that flag is there but off.

That would be a somewhat unreliable assumption to make.
Comment 10 Ciaran McCreesh 2009-02-22 23:34:38 UTC
(In reply to comment #9)
> (In reply to comment #8)
> > You could just
> > as easily argue that if there's no flag, the package manager should pretend
> > that flag is there but off.
> 
> That would be a somewhat unreliable assumption to make.

*Any* assumption is unreliable, which is why it's specified as being undefined behaviour, and why the package manager should yell if it encounters it.
Comment 11 David Leverton 2009-02-22 23:46:22 UTC
(In reply to comment #5)
> Ok after discusion with Zac he suggested this:
> || ( cat/app[flag] cat/app )

Isn't that the same as cat/app anyway?  If cat/app[flag] isn't satisfied, then the package manager will fall back on plain cat/app, so the state of flag ultimately doesn't matter.

Based on the IRC discussion in my backlog, it sounds as though you want an equivalent of built_with_use --missing for use deps.  In Exherbo we're using cat/app[flag(+)], with the (+) meaning --missing true, and (-) for --missing false.
Comment 12 Carsten Lohrke (RETIRED) gentoo-dev 2009-02-22 23:53:54 UTC
(In reply to comment #5)
> Ok after discusion with Zac he suggested this:
> || ( cat/app[flag] cat/app )

Hu? No.


(In reply to comment #6)
> So, uh, "bar? ( foo[bar][baz] ) baz? ( foo[bar][baz] )" or what?

No, basically a flag indicating foo is not part of the dependency list, when none of bar, baz are set. Or to put it in some pseudo code

"USE=[bar,-baz]" --> "foo[?bar?,baz?]" --> "foo[bar]"
"USE=[-bar,-baz]" --> "foo[?bar?,baz?]" --> ""
Comment 13 Ciaran McCreesh 2009-02-23 00:00:56 UTC
(In reply to comment #12)
> (In reply to comment #6)
> > So, uh, "bar? ( foo[bar][baz] ) baz? ( foo[bar][baz] )" or what?
> 
> No, basically a flag indicating foo is not part of the dependency list, when
> none of bar, baz are set. Or to put it in some pseudo code
> 
> "USE=[bar,-baz]" --> "foo[?bar?,baz?]" --> "foo[bar]"
> "USE=[-bar,-baz]" --> "foo[?bar?,baz?]" --> ""

So...

    bar?  ( baz? ( foo[bar,baz] ) !baz? ( foo[bar] ) )
    !bar? ( baz? ( foo[bar,baz] ) !baz? ( ) )

or something? Expand it fully please, I'm still not really sure what you're trying to do.
Comment 14 Carsten Lohrke (RETIRED) gentoo-dev 2009-02-23 00:21:35 UTC
(In reply to comment #13)
> So...
> 
>     bar?  ( baz? ( foo[bar,baz] ) !baz? ( foo[bar] ) )
>     !bar? ( baz? ( foo[bar,baz] ) !baz? ( ) )
> 
> or something? Expand it fully please, I'm still not really sure what you're
> trying to do.
> 

Exactly, only the result of

!bar? ( !baz? ( ) ))

is required to be empty, instead of foo without use flags set. Not that it wouldn't be "fun" to torture Portage with 20 or 30 use expanded dependencies trying to express this with a forrest of deeply nested parentheses...
Comment 15 Ciaran McCreesh 2009-02-23 00:28:40 UTC
Just use the fully expanded form. The shortcuts are only there for the very common cases -- anything more complicated doesn't get a shortcut.
Comment 16 Tomáš Chvátal (RETIRED) gentoo-dev 2011-04-19 20:46:13 UTC
# add a dependency over kde-l10n if EAPI4 is around
if [[ ${KDEBASE} != "kde-base" ]] && [[ -n ${KDE_LINGUAS} ]] && has "${EAPI:-0}" 4; then
        usedep=''
        for _lingua in ${KDE_LINGUAS}; do
                [[ -n ${usedep} ]] && usedep+=","
                usedep+="linguas_${_lingua}(+)?"
        done
        # if our package has lignuas pull in kde-l10n with selected lingua
        kderdepend+=" $(add_kdebase_dep kde-l10n ${usedep})"
        unset usedep _lingua
fi


So we can consider this fixed in eapi4...
Comment 17 Zac Medico gentoo-dev 2011-04-20 04:10:17 UTC
(In reply to comment #16)
> So we can consider this fixed in eapi4...

Right, EAPI 4-style USE-DEP-DEFAULTS in section 9.2.5.4 of PMS.