Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 56840 - portage does not resolve || ( pkg1 pkg2 ....) as advertised
Summary: portage does not resolve || ( pkg1 pkg2 ....) as advertised
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Unspecified (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Karl Trygve Kalleberg (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-07-12 16:14 UTC by eric.williams
Modified: 2004-07-31 16:36 UTC (History)
0 users

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description eric.williams 2004-07-12 16:14:09 UTC
I'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't have them handy
as I'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'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="x86"
AUTOCLEAN="yes"
CFLAGS="-O2 -mcpu=i686 -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
COMPILER="gcc3"
CONFIG_PROTECT="/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"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-O2 -mcpu=i686 -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs ccache sandbox"
GENTOO_MIRRORS="http://gentoo.oregonstate.edu
http://distro.ibiblio.org/pub/Linux/distributions/gentoo"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY=""
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="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"
Comment 1 Karl Trygve Kalleberg (RETIRED) gentoo-dev 2004-07-17 11:37:06 UTC
This seems to be a bug in Portage.

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

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

DEPEND="${RDEPEND}
        >=dev-java/ant-1.5.3
        >=sys-apps/findutils-4.1.7
        >=app-shells/tcsh-6.11
        app-arch/unzip"

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 'kde' 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 "fewest packages" 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 'use'), this breaks.
Comment 2 Karl Trygve Kalleberg (RETIRED) gentoo-dev 2004-07-17 11:37:33 UTC
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)
Comment 3 Jason Stubbs (RETIRED) gentoo-dev 2004-07-17 18:35:19 UTC
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="|| (
                gtk? ( >=x11-libs/gtk+-2.2.4 )
                kde? ( kde-base/kdelibs x11-libs/openmotif )
                motif? ( x11-libs/openmotif )
                >=x11-libs/gtk+-2.2.4
                )"

Portage will remove entries for which USE flags aren'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="-gtk kde motif", x11-libs/openmotif is installed but kde-base/kdelibs is installed - portage selects "motif? ( x11-libs/openmotif )".

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

RDEPEND="gtk? ( >=x11-libs/gtk+-2.2.4 )
        !gtk? ( kde? ( kde-base/kdelibs x11-libs/openmotif )
               !kde? ( motif? ( x11-libs/openmotif )
                      !motif? ( >=x11-libs/gtk+-2.2.4 ) ) )"

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

MYUSE=""
if use gtk && has_version '>=x11-libs/gtk+-2.2.4'
then
  MYUSE="gtk"
else
  if use kde && has_version 'kde-base/kdelibs' && has_version 'x11-libs/openmotif'
  then
    MYUSE="kde"
  else
    if use motif && has_version 'x11-libs/openmotif'
      MYUSE="motif"
    fi
  fi
fi

if [ -z "${MYUSE}" ]
then
  if use gtk
  then
    MYUSE="gtk"
  else
    if use kde
    then
      MYUSE="kde"
    else
      if use motif
      then
        MYUSE="motif"
      else
        MYUSE="gtk"
      fi
    fi
  fi
fi
Comment 4 Jason Stubbs (RETIRED) gentoo-dev 2004-07-17 19:16:46 UTC
I missed a "not" in the above...

USE="-gtk kde motif", x11-libs/openmotif is installed but kde-base/kdelibs is NOT installed - portage selects "motif? ( x11-libs/openmotif )".
Comment 5 Karl Trygve Kalleberg (RETIRED) gentoo-dev 2004-07-20 06:20:01 UTC
I'll take it back an rework it. Thanks.
Comment 6 Karl Trygve Kalleberg (RETIRED) gentoo-dev 2004-07-28 07:15:15 UTC
Fixed for 3.0.0. Need to fix it for 2.1.3, too.
Comment 7 Karl Trygve Kalleberg (RETIRED) gentoo-dev 2004-07-31 16:36:33 UTC
Fixed for 2.1.3 as well (in -r5).