Permalink
Browse files

Merge pull request #386 from r4um/fix_374

Closes #374 Add --no-auto-depends flag.
  • Loading branch information...
2 parents a010832 + 0ef743c commit 3cd6715db1adee7535d71bd43ce98eee181700d8 @jordansissel committed Mar 22, 2013
Showing with 34 additions and 25 deletions.
  1. +3 −0 lib/fpm/command.rb
  2. +2 −2 lib/fpm/package/deb.rb
  3. +21 −18 lib/fpm/package/gem.rb
  4. +3 −3 lib/fpm/package/python.rb
  5. +5 −2 lib/fpm/package/rpm.rb
View
@@ -87,6 +87,9 @@ def help(*args)
option "--no-depends", :flag, "Do not list any dependencies in this package",
:default => false
+ option "--no-auto-depends", :flag, "Do not list any dependencies in this package automatically",
+ :default => false
+
option "--provides", "PROVIDES",
"What this package provides (usually a name). This flag can be "\
"specified multiple times." do |val|
View
@@ -177,7 +177,7 @@ def extract_info(package)
return value.split(": ",2).last
end
end
-
+
# Parse 'epoch:version-iteration' in the version string
version_re = /^(?:([0-9]+):)?(.+?)(?:-(.*))?$/
m = version_re.match(parse.call("Version"))
@@ -204,7 +204,7 @@ def extract_info(package)
#self.config_files = config_files
- self.dependencies += parse_depends(parse.call("Depends"))
+ self.dependencies += parse_depends(parse.call("Depends")) if !attributes[:no_auto_depends?]
end
end # def extract_info
View
@@ -4,6 +4,7 @@
require "rubygems"
require "fileutils"
require "fpm/util"
+require "pp"
# A rubygems package.
#
@@ -141,25 +142,27 @@ def load_package_info(gem_path)
# composing multiple packages, it's best to explicitly include it in the provides list.
self.provides << "#{self.name} = #{self.version}"
- spec.runtime_dependencies.map do |dep|
- # rubygems 1.3.5 doesn't have 'Gem::Dependency#requirement'
- if dep.respond_to?(:requirement)
- reqs = dep.requirement.to_s
- else
- reqs = dep.version_requirements
- end
-
- # Some reqs can be ">= a, < b" versions, let's handle that.
- reqs.to_s.split(/, */).each do |req|
- if attributes[:gem_fix_dependencies?]
- name = fix_name(dep.name)
- else
- name = dep.name
+ if !attributes[:no_auto_depends?]
+ spec.runtime_dependencies.map do |dep|
+ # rubygems 1.3.5 doesn't have 'Gem::Dependency#requirement'
+ if dep.respond_to?(:requirement)
+ reqs = dep.requirement.to_s
+ else
+ reqs = dep.version_requirements
end
- self.dependencies << "#{name} #{req}"
- end
- end # runtime_dependencies
- end # ::Gem::Package
+
+ # Some reqs can be ">= a, < b" versions, let's handle that.
+ reqs.to_s.split(/, */).each do |req|
+ if attributes[:gem_fix_dependencies?]
+ name = fix_name(dep.name)
+ else
+ name = dep.name
+ end
+ self.dependencies << "#{name} #{req}"
+ end
+ end # runtime_dependencies
+ end # ::Gem::Package
+ end # no_auto_depends
end # def load_package_info
def install_to_staging(gem_path)
@@ -183,15 +183,15 @@ def load_package_info(setup_py)
self.name = self.name.downcase if attributes[:python_downcase_name?]
requirements_txt = File.join(setup_dir, "requirements.txt")
- if attributes[:python_obey_requirements_txt?] && File.exists?(requirements_txt)
+ if !attributes[:no_auto_depends?] && attributes[:python_obey_requirements_txt?] && File.exists?(requirements_txt)
@logger.info("Found requirements.txt, using it instead of setup.py " \
"for dependency information", :path => requirements_txt)
@logger.debug("Clearing dependency list (from setup.py) in prep for " \
"reading requirements.txt")
# Best I can tell, requirements.txt are a superset of what
# is already supported as 'dependencies' in setup.py
# So we'll parse them the same way below.
-
+
# requirements.txt can have dependencies, flags, and comments.
# We only want the comments, so remove comment and flag lines.
metadata["dependencies"] = File.read(requirements_txt).split("\n") \
@@ -201,7 +201,7 @@ def load_package_info(setup_py)
.map(&:strip)
end
- if attributes[:python_dependencies?]
+ if !attributes[:no_auto_depends?] and attributes[:python_dependencies?]
self.dependencies += metadata["dependencies"].collect do |dep|
dep_re = /^([^<>!= ]+)\s*(?:([<>!=]{1,2})\s*(.*))?$/
match = dep_re.match(dep)
View
@@ -203,9 +203,12 @@ def input(path)
# #{tags[prein]}
# TODO(sissel): put 'trigger scripts' stuff into attributes
- self.dependencies += rpm.requires.collect do |name, operator, version|
- [name, operator, version].join(" ")
+ if !attributes[:no_auto_depends?]
+ self.dependencies += rpm.requires.collect do |name, operator, version|
+ [name, operator, version].join(" ")
+ end
end
+
self.conflicts += rpm.conflicts.collect do |name, operator, version|
[name, operator, version].join(" ")
end

0 comments on commit 3cd6715

Please sign in to comment.