[DRE-commits] [librarian-puppet] 88/153: Issue #277 Warn when there are two dependencies with the same module name
Stig Sandbeck Mathisen
ssm at debian.org
Wed Jun 1 20:30:47 UTC 2016
This is an automated email from the git hooks/post-receive script.
ssm pushed a commit to branch master
in repository librarian-puppet.
commit d413c768c48c41946fbc34bf6f8e0d3cf9dbabc1
Author: Carlos Sanchez <carlos at apache.org>
Date: Wed Feb 25 14:47:42 2015 +0100
Issue #277 Warn when there are two dependencies with the same module name
i.e. ripienaar-concat and puppetlabs-concat
The last one alphabetically will overwrite the other ones
---
features/install/forge.feature | 13 +++++++++++++
lib/librarian/puppet/action.rb | 1 +
lib/librarian/puppet/action/resolve.rb | 19 +++++++++++++++++++
lib/librarian/puppet/cli.rb | 3 +++
4 files changed, 36 insertions(+)
diff --git a/features/install/forge.feature b/features/install/forge.feature
index 757aae8..7b9edf0 100644
--- a/features/install/forge.feature
+++ b/features/install/forge.feature
@@ -250,6 +250,19 @@ Feature: cli/install/forge
And the file "modules/collectd/Modulefile" should match /name *'pdxcat-collectd'/
And the file "modules/stdlib/metadata.json" should match /"name": "puppetlabs-stdlib"/
+ Scenario: Installing two modules with same name, alphabetical order wins
+ Given a file named "Puppetfile" with:
+ """
+ forge "http://forge.puppetlabs.com"
+
+ mod 'ripienaar-concat', '0.2.0'
+ mod 'puppetlabs-concat', '1.2.0'
+ """
+ When I run `librarian-puppet install --verbose`
+ Then the exit status should be 0
+ And the file "modules/concat/metadata.json" should match /"name": "ripienaar-concat"/
+ And the output should contain "Dependency on module 'concat' is fullfilled by multiple modules and only one will be used"
+
@other-forge
Scenario: Installing from another forge with local reference should not try to download anything from the official forge
Given a file named "Puppetfile" with:
diff --git a/lib/librarian/puppet/action.rb b/lib/librarian/puppet/action.rb
index e726e6c..97a6f4c 100644
--- a/lib/librarian/puppet/action.rb
+++ b/lib/librarian/puppet/action.rb
@@ -1 +1,2 @@
require "librarian/puppet/action/install"
+require "librarian/puppet/action/resolve"
diff --git a/lib/librarian/puppet/action/resolve.rb b/lib/librarian/puppet/action/resolve.rb
new file mode 100644
index 0000000..0c3cd55
--- /dev/null
+++ b/lib/librarian/puppet/action/resolve.rb
@@ -0,0 +1,19 @@
+module Librarian
+ module Puppet
+ module Action
+ class Resolve < Librarian::Action::Resolve
+ include Librarian::Puppet::Util
+
+ def run
+ super
+ manifests = environment.lock.manifests.select{ |m| m.name }
+ dupes = manifests.group_by{ |m| module_name(m.name) }.select { |k, v| v.size > 1 }
+ dupes.each do |k,v|
+ warn("Dependency on module '#{k}' is fullfilled by multiple modules and only one will be used: #{v.map{|m|m.name}}")
+ end
+ end
+
+ end
+ end
+ end
+end
diff --git a/lib/librarian/puppet/cli.rb b/lib/librarian/puppet/cli.rb
index acca1cf..afb8e88 100644
--- a/lib/librarian/puppet/cli.rb
+++ b/lib/librarian/puppet/cli.rb
@@ -100,6 +100,9 @@ module Librarian
def install!(options = { })
Action::Install.new(environment, options).run
end
+ def resolve!(options = { })
+ Action::Resolve.new(environment, options).run
+ end
end
end
end
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/librarian-puppet.git
More information about the Pkg-ruby-extras-commits
mailing list