Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 382421 - Circular dependencies between dev-java/ant-core, virtual/jdk, dev-java/icedtea
Summary: Circular dependencies between dev-java/ant-core, virtual/jdk, dev-java/icedtea
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Java (show other bugs)
Hardware: AMD64 Linux
: Normal normal with 1 vote (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
: 290251 390117 415139 421095 560434 623888 (view as bug list)
Depends on: 384107
Blocks: icedtea-tracker 705986 706142
  Show dependency tree
 
Reported: 2011-09-09 19:25 UTC by Marian Kyral
Modified: 2020-04-21 07:43 UTC (History)
8 users (show)

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 Marian Kyral 2011-09-09 19:25:43 UTC
I'm trying to install dev-java/icedtea, no other java/jdk installed.
Emerge complain about circular dependencies:


# emerge -av dev-java/icedtea

These are the packages that would be merged, in order:

Calculating dependencies... done!


[nomerge       ] dev-java/icedtea-6.1.10.3  USE="hs20 nsplugin nss webstart xrender -cacao -debug -doc -examples -jamvm -javascript -nio2 -pulseaudio -systemtap -zero" 
[ebuild  N     ]  dev-java/icedtea-web-1.1.2  USE="nsplugin -build -doc" 789 kB
[ebuild  N     ]   dev-java/icedtea-6.1.10.3  USE="hs20 nsplugin nss webstart xrender -cacao -debug -doc -examples -jamvm -javascript -nio2 -pulseaudio -systemtap -zero" 70,143 kB
[ebuild  N     ]    dev-java/xalan-2.7.1  USE="-doc -source" 0 kB
[ebuild  N     ]     dev-java/xerces-2.9.1  USE="-doc -examples -source" 0 kB
[ebuild  N     ]      dev-java/xml-commons-resolver-1.2  USE="-doc -source" 0 kB
[ebuild  N     ]      dev-java/xjavac-20041208-r5  0 kB
[ebuild  N     ]     dev-java/javacup-0.11a_beta20060608  USE="-doc -source" 0 kB
[ebuild  N     ]     dev-java/bcel-5.2-r2  USE="-doc -findbugs -source" 0 kB
[ebuild  N     ]    dev-java/ant-nodeps-1.8.1  0 kB
[nomerge       ] dev-java/xalan-2.7.1  USE="-doc -source" 
[ebuild  N     ]  dev-java/xalan-serializer-2.7.1  USE="-doc -source" 0 kB
[ebuild  N     ]   dev-java/xml-commons-external-1.3.04  USE="-doc -source" 0 kB
[ebuild  N     ]    dev-java/ant-core-1.8.1  USE="-doc -source" 0 kB
[ebuild  N     ]     virtual/jdk-1.6.0  0 kB

Total: 13 packages (13 new), Size of downloads: 70,932 kB

 * Error: circular dependencies:

(dev-java/xalan-2.7.1::gentoo, ebuild scheduled for merge) depends on
 (virtual/jdk-1.6.0::gentoo, ebuild scheduled for merge) (buildtime)
  (dev-java/icedtea-6.1.10.3::gentoo, ebuild scheduled for merge) (runtime)
   (dev-java/xalan-2.7.1::gentoo, ebuild scheduled for merge) (buildtime)

 * Note that circular dependencies can often be avoided by temporarily
 * disabling USE flags that trigger optional dependencies.  

Reproducible: Always

Steps to Reproduce:
1. Uninstall all java/jdk packages
2. emerge -av dev-java/icedtea
Actual Results:  
Error: circular dependencies

Expected Results:  
dev-java/icedtea merged

# emerge --info
Portage 2.2.0_alpha54 (default/linux/amd64/10.0/desktop/kde, gcc-4.5.3, glibc-2.13-r4, 3.0.4-gentoo x86_64)
=================================================================
System uname: Linux-3.0.4-gentoo-x86_64-Intel-R-_Core-TM-2_Duo_CPU_T7250_@_2.00GHz-with-gentoo-2.0.3
Timestamp of tree: Thu, 08 Sep 2011 20:30:01 +0000
app-shells/bash:          4.2_p10
dev-java/java-config:     2.1.11-r3
dev-lang/python:          2.7.2-r2, 3.1.4-r2, 3.2-r2
dev-util/cmake:           2.8.5-r2
dev-util/pkgconfig:       0.26
sys-apps/baselayout:      2.0.3
sys-apps/openrc:          0.9.2
sys-apps/sandbox:         2.5
sys-devel/autoconf:       2.13, 2.68
sys-devel/automake:       1.9.6-r3, 1.10.3, 1.11.1-r1
sys-devel/binutils:       2.21.1-r1
sys-devel/gcc:            4.5.3-r1
sys-devel/gcc-config:     1.4.1-r1
sys-devel/libtool:        2.4-r1
sys-devel/make:           3.82-r1
sys-kernel/linux-headers: 2.6.39 (virtual/os-headers)
sys-libs/glibc:           2.13-r4
Repositories: gentoo sunrise kde mozilla local-repo
Installed sets: @system
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=core2 -O2 -pipe"
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 /usr/share/gnupg/qualified.txt /usr/share/themes/oxygen-gtk/gtk-2.0"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.3/ext-active/ /etc/php/cgi-php5.3/ext-active/ /etc/php/cli-php5.3/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-march=core2 -O2 -pipe"
DISTDIR="/var/portage/distfiles/"
EMERGE_DEFAULT_OPTS="--keep-going"
FEATURES="assume-digests binpkg-logs distlocks ebuild-locks fixlafiles fixpackages news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv"
FFLAGS=""
GENTOO_MIRRORS="http://gentoo.mirror.web4u.cz/ http://gentoo.supp.name"
LANG="cs_CZ.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="cs"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_EXTRA_OPTS="--quiet"
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="/var/lib/layman/sunrise /var/lib/layman/kde /var/lib/layman/mozilla /usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X a52 aac acl acpi alsa amd64 bash-completion berkdb branding bzip2 cairo cdda cddb cdparanoia cdr cli consolekit cracklib css cups curl cxx dbus declarative dri dts dv dvd dvdr emboss encode enscript exif fam ffmpeg firefox flac foomaticdb fortran ftp gdbm gdu gif gimp gnutls gpm gstreamer gtkhtml iconv ieee1394 imagemagick ipv6 jabber jpeg kde kipi lame lcms libnotify lzo mad matroska mbox mime mjpeg mmx mng modules mp3 mp4 mpeg mplayer mudflap multilib musepack mysql ncurses nls nptl nptlonly nsplugin ntpl ogg openal opengl openmp pam pango pcre pdf perl phonon plasma png policykit posix ppds pppd python qt3 qt3support qt4 quicktime raw readline rss sdl semantic-desktop session slang smp sox spell sqlite sse sse2 ssl startup-notification svg sysfs syslog taglib tcpd theora threads tidy tiff truetype udev unicode usb vcd vorbis wavpack webkit wifi wmf wxwindows x264 xcb xcomposite xine xml xorg xosd xpm xscreensaver xsl xulrunner xv xvid zlib" ALSA_CARDS="hda-intel" 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" CALLIGRA_FEATURES="kexi words flow plan stage tables krita karbon braindump" CAMERAS="ptp2" 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 synaptics evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="cs" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="nv nvidia vesa" 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, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS
Comment 1 Vlastimil Babka (Caster) (RETIRED) gentoo-dev 2011-09-09 22:47:33 UTC
Please emerge icedtea6-bin and virtual/jdk before icedtea
Comment 2 Marian Kyral 2011-09-10 03:52:34 UTC
(In reply to comment #1)
> Please emerge icedtea6-bin and virtual/jdk before icedtea

icedtea6-bin merged, but virtual/jdk requires oracle-jdk.

# eix -I icedtea
[I] dev-java/icedtea6-bin
     Available versions:  1.10.2!s 1.10.3!s {X alsa doc examples nsplugin source}
     Installed versions:  1.10.3!s(21:13:07 9.9.2011)(X alsa nsplugin -doc -examples -source)
     Homepage:            http://icedtea.classpath.org
     Description:         A Gentoo-made binary build of the icedtea6 JDK

# emerge virtual/jdk
Calculating dependencies... done!

>>> Verifying ebuild manifests

>>> Starting parallel fetch

>>> Emerging (1 of 2) dev-java/oracle-jdk-bin-1.7.0
 * Fetching files in the background. To view fetch progress, run
 * `tail -f /var/log/emerge-fetch.log` in another terminal.

!!! dev-java/oracle-jdk-bin-1.7.0 has fetch restriction turned on.
!!! This probably means that this ebuild's files must be downloaded
!!! manually.  See the comments in the ebuild for more information.

 * Fetch failed for 'dev-java/oracle-jdk-bin-1.7.0', Log file:
 *  '/var/tmp/portage/dev-java/oracle-jdk-bin-1.7.0/temp/build.log'
 * Please download jdk-7-linux-x64.tar.gz from:
 * http://www.oracle.com/technetwork/java/javase/downloads/java-se-jdk-7-download-432154.html
 * and move it to /var/portage/distfiles
!!! Error while importing logging modules while loading "mod_jabber":
No module named mod_jabber

>>> Failed to emerge dev-java/oracle-jdk-bin-1.7.0, Log file:

>>>  '/var/tmp/portage/dev-java/oracle-jdk-bin-1.7.0/temp/build.log'
*** Resuming merge...
Comment 3 Vlastimil Babka (Caster) (RETIRED) gentoo-dev 2011-09-10 10:53:19 UTC
Ok, make it 'emerge virtual/jdk:1.6' then
Comment 4 Marian Kyral 2011-09-10 12:49:09 UTC
(In reply to comment #3)
> Ok, make it 'emerge virtual/jdk:1.6' then

Thanks, it helped. But emerge -uDN still wants to emerge oracle-jdk

# emerge -uavtDN --with-bdeps=y @world

These are the packages that would be merged, in reverse order:

Calculating dependencies... done!
[nomerge       ] dev-java/icedtea-6.1.10.3  USE="hs20 nsplugin nss webstart xrender -cacao -debug -doc -examples -jamvm -javascript -nio2 -pulseaudio -systemtap -zero" 
[nomerge       ]  dev-java/ant-nodeps-1.8.1 
[ebuild  NS    ]   virtual/jre-1.7.0 [1.6.0] 0 kB
[ebuild  NS    ]    virtual/jdk-1.7.0 [1.6.0] 0 kB
[ebuild  N F   ]     dev-java/oracle-jdk-bin-1.7.0  USE="X alsa nsplugin -derby -doc -examples -jce" 92,746 kB
Comment 5 Vlastimil Babka (Caster) (RETIRED) gentoo-dev 2011-09-15 11:22:30 UTC
Zac: any idea if portage could be smarter about this?

I believe we discussed this already a while ago, but that was about why --onlydeps worked, IIRC.
How bout adding some rule to the effect of "if package A depends on a virtual B, which has || (A x y z) dependencies, don't select A to resolve this set of alternatives, unless A is already installed. For now the dependency of A on B is transitive, but it could be made direct if it helped this rule.
(A = icedtea, B = virtual/jdk. Icedtea depends on xalan, xerces, ant-nodeps, etc., that depend on virtual/jdk and other java packages that also depend on virtual/jdk (see the original comment)
Comment 6 Zac Medico gentoo-dev 2011-09-15 23:52:18 UTC
(In reply to comment #5)
> How bout adding some rule to the effect of "if package A depends on a virtual
> B, which has || (A x y z) dependencies, don't select A to resolve this set of
> alternatives, unless A is already installed. For now the dependency of A on B
> is transitive, but it could be made direct if it helped this rule.

We already have code to handle this case, and it works with new-style virtuals too. Before it got removed from the tree, dev-lang/gwydion-dylan used to use a similar approach, though it didn't use a virtual, it could have:

  DEPEND="|| ( dev-lang/gwydion-dylan-bin dev-lang/gwydion-dylan )"
Comment 7 Vlastimil Babka (Caster) (RETIRED) gentoo-dev 2011-09-16 08:55:53 UTC
(In reply to comment #6)
> We already have code to handle this case, and it works with new-style virtuals
> too. Before it got removed from the tree, dev-lang/gwydion-dylan used to use a
> similar approach, though it didn't use a virtual, it could have:
> 
>   DEPEND="|| ( dev-lang/gwydion-dylan-bin dev-lang/gwydion-dylan )"

dev-java/icedtea has this:
|| (
     ( >=dev-java/gcj-jdk-4.3 >=app-admin/eselect-ecj-0.5-r1 )
     ( >=dev-java/cacao-0.99.2 >=app-admin/eselect-ecj-0.5-r1 )
       dev-java/icedtea6-bin
       dev-java/icedtea:${SLOT}
     )

So there are 3 non-circular alternatives before the package itself. That's fine.
But it also has this:

        >=dev-java/xalan-2.7.0:0
        >=dev-java/xerces-2.9.1:2
        >=dev-java/ant-core-1.7.1-r2
        dev-java/ant-nodeps

And all of these have something like DEPEND=">=virtual/jdk-1.4" or similar.

And although jdk-1.6.0 has again:

|| (
                dev-java/icedtea6-bin
                =dev-java/icedtea-6*
                =dev-java/sun-jdk-1.6.0*
                ...
)"

(which means the -bin before non-bin), somehow this doesn't work and portage seems to decide to satisfy this by icedtea-6, (because it's already scheduled?). So somehow these transitive deps are a problem. I don't know if reordering the above blocks would help portage to fix icedtea6-bin before going through the xalan->jdk deps, or whatnot. There is probably the solution of changing all those java packages in the original post to depend on || ( icedtea6-bin virtual/jdk ) directly, but it seems rather fragile so I hope another solution can be found first :)
Comment 8 Zac Medico gentoo-dev 2011-11-10 23:52:08 UTC
*** Bug 390117 has been marked as a duplicate of this bug. ***
Comment 9 Ralph Sennhauser (RETIRED) gentoo-dev 2011-12-02 13:03:52 UTC
*** Bug 290251 has been marked as a duplicate of this bug. ***
Comment 10 Vlastimil Babka (Caster) (RETIRED) gentoo-dev 2012-03-03 23:07:33 UTC
(In reply to comment #7)
> There is probably the
> solution of changing all those java packages in the original post to depend
> on || ( icedtea6-bin virtual/jdk ) directly, but it seems rather fragile so
> I hope another solution can be found first :)

OK so with xerces/xalan no longer deps of icedtea, the last package involved is dev-java/ant-core. So I changed its deps from virtual/jdk to || ( icedtea-bin virtual/jdk ) but it doesn't work, portage will prefer the virtual/jdk (even though it's not installed) and when evaluating it, it will prefer icedtea (this going circular) instead of icedtea-bin...

[nomerge       ] dev-java/icedtea-6.1.11.1  USE="X alsa cups jbootstrap nss source -cjk -debug -doc -examples -javascript -nsplugin -pax_kernel -pulseaudio -systemtap -test -webstart" 
[ebuild  N     ]  dev-java/ant-core-1.8.2  USE="-doc -source" 0 kB
[ebuild  N     ]   virtual/jdk-1.6.0-r1  0 kB
[ebuild  N     ]    dev-java/icedtea-6.1.11.1  USE="X alsa cups jbootstrap nss source -cjk -debug -doc -examples -javascript -nsplugin -pax_kernel -pulseaudio -systemtap -test -webstart" 0 kB
Comment 11 Ralph Sennhauser (RETIRED) gentoo-dev 2012-05-08 14:14:11 UTC
*** Bug 415139 has been marked as a duplicate of this bug. ***
Comment 12 Ralph Sennhauser (RETIRED) gentoo-dev 2012-05-10 15:13:22 UTC
*** Bug 415139 has been marked as a duplicate of this bug. ***
Comment 13 Ralph Sennhauser (RETIRED) gentoo-dev 2012-06-14 13:43:28 UTC
*** Bug 421095 has been marked as a duplicate of this bug. ***
Comment 14 Maxim Kammerer 2012-07-13 15:10:06 UTC
This issue manifests with --depclean --with-bdeps n, too.
Comment 15 James Le Cuirot gentoo-dev 2015-09-14 10:22:26 UTC
*** Bug 560434 has been marked as a duplicate of this bug. ***
Comment 16 James Le Cuirot gentoo-dev 2015-09-14 10:24:45 UTC
We're a little way off yet but this shouldn't matter when icedtea-7 goes away. icedtea-3 (Java 8) doesn't use Ant.
Comment 17 James Le Cuirot gentoo-dev 2016-02-04 07:58:18 UTC
To the person who came into #gentoo-java and rudely asked why this hasn't been fixed yet before leaving one minute later, it should have been assigned to the Portage team as this is probably a Portage bug.

I did say above that we're a little way off removing icedtea-7 but progress has certainly been made in this area since then.

It's not like this is even that big a deal. Very few people use icedtea over icedtea-bin and all you have to do is explicitly "emerge ant" first.
Comment 18 James Le Cuirot gentoo-dev 2017-07-15 10:35:34 UTC
*** Bug 623888 has been marked as a duplicate of this bug. ***
Comment 19 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2018-02-07 17:56:55 UTC
@chewi, can this one be closed now?
Comment 20 James Le Cuirot gentoo-dev 2018-02-07 18:01:21 UTC
Bug #384107 is still open so the Portage issue is still there. icedtea:7 is gone from the main repo and icedtea:8 doesn't use Ant, however if you want to bootstrap with gcj (perhaps for a new arch) then we still point people to java-overlay where icedtea:7 is still maintained. I'd keep this open for now.
Comment 21 Larry the Git Cow gentoo-dev 2019-12-24 00:57:53 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=39293f8a4667fce2112792953dbc16f69b9fcb66

commit 39293f8a4667fce2112792953dbc16f69b9fcb66
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2019-12-24 00:52:27 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2019-12-24 00:57:38 +0000

    sys-apps/portage: Bump to version 2.3.83
    
     #384107 adjust || preference to break dependency cycles,
             which solves bug 382421 and bug 703440
     #703348 emerge --with-test-deps: allow circular deps
    
    Bug: https://bugs.gentoo.org/701268
    Bug: https://bugs.gentoo.org/382421
    Bug: https://bugs.gentoo.org/384107
    Bug: https://bugs.gentoo.org/703440
    Bug: https://bugs.gentoo.org/703348
    Package-Manager: Portage-2.3.83, Repoman-2.3.20
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 sys-apps/portage/Manifest              |   1 +
 sys-apps/portage/portage-2.3.83.ebuild | 276 +++++++++++++++++++++++++++++++++
 2 files changed, 277 insertions(+)
Comment 22 Larry the Git Cow gentoo-dev 2019-12-24 01:24:37 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/portage.git/commit/?id=f78a91e44e3e82008e89f05fe3871e2cb03a8646

commit f78a91e44e3e82008e89f05fe3871e2cb03a8646
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2019-12-23 05:42:16 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2019-12-24 00:40:07 +0000

    backtracking: adjust || preference to break dependency cycles
    
    Store dependency cycle edges as backtracking parameters, and use them
    to adjust || preferences in order to break dependency cycles. This
    extends direct cycle breaking to handle indirect dependency cycles,
    which solves the cmake-bootstrap test case for bug 703440. If any
    cycle(s) remain unsolved by the next backtracking run, then backtracking
    aborts and the cycle(s) are reported as usual.
    
    Note that backtracking is necessary in order to avoid bugs of the form
    "emerge installs packages only to have them removed by depclean", since
    this sort of behavior is desirable only when it eliminates a dependency
    cycle.
    
    Bug: https://bugs.gentoo.org/382421
    Bug: https://bugs.gentoo.org/384107
    Bug: https://bugs.gentoo.org/703440
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 lib/_emerge/depgraph.py                            | 42 ++++++++++++++++++++--
 lib/_emerge/resolver/backtracking.py               | 11 ++++--
 lib/portage/dep/dep_check.py                       | 10 ++++++
 .../tests/resolver/test_circular_choices.py        | 25 +++++++++++++
 4 files changed, 84 insertions(+), 4 deletions(-)
Comment 23 Zac Medico gentoo-dev 2020-02-29 02:52:12 UTC
Making this block the latest relese (bug 706142) since the fix for bug 705986 is needed for completeness.