From 3b2b258020892926f362666647599f77a5d30be2 Mon Sep 17 00:00:00 2001 From: Jordan Stopford Date: Fri, 8 Mar 2024 10:37:34 +0000 Subject: [PATCH 1/4] Fix for #1627 When packaging a deb sometimes the architecture comes through as part of the provides (not sure why) but this causes problems with the deb package as it seems to only ever expect one set of round brackets which is the version indicator --- lib/fpm/package/deb.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/fpm/package/deb.rb b/lib/fpm/package/deb.rb index 4d97dfb0cc..cfa6c12d4f 100644 --- a/lib/fpm/package/deb.rb +++ b/lib/fpm/package/deb.rb @@ -262,6 +262,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 @@ -707,6 +710,9 @@ def converted_from(origin) 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) @@ -900,6 +906,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]})" From ae8205261a2b71161981eeb7cf9f56a9b8523bd2 Mon Sep 17 00:00:00 2001 From: Jordan Stopford Date: Tue, 23 Apr 2024 16:01:42 +0100 Subject: [PATCH 2/4] Fix for #1627 When packaging a deb sometimes a path to a binary comes into the requires field i.e. /bin/sh but this isn't valid for control files. Strip this out --- lib/fpm/package/deb.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/fpm/package/deb.rb b/lib/fpm/package/deb.rb index cfa6c12d4f..e7c8f7c54e 100644 --- a/lib/fpm/package/deb.rb +++ b/lib/fpm/package/deb.rb @@ -911,6 +911,11 @@ def fix_provides(provides) provides = "" end + if provides.start_with?("/") + 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]})" From 20aa78c72c24d1cde7e8c9ed6392b67668585e44 Mon Sep 17 00:00:00 2001 From: Jordan Stopford Date: Tue, 23 Apr 2024 16:33:39 +0100 Subject: [PATCH 3/4] Fix for #1627 When packaging a deb sometimes a path to a binary comes into the requires field i.e. /bin/sh but this isn't valid for control files. Strip this out --- lib/fpm/package/deb.rb | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/lib/fpm/package/deb.rb b/lib/fpm/package/deb.rb index e7c8f7c54e..3e5eb4b5a9 100644 --- a/lib/fpm/package/deb.rb +++ b/lib/fpm/package/deb.rb @@ -707,6 +707,11 @@ 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 @@ -813,6 +818,12 @@ def fix_dependency(dep) end end + if dep.start_with?("/") + logger.warn("Blanking 'dependency' field '#{dep}' because it's invalid") + dep = "" + return dep + end + name_re = /^[^ \(]+/ name = dep[name_re] if name =~ /[A-Z]/ @@ -911,11 +922,6 @@ def fix_provides(provides) provides = "" end - if provides.start_with?("/") - 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]})" From eb56972540bd25674fe68b1638d06e933930cce6 Mon Sep 17 00:00:00 2001 From: Jordan Stopford Date: Tue, 23 Apr 2024 17:30:48 +0100 Subject: [PATCH 4/4] Fix for #1627 Strip rpmlib dependencies --- lib/fpm/package/deb.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/fpm/package/deb.rb b/lib/fpm/package/deb.rb index 3e5eb4b5a9..57bb6984cd 100644 --- a/lib/fpm/package/deb.rb +++ b/lib/fpm/package/deb.rb @@ -824,6 +824,12 @@ def fix_dependency(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]/