Permalink
Browse files

Fixing merge conflict

  • Loading branch information...
2 parents a2b697c + 6194e67 commit 693b0bcb25bfa2cd407736a0960198cb9f72c968 @r4um r4um committed Mar 22, 2013
View
@@ -7,3 +7,4 @@ script: rspec
before_install:
- sudo apt-get update -qq
- sudo apt-get install -qq rpm
+ - gem update 1.8.25
View
@@ -46,6 +46,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency("rspec") # license: MIT (according to wikipedia)
spec.add_development_dependency("insist", "~> 0.0.5") # license: ???
+ spec.add_development_dependency("minitest")
spec.files = files
spec.require_paths << "lib"
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
@@ -487,7 +487,7 @@ def output_check(output_path)
if !File.directory?(File.dirname(output_path))
raise ParentDirectoryMissing.new(output_path)
end
- if File.exists?(output_path)
+ if File.file?(output_path)
if attributes[:force?]
@logger.warn("--force flag given, overwriting package at #{output_path}")
else
@@ -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
@@ -71,11 +71,9 @@ def download(gem_name, gem_version=nil)
gem_fetch += ["--prerelease"] if attributes[:gem_prerelease?]
gem_fetch += ["--version '#{gem_version}'"] if gem_version
-
download_dir = build_path(gem_name)
FileUtils.mkdir(download_dir) unless File.directory?(download_dir)
-
::Dir.chdir(download_dir) do |dir|
@logger.debug("Downloading in directory #{dir}")
safesystem(*gem_fetch)
@@ -139,25 +137,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
+
+ # 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
- self.dependencies << "#{name} #{req}"
- end
- end # runtime_dependencies
-end # def load_package_info
+ end # runtime_dependencies
+ end #no_auto_depends
+ end # def load_package_info
def install_to_staging(gem_path)
if attributes.include?(:prefix) && ! attributes[:prefix].nil?
@@ -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)
@@ -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
@@ -281,12 +284,15 @@ def build_sub_dir
#return File.join("BUILD", prefix)
end # def prefix
- # The default epoch value must be 1 (backward compatibility for rpms built
- # with fpm 0.4.3 and older)
+ # The default epoch value must be nil, see #381
def epoch
- return 1 if @epoch.nil?
return @epoch if @epoch.is_a?(Numeric)
- return nil if @epoch.empty?
+
+ if @epoch.nil? or @epoch.empty?
+ @logger.warn("no value for epoch is set, defaulting to nil")
+ return nil
+ end
+
return @epoch
end # def epoch
@@ -39,8 +39,8 @@
end
describe "#epoch" do
- it "should default to 1" do
- insist { subject.epoch.to_s } == "1"
+ it "should default to empty" do
+ insist { subject.epoch.to_s } == ""
end
it "should cope with it being zero" do
subject.epoch = 0
@@ -357,9 +357,9 @@ def subject.render_template; @rpmspec = template("rpm.erb").result(binding); end
rpmtags[tag.tag] = tag.value
end
- # Default epoch must be '1'
+ # Default epoch must be empty, see #381
# For some reason, epoch is an array of numbers in rpm?
- insist { rpmtags[:epoch] } == [1]
+ insist { rpmtags[:epoch] } == nil
# Default release must be '1'
insist { rpmtags[:release] } == "1"

0 comments on commit 693b0bc

Please sign in to comment.