[DRE-commits] [librarian-puppet] 23/153: Issue #234 Use organization-module instead organization/module

Stig Sandbeck Mathisen ssm at debian.org
Wed Jun 1 20:30:35 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 a2397c824d564a37f7e88840dca7489ba665ce2f
Author: Carlos Sanchez <csanchez at maestrodev.com>
Date:   Sat Jul 12 13:42:41 2014 +0200

    Issue #234 Use organization-module instead organization/module
    
    Puppet Forge v1 API expects organization/module
---
 lib/librarian/puppet/source/forge/repo_v1.rb | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/lib/librarian/puppet/source/forge/repo_v1.rb b/lib/librarian/puppet/source/forge/repo_v1.rb
index 26867e8..032244b 100644
--- a/lib/librarian/puppet/source/forge/repo_v1.rb
+++ b/lib/librarian/puppet/source/forge/repo_v1.rb
@@ -34,11 +34,15 @@ module Librarian
         private
 
           # Issue #223 dependencies may be duplicated
+          # and convert organization/modulename to organization-modulename
           def clear_duplicated_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?
@@ -53,6 +57,13 @@ module Librarian
                 end
               end
             end
+            # convert organization/modulename to organization-modulename
+            data.keys.each do |m|
+              if m =~ %r{.*/.*}
+                data[normalize_name(m)] = data[m]
+                data.delete(m)
+              end
+            end
             data
           end
 
@@ -79,7 +90,7 @@ module Librarian
           def api_call(module_name, version=nil)
             url = source.uri.clone
             url.path += "#{'/' if url.path.empty? or url.path[-1] != '/'}api/v1/releases.json"
-            url.query = "module=#{module_name}"
+            url.query = "module=#{module_name.sub('-','/')}" # v1 API expects "organization/module"
             url.query += "&version=#{version}" unless version.nil?
             debug { "Querying Forge API for module #{name}#{" and version #{version}" unless version.nil?}: #{url}" }
 

-- 
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