# Librarian-Chef and Nexus Cookbook

**URL:** <https://discourse.chef.io/t/librarian-chef-and-nexus-cookbook/3412>\
**Category:** Chef Infra (archive)\
**Created:** [December 18, 2012, 7:30pm UTC](https://discourse.chef.io/t/librarian-chef-and-nexus-cookbook/3412 "2012-12-18T19:30:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![David\_Petzel](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/david_petzel/32/38_2.png) [@David\_Petzel](https://discourse.chef.io/u/David_Petzel)\
**Post date:** [December 18, 2012, 7:30pm UTC](https://discourse.chef.io/t/librarian-chef-and-nexus-cookbook/3412/1 "2012-12-18T19:30:36Z")

</div>

I was attempting to add the Nexus Cookbook into my Cheffile today, and I’m  
getting the following exception (snipped for readability):

/opt/chef/embedded/lib/ruby/1.9.1/tsort.rb:152:in `block in tsort_each': topological sort failed: ["nexus", "artifact"] (TSort::Cyclic) from /opt/chef/embedded/lib/ruby/1.9.1/tsort.rb:183:in`block (2  
levels) in each\_strongly\_connected\_component’  
from /opt/chef/embedded/lib/ruby/1.9.1/tsort.rb:210:in `block (2 levels) in each_strongly_connected_component_from' from /opt/chef/embedded/lib/ruby/1.9.1/tsort.rb:219:in`each\_strongly\_connected\_component\_from’  
…

Some Googling seems to indicate the problem might be because of the circular  
dependencies.

Nexus Metadatab.rb has: depends “artifact”, "~\> 0.11.0"  
Artifact Metadatab.rb has: depends “nexus”, “\>= 0.17.0”

Are such circular dependencies valid in Chef in general, or this problem  
specific to Librarian?

Shy of forking, and hacking up the depends, is there something more basic I’m  
missing to get this working?

Thanks

---

<div class="post-metadata">

**Author:** ![Jay\_Feldblum](https://avatars.discourse-cdn.com/v4/letter/j/9fc29f/32.png) [@Jay\_Feldblum](https://discourse.chef.io/u/Jay_Feldblum)\
**Post date:** [December 18, 2012, 9:06pm UTC](https://discourse.chef.io/t/librarian-chef-and-nexus-cookbook/3412/2 "2012-12-18T21:06:03Z")

</div>

David,

The problem is indeed the circular dependencies. Or Librarian-Chef tsorting  
the dependencies after successfully resolving them. Although a generic  
dependency-installer does need to install in tsorted order, as does a  
cookbook uploader.

Cheers,  
Jay

On Tue, Dec 18, 2012 at 2:30 PM, [davidpetzel@gmail.com](mailto:davidpetzel@gmail.com) wrote:

> I was attempting to add the Nexus Cookbook into my Cheffile today, and I'm  
> getting the following exception (snipped for readability):
> 
> /opt/chef/embedded/lib/ruby/1.9.1/tsort.rb:152:in `block in tsort_each': topological sort failed: ["nexus", "artifact"] (TSort::Cyclic) from /opt/chef/embedded/lib/ruby/1.9.1/tsort.rb:183:in `block (2  
> levels) in each\_strongly\_connected\_component'  
> from /opt/chef/embedded/lib/ruby/1.9.1/tsort.rb:210:in `block (2 levels) in each_strongly_connected_component_from' from /opt/chef/embedded/lib/ruby/1.9.1/tsort.rb:219:in `each\_strongly\_connected\_component\_from'  
> ......
> 
> Some Googling seems to indicate the problem might be because of the  
> circular  
> dependencies.
> 
> Nexus Metadatab.rb has: depends "artifact", "~\> 0.11.0"  
> Artifact Metadatab.rb has: depends "nexus", "\>= 0.17.0"
> 
> Are such circular dependencies valid in Chef in general, or this problem  
> specific to Librarian?
> 
> Shy of forking, and hacking up the depends, is there something more basic  
> I'm  
> missing to get this working?
> 
> Thanks

---

<div class="post-metadata">

**Author:** ![David\_Petzel](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/david_petzel/32/38_2.png) [@David\_Petzel](https://discourse.chef.io/u/David_Petzel)\
**Post date:** [December 19, 2012, 1:53pm UTC](https://discourse.chef.io/t/librarian-chef-and-nexus-cookbook/3412/3 "2012-12-19T13:53:31Z")

</div>

Thanks Jay,  
So in your opinion which would be the appropriate project to open an issue  
on?

On Tue, Dec 18, 2012 at 4:06 PM, Jay Feldblum [y\_feldblum@yahoo.com](mailto:y_feldblum@yahoo.com) wrote:

> David,
> 
> The problem is indeed the circular dependencies. Or Librarian-Chef  
> tsorting the dependencies after successfully resolving them. Although a  
> generic dependency-installer does need to install in tsorted order, as does  
> a cookbook uploader.
> 
> Cheers,  
> Jay
> 
> On Tue, Dec 18, 2012 at 2:30 PM, [davidpetzel@gmail.com](mailto:davidpetzel@gmail.com) wrote:
> 
> > I was attempting to add the Nexus Cookbook into my Cheffile today, and I'm  
> > getting the following exception (snipped for readability):
> > 
> > /opt/chef/embedded/lib/ruby/1.9.1/tsort.rb:152:in `block in tsort_each': topological sort failed: ["nexus", "artifact"] (TSort::Cyclic) from /opt/chef/embedded/lib/ruby/1.9.1/tsort.rb:183:in `block (2  
> > levels) in each\_strongly\_connected\_component'  
> > from /opt/chef/embedded/lib/ruby/1.9.1/tsort.rb:210:in `block (2 levels) in each_strongly_connected_component_from' from /opt/chef/embedded/lib/ruby/1.9.1/tsort.rb:219:in `each\_strongly\_connected\_component\_from'  
> > ......
> > 
> > Some Googling seems to indicate the problem might be because of the  
> > circular  
> > dependencies.
> > 
> > Nexus Metadatab.rb has: depends "artifact", "~\> 0.11.0"  
> > Artifact Metadatab.rb has: depends "nexus", "\>= 0.17.0"
> > 
> > Are such circular dependencies valid in Chef in general, or this problem  
> > specific to Librarian?
> > 
> > Shy of forking, and hacking up the depends, is there something more basic  
> > I'm  
> > missing to get this working?
> > 
> > Thanks

---

<div class="post-metadata">

**Author:** ![Jay\_Feldblum](https://avatars.discourse-cdn.com/v4/letter/j/9fc29f/32.png) [@Jay\_Feldblum](https://discourse.chef.io/u/Jay_Feldblum)\
**Post date:** [December 19, 2012, 2:09pm UTC](https://discourse.chef.io/t/librarian-chef-and-nexus-cookbook/3412/4 "2012-12-19T14:09:42Z")

</div>

David,

It's just bad form for two projects to take circular dependencies on each  
other. Regardless of whether the surrounding tools can or can't handle  
circular dependencies, it's just something to avoid doing. So I would open  
the issue with the two cookbook projects.

Circular dependencies can often be broken by splitting one of the two  
projects. Suppose A depends on B and B depends on A. But suppose A has two  
parts internally, A1 and A2, where A2 depends on B but A1 does not, and B  
would depend on A1 and not on A2 if there were a way for it to do so. Then  
if A were split up into A1 and A2, that would break the circular dependency.

Cheers,  
Jay

On Wed, Dec 19, 2012 at 8:53 AM, David Petzel [davidpetzel@gmail.com](mailto:davidpetzel@gmail.com) wrote:

> Thanks Jay,  
> So in your opinion which would be the appropriate project to open an issue  
> on?
> 
> On Tue, Dec 18, 2012 at 4:06 PM, Jay Feldblum [y\_feldblum@yahoo.com](mailto:y_feldblum@yahoo.com)wrote:
> 
> > David,
> > 
> > The problem is indeed the circular dependencies. Or Librarian-Chef  
> > tsorting the dependencies after successfully resolving them. Although a  
> > generic dependency-installer does need to install in tsorted order, as does  
> > a cookbook uploader.
> > 
> > Cheers,  
> > Jay
> > 
> > On Tue, Dec 18, 2012 at 2:30 PM, [davidpetzel@gmail.com](mailto:davidpetzel@gmail.com) wrote:
> > 
> > > I was attempting to add the Nexus Cookbook into my Cheffile today, and  
> > > I'm  
> > > getting the following exception (snipped for readability):
> > > 
> > > /opt/chef/embedded/lib/ruby/1.9.1/tsort.rb:152:in `block in tsort_each': topological sort failed: ["nexus", "artifact"] (TSort::Cyclic) from /opt/chef/embedded/lib/ruby/1.9.1/tsort.rb:183:in `block (2  
> > > levels) in each\_strongly\_connected\_component'  
> > > from /opt/chef/embedded/lib/ruby/1.9.1/tsort.rb:210:in `block (2 levels) in each_strongly_connected_component_from' from /opt/chef/embedded/lib/ruby/1.9.1/tsort.rb:219:in `each\_strongly\_connected\_component\_from'  
> > > ......
> > > 
> > > Some Googling seems to indicate the problem might be because of the  
> > > circular  
> > > dependencies.
> > > 
> > > Nexus Metadatab.rb has: depends "artifact", "~\> 0.11.0"  
> > > Artifact Metadatab.rb has: depends "nexus", "\>= 0.17.0"
> > > 
> > > Are such circular dependencies valid in Chef in general, or this problem  
> > > specific to Librarian?
> > > 
> > > Shy of forking, and hacking up the depends, is there something more  
> > > basic I'm  
> > > missing to get this working?
> > > 
> > > Thanks
