Skip to content

Commit

Permalink
Merge pull request #2053 from JordanStopford/main
Browse files Browse the repository at this point in the history
Fix for #1627
  • Loading branch information
jordansissel authored Dec 9, 2024
2 parents 858d1c1 + eb56972 commit e7e7449
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions lib/fpm/package/deb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,9 @@ def architecture
when "noarch"
# Debian calls noarch "all"
@architecture = "all"
when "ppc64le"
# Debian calls ppc64le "ppc64el"
@architecture = "ppc64el"
end
return @architecture
end # def architecture
Expand Down Expand Up @@ -751,9 +754,17 @@ def converted_from(origin)
self.dependencies = self.dependencies.collect do |dep|
fix_dependency(dep)
end.flatten

# If an invalid depends field was found i.e. /bin.sh then fix_depends will blank it
# Make sure we remove this blank here
self.dependencies = self.dependencies.reject { |p| p.empty? }

self.provides = self.provides.collect do |provides|
fix_provides(provides)
end.flatten
# If an invalid provides field was found i.e. mypackage(arch) then fix_provides will blank it
# Make sure we remove this blank here
self.provides = self.provides.reject { |p| p.empty? }

if origin == FPM::Package::CPAN
# The fpm cpan code presents dependencies and provides fields as perl(ModuleName)
Expand Down Expand Up @@ -854,6 +865,18 @@ def fix_dependency(dep)
end
end

if dep.start_with?("/")
logger.warn("Blanking 'dependency' field '#{dep}' because it's invalid")
dep = ""
return dep
end

if dep.include?("rpmlib")
logger.warn("Blanking 'dependency' field '#{dep}' because it's invalid")
dep = ""
return dep
end

name_re = /^[^ \(]+/
name = dep[name_re]
if name =~ /[A-Z]/
Expand Down Expand Up @@ -947,6 +970,11 @@ def fix_provides(provides)
provides = provides.gsub("_", "-")
end

if provides.include?("(") and !provides.include?("(=")
logger.warn("Blanking 'provides' field '#{provides}' because it's invalid")
provides = ""
end

if m = provides.match(/^([A-Za-z0-9_-]+)\s*=\s*(\d+.*$)/)
logger.warn("Replacing 'provides' entry #{provides} with syntax 'name (= version)'")
provides = "#{m[1]} (= #{m[2]})"
Expand Down

0 comments on commit e7e7449

Please sign in to comment.