<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "http://bugs.gentoo.org/bugzilla.dtd">

<bugzilla version="2.22.7"
          urlbase="http://bugs.gentoo.org/"
          maintainer="bugzilla@gentoo.org"
>

    <bug>
          <bug_id>56840</bug_id>
          
          <creation_ts>2004-07-12 16:14 0000</creation_ts>
          <short_desc>portage does not resolve || ( pkg1 pkg2 ....) as advertised</short_desc>
          <delta_ts>2004-07-31 16:36:33 0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>Gentoo Linux</product>
          <component>Unspecified</component>
          <version>unspecified</version>
          <rep_platform>All</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>ewill3@earthlink.net</reporter>
          <assigned_to>karltk@gentoo.org</assigned_to>
          

      

      
          <long_desc isprivate="0">
            <who>ewill3@earthlink.net</who>
            <bug_when>2004-07-12 16:14:09 0000</bug_when>
            <thetext>I&apos;m not sure which variant of motif eclipse needs (it also failed on lesstif) but without either openmotif or lesstif on the box eclipse-sdk downloaded and still tried to build, with rather less than spectacular results mostly related to missing Xm/Xm*.h include files.


Reproducible: Always
Steps to Reproduce:
1. emerge eclipse-sdk (without emerging openmotif or lesstif first).
2.
3.

Actual Results:  
eclipse fails to build spewing out error messages relating to Xm/Xm*.h and
thence routine names relating to Xm (Motif/Lesstif).  (I don&apos;t have them handy
as I&apos;m trying again using openmotif and forgot to save them.  Argh!)

Expected Results:  
The build should either include what it needs or complain up front.  I&apos;m not
sure which.

# emerge info
Portage 2.0.50-r8 (default-x86-2004.0, gcc-3.3.3, glibc-2.3.3.20040420-r0,
2.4.25-gentoo-r4)
=================================================================
System uname: 2.4.25-gentoo-r4 i686 Intel(R) Xeon(TM) CPU 1.70GHz
Gentoo Base System version 1.4.16
distcc 2.13 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632)
[disabled]Autoconf: sys-devel/autoconf-2.59-r3
Automake: sys-devel/automake-1.8.3
ACCEPT_KEYWORDS=&quot;x86&quot;
AUTOCLEAN=&quot;yes&quot;
CFLAGS=&quot;-O2 -mcpu=i686 -pipe -fomit-frame-pointer&quot;
CHOST=&quot;i686-pc-linux-gnu&quot;
COMPILER=&quot;gcc3&quot;
CONFIG_PROTECT=&quot;/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config
/usr/kde/3.2/share/config /usr/kde/3/share/config /usr/lib/mozilla/defaults/pref
/usr/share/config /var/lib/jboss /var/qmail/control&quot;
CONFIG_PROTECT_MASK=&quot;/etc/gconf /etc/terminfo /etc/env.d&quot;
CXXFLAGS=&quot;-O2 -mcpu=i686 -pipe -fomit-frame-pointer&quot;
DISTDIR=&quot;/usr/portage/distfiles&quot;
FEATURES=&quot;autoaddcvs ccache sandbox&quot;
GENTOO_MIRRORS=&quot;http://gentoo.oregonstate.edu
http://distro.ibiblio.org/pub/Linux/distributions/gentoo&quot;
MAKEOPTS=&quot;-j2&quot;
PKGDIR=&quot;/usr/portage/packages&quot;
PORTAGE_TMPDIR=&quot;/var/tmp&quot;
PORTDIR=&quot;/usr/portage&quot;
PORTDIR_OVERLAY=&quot;&quot;
SYNC=&quot;rsync://rsync.gentoo.org/gentoo-portage&quot;
USE=&quot;X Xaw3d alsa apache2 apm arts avi berkdb bonobo cdr crypt cups dvd encode
esd flash foomaticdb gdbm gif gnome gpm gtk gtk2 gtkhtml imap imlib java jpeg
kde kerberos ldap libg++ libwww mad mikmod motif mozilla mpeg ncurses nls oci8
oggvorbis opengl oss pam pdflib perl png python qt quicktime readline samba sdl
slang snmp spell ssl svg svga tcltk tcpd tiff truetype unicode x86 xml2 xmms xv
zlib&quot;</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>karltk@gentoo.org</who>
            <bug_when>2004-07-17 11:37:06 0000</bug_when>
            <thetext>This seems to be a bug in Portage.

Consider the package dev-util/eclipse-sdk-2.1.3-r4:

RDEPEND=&quot;&gt;=virtual/jdk-1.3
        || (
                gtk? ( &gt;=x11-libs/gtk+-2.2.4 )
                kde? ( kde-base/kdelibs x11-libs/openmotif )
                motif? ( x11-libs/openmotif )
                &gt;=x11-libs/gtk+-2.2.4
                )
        gnome? ( =gnome-base/gnome-vfs-2* )
        mozilla? ( net-www/mozilla )
        jikes? ( &gt;=dev-java/jikes-1.19 )
        &quot;

DEPEND=&quot;${RDEPEND}
        &gt;=dev-java/ant-1.5.3
        &gt;=sys-apps/findutils-4.1.7
        &gt;=app-shells/tcsh-6.11
        app-arch/unzip&quot;

According to Mr_Bones and the Portage man pages, the || ( ) should be 
attempted satisfied in order of appearance.

Given gtk+ installed, but openmotif not installed, trying to merge with
only &apos;kde&apos; set, Portage will select the default case (gtk+), and not install
neither kdebase nor openmotif.

If I replace gtk+ with another package that I have not already installed,
say dev-java/groovy, Portage will select the kde? option.

It appears Portage rather selects the &quot;fewest packages&quot; instead of resolving
the list in order.

As the package later on relies heavily on which dependencies were installed,
and picks them out from the USE flag list (using &apos;use&apos;), this breaks.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>karltk@gentoo.org</who>
            <bug_when>2004-07-17 11:37:33 0000</bug_when>
            <thetext>Portage 2.0.51_pre13 (default-x86-2004.0, gcc-3.3.3, glibc-2.3.3.20040420-r0, 2.6.7-gentoo-r1 i686 Intel(R) Pentium(R) M processor 1400MHz)
</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>jstubbs@gentoo.org</who>
            <bug_when>2004-07-17 18:35:19 0000</bug_when>
            <thetext>This is a documentation bug rather than a code bug. In ebuild(5) there are two examples. The first says that the order does not matter and the second one says it does. The following is how it really works:

RDEPEND=&quot;|| (
                gtk? ( &gt;=x11-libs/gtk+-2.2.4 )
                kde? ( kde-base/kdelibs x11-libs/openmotif )
                motif? ( x11-libs/openmotif )
                &gt;=x11-libs/gtk+-2.2.4
                )&quot;

Portage will remove entries for which USE flags aren&apos;t enabled and then prefer any package that is already installed. If none are installed, the first in the list is taken. For example, USE=&quot;-gtk kde motif&quot;, x11-libs/openmotif is installed but kde-base/kdelibs is installed - portage selects &quot;motif? ( x11-libs/openmotif )&quot;.

If this is not the behaviour that is wanted, the order should be explicitly specified, such as:

RDEPEND=&quot;gtk? ( &gt;=x11-libs/gtk+-2.2.4 )
        !gtk? ( kde? ( kde-base/kdelibs x11-libs/openmotif )
               !kde? ( motif? ( x11-libs/openmotif )
                      !motif? ( &gt;=x11-libs/gtk+-2.2.4 ) ) )&quot;

Alternately, using the first method, an ebuild could figure out which deps should be used with code similar to the following:

MYUSE=&quot;&quot;
if use gtk &amp;&amp; has_version &apos;&gt;=x11-libs/gtk+-2.2.4&apos;
then
  MYUSE=&quot;gtk&quot;
else
  if use kde &amp;&amp; has_version &apos;kde-base/kdelibs&apos; &amp;&amp; has_version &apos;x11-libs/openmotif&apos;
  then
    MYUSE=&quot;kde&quot;
  else
    if use motif &amp;&amp; has_version &apos;x11-libs/openmotif&apos;
      MYUSE=&quot;motif&quot;
    fi
  fi
fi

if [ -z &quot;${MYUSE}&quot; ]
then
  if use gtk
  then
    MYUSE=&quot;gtk&quot;
  else
    if use kde
    then
      MYUSE=&quot;kde&quot;
    else
      if use motif
      then
        MYUSE=&quot;motif&quot;
      else
        MYUSE=&quot;gtk&quot;
      fi
    fi
  fi
fi</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>jstubbs@gentoo.org</who>
            <bug_when>2004-07-17 19:16:46 0000</bug_when>
            <thetext>I missed a &quot;not&quot; in the above...

USE=&quot;-gtk kde motif&quot;, x11-libs/openmotif is installed but kde-base/kdelibs is NOT installed - portage selects &quot;motif? ( x11-libs/openmotif )&quot;.
</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>karltk@gentoo.org</who>
            <bug_when>2004-07-20 06:20:01 0000</bug_when>
            <thetext>I&apos;ll take it back an rework it. Thanks.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>karltk@gentoo.org</who>
            <bug_when>2004-07-28 07:15:15 0000</bug_when>
            <thetext>Fixed for 3.0.0. Need to fix it for 2.1.3, too.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>karltk@gentoo.org</who>
            <bug_when>2004-07-31 16:36:33 0000</bug_when>
            <thetext>Fixed for 2.1.3 as well (in -r5).</thetext>
          </long_desc>
      
    </bug>

</bugzilla>