[DRE-commits] [librarian-puppet] 92/153: Update librarianp to 0.4.0
Stig Sandbeck Mathisen
ssm at debian.org
Wed Jun 1 20:30:48 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 8636c1b6e5a2bb4163f846010e2a1dfb5a87b257
Author: Carlos Sanchez <carlos at apache.org>
Date: Thu Feb 26 09:18:43 2015 +0100
Update librarianp to 0.4.0
Takes care of merging duplicated dependencies, fix #282
No longer runs recursive resolution, fix #244 fix #217
---
Changelog.md | 2 ++
features/install/git.feature | 6 +++---
lib/librarian/puppet/source/forge/repo_v1.rb | 29 ++++------------------------
lib/librarian/puppet/source/local.rb | 5 +----
librarian-puppet.gemspec | 2 +-
5 files changed, 11 insertions(+), 33 deletions(-)
diff --git a/Changelog.md b/Changelog.md
index eef938a..b067274 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -4,6 +4,8 @@
### 2.1.0
+ * [Issue #282](https://github.com/rodjek/librarian-puppet/issues/282) Merge duplicated dependencies and warn the user, no more `Cannot bounce Puppetfile.lock!` errors
+ * [Issue #217](https://github.com/rodjek/librarian-puppet/issues/217)[Issue #244](https://github.com/rodjek/librarian-puppet/issues/244) Use librarianp 0.4.0 that no longer uses recursion to avoid `stack level too deep` errors
* [Issue #277](https://github.com/rodjek/librarian-puppet/issues/277) Warn when there are two dependencies with the same module name
* Use `librarianp` gem instead of `librarian`, a fork with the needed improvements and fixes.
diff --git a/features/install/git.feature b/features/install/git.feature
index a25a4d4..36d572d 100644
--- a/features/install/git.feature
+++ b/features/install/git.feature
@@ -164,16 +164,16 @@ Feature: cli/install/git
And the file "modules/test/Modulefile" should match /version *'0\.0\.1'/
And a file named "modules/stdlib/metadata.json" should exist
- @announce
Scenario: Install a module with mismatching Puppetfile and Modulefile
Given a file named "Puppetfile" with:
"""
mod 'duritong/munin', :git => 'https://github.com/2ndquadrant-it/puppet-munin.git', :ref => '0bb71e'
"""
- When PENDING I run `librarian-puppet install --verbose`
+ When I run `librarian-puppet install`
Then the exit status should be 0
And the file "modules/munin/Modulefile" should match /name *'duritong-munin'/
- And the file "modules/concat/Modulefile" should match /name *'puppetlabs-concat'/
+ And the file "modules/concat/metadata.json" should match /"name": *"puppetlabs-concat"/
+ And a file named "modules/stdlib/metadata.json" should exist
Scenario: Install from Puppetfile with duplicated entries
Given a file named "Puppetfile" with:
diff --git a/lib/librarian/puppet/source/forge/repo_v1.rb b/lib/librarian/puppet/source/forge/repo_v1.rb
index 032244b..a08002d 100644
--- a/lib/librarian/puppet/source/forge/repo_v1.rb
+++ b/lib/librarian/puppet/source/forge/repo_v1.rb
@@ -33,30 +33,9 @@ module Librarian
private
- # Issue #223 dependencies may be duplicated
- # and convert organization/modulename to organization-modulename
- def clear_duplicated_dependencies(data)
+ # convert organization/modulename to organization-modulename
+ def normalize_dependencies(data)
return nil if data.nil?
- data.each do |m,versions|
- versions.each do |v|
- if v["dependencies"] and !v["dependencies"].empty?
- # convert organization/modulename to organization-modulename
- v["dependencies"].each {|d| d[0] = normalize_name(d[0])}
-
- dependency_names = v["dependencies"].map {|d| d[0]}
- duplicated = dependency_names.select{ |e| dependency_names.count(e) > 1 }
- unless duplicated.empty?
- duplicated.uniq.each do |module_duplicated|
- to_remove = []
- v["dependencies"].each_index{|i| to_remove << i if module_duplicated == v["dependencies"][i][0]}
- warn { "Module #{m}@#{v["version"]} contains duplicated dependencies for #{module_duplicated}, ignoring all but the first of #{to_remove.map {|i| v["dependencies"][i]}}" }
- to_remove.slice(1..-1).reverse.each {|i| v["dependencies"].delete_at(i) }
- v["dependencies"] = v["dependencies"] - to_remove.slice(1..-1)
- end
- end
- end
- end
- end
# convert organization/modulename to organization-modulename
data.keys.each do |m|
if m =~ %r{.*/.*}
@@ -71,7 +50,7 @@ module Librarian
def api_data(module_name)
return @api_data[module_name] if @api_data
# call API and cache data
- @api_data = clear_duplicated_dependencies(api_call(module_name))
+ @api_data = normalize_dependencies(api_call(module_name))
if @api_data.nil?
raise Error, "Unable to find module '#{name}' on #{source}"
end
@@ -83,7 +62,7 @@ module Librarian
# if we already got all the versions, find in cached data
return @api_data[module_name].detect{|x| x['version'] == version.to_s} if @api_data
# otherwise call the api for this version if not cached already
- @api_version_data[version] = clear_duplicated_dependencies(api_call(name, version)) if @api_version_data[version].nil?
+ @api_version_data[version] = normalize_dependencies(api_call(name, version)) if @api_version_data[version].nil?
@api_version_data[version]
end
diff --git a/lib/librarian/puppet/source/local.rb b/lib/librarian/puppet/source/local.rb
index 70e7962..ae42b29 100644
--- a/lib/librarian/puppet/source/local.rb
+++ b/lib/librarian/puppet/source/local.rb
@@ -45,10 +45,7 @@ module Librarian
parsed_metadata['dependencies'].each do |d|
gem_requirement = Requirement.new(d['version_requirement']).gem_requirement
new_dependency = Dependency.new(d['name'], gem_requirement, forge_source)
- # Avoid duplicated dependencies with different sources
- unless dependencies.find { |spec_dependency| spec_dependency.name == new_dependency.name && spec_dependency.requirement == new_dependency.requirement }
- dependencies << new_dependency
- end
+ dependencies << new_dependency
end
dependencies
diff --git a/librarian-puppet.gemspec b/librarian-puppet.gemspec
index 4193d40..41d1b7d 100644
--- a/librarian-puppet.gemspec
+++ b/librarian-puppet.gemspec
@@ -26,7 +26,7 @@ Gem::Specification.new do |s|
s.executables = ['librarian-puppet']
- s.add_dependency "librarianp", ">=0.3.0"
+ s.add_dependency "librarianp", ">=0.4.0"
s.add_dependency "rsync"
s.add_dependency "puppet_forge"
--
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