"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "lib/fpm/package/deb.rb" between
fpm-1.13.1.tar.gz and fpm-1.14.0.tar.gz

About: fpm tries to make it easy and quick to build packages such as rpms, debs, OSX packages, etc.

deb.rb  (fpm-1.13.1):deb.rb  (fpm-1.14.0)
skipping to change at line 28 skipping to change at line 28
:before_install => "preinst", :before_install => "preinst",
:after_install => "postinst", :after_install => "postinst",
:before_remove => "prerm", :before_remove => "prerm",
:after_remove => "postrm", :after_remove => "postrm",
:after_purge => "postrm", :after_purge => "postrm",
} unless defined?(SCRIPT_MAP) } unless defined?(SCRIPT_MAP)
# The list of supported compression types. Default is gz (gzip) # The list of supported compression types. Default is gz (gzip)
COMPRESSION_TYPES = [ "gz", "bzip2", "xz", "none" ] COMPRESSION_TYPES = [ "gz", "bzip2", "xz", "none" ]
# https://www.debian.org/doc/debian-policy/ch-relationships.html#syntax-of-rel
ationship-fields
# Example value with version relationship: libc6 (>= 2.2.1)
# Example value: libc6
# Version string docs here: https://www.debian.org/doc/debian-policy/ch-contro
lfields.html#s-f-version
# The format is: [epoch:]upstream_version[-debian_revision].
# epoch - This is a single (generally small) unsigned integer
# upstream_version - must contain only alphanumerics 6 and the characters . +
- ~
# debian_revision - only alphanumerics and the characters + . ~
RELATIONSHIP_FIELD_PATTERN = /^(?<name>[A-z0-9_-]+)(?: *\((?<relation>[<>=]+)
*(?<version>(?:[0-9]+:)?[0-9A-Za-z+~.-]+(?:-[0-9A-Za-z+~.]+)?)\))?$/
option "--ignore-iteration-in-dependencies", :flag, option "--ignore-iteration-in-dependencies", :flag,
"For '=' (equal) dependencies, allow iterations on the specified " \ "For '=' (equal) dependencies, allow iterations on the specified " \
"version. Default is to be specific. This option allows the same " \ "version. Default is to be specific. This option allows the same " \
"version of a package but any iteration is permitted" "version of a package but any iteration is permitted"
option "--build-depends", "DEPENDENCY", option "--build-depends", "DEPENDENCY",
"Add DEPENDENCY as a Build-Depends" do |dep| "Add DEPENDENCY as a Build-Depends" do |dep|
@build_depends ||= [] @build_depends ||= []
@build_depends << dep @build_depends << dep
end end
skipping to change at line 430 skipping to change at line 441
raise FPM::InvalidPackageConfiguration, raise FPM::InvalidPackageConfiguration,
"Unknown compression type '#{compression}' for data.tar in deb source package #{package}" "Unknown compression type '#{compression}' for data.tar in deb source package #{package}"
end end
# unpack the data.tar.{gz,bz2,xz} from the deb package into staging_path # unpack the data.tar.{gz,bz2,xz} from the deb package into staging_path
safesystem(ar_cmd[0] + " p #{package} #{datatar} | tar #{compression} -xf - -C #{staging_path}") safesystem(ar_cmd[0] + " p #{package} #{datatar} | tar #{compression} -xf - -C #{staging_path}")
end # def extract_files end # def extract_files
def output(output_path) def output(output_path)
self.provides = self.provides.collect { |p| fix_provides(p) } self.provides = self.provides.collect { |p| fix_provides(p) }
self.provides.each do |provide|
if !valid_provides_field?(provide)
raise FPM::InvalidPackageConfiguration, "Found invalid Provides field va
lues (#{provide.inspect}). This is not valid in a Debian package."
end
end
output_check(output_path) output_check(output_path)
# Abort if the target path already exists. # Abort if the target path already exists.
# create 'debian-binary' file, required to make a valid debian package # create 'debian-binary' file, required to make a valid debian package
File.write(build_path("debian-binary"), "2.0\n") File.write(build_path("debian-binary"), "2.0\n")
# If we are given --deb-shlibs but no --after-install script, we # If we are given --deb-shlibs but no --after-install script, we
# should implicitly create a before/after scripts that run ldconfig # should implicitly create a before/after scripts that run ldconfig
if attributes[:deb_shlibs] if attributes[:deb_shlibs]
if !script?(:after_install) if !script?(:after_install)
skipping to change at line 598 skipping to change at line 615
write_control_tarball write_control_tarball
# Tar up the staging_path into data.tar.{compression type} # Tar up the staging_path into data.tar.{compression type}
case self.attributes[:deb_compression] case self.attributes[:deb_compression]
when "gz", nil when "gz", nil
datatar = build_path("data.tar.gz") datatar = build_path("data.tar.gz")
controltar = build_path("control.tar.gz") controltar = build_path("control.tar.gz")
compression = "-z" compression = "-z"
when "bzip2" when "bzip2"
datatar = build_path("data.tar.bz2") datatar = build_path("data.tar.bz2")
controltar = build_path("control.tar.bz2") controltar = build_path("control.tar.gz")
compression = "-j" compression = "-j"
when "xz" when "xz"
datatar = build_path("data.tar.xz") datatar = build_path("data.tar.xz")
controltar = build_path("control.tar.xz") controltar = build_path("control.tar.xz")
compression = "-J" compression = "-J"
when "none" when "none"
datatar = build_path("data.tar") datatar = build_path("data.tar")
controltar = build_path("control.tar") controltar = build_path("control.tar")
compression = "" compression = ""
else else
skipping to change at line 663 skipping to change at line 680
end # def output end # def output
def converted_from(origin) def converted_from(origin)
self.dependencies = self.dependencies.collect do |dep| self.dependencies = self.dependencies.collect do |dep|
fix_dependency(dep) fix_dependency(dep)
end.flatten end.flatten
self.provides = self.provides.collect do |provides| self.provides = self.provides.collect do |provides|
fix_provides(provides) fix_provides(provides)
end.flatten end.flatten
if origin == FPM::Package::CPAN
# The fpm cpan code presents dependencies and provides fields as perl(Modu
leName)
# so we'll need to convert them to something debian supports.
# Replace perl(ModuleName) > 1.0 with Debian-style perl-ModuleName (> 1.0)
perldepfix = lambda do |dep|
m = dep.match(/perl\((?<name>[A-Za-z0-9_:]+)\)\s*(?<op>.*$)/)
if m.nil?
# 'dep' syntax didn't look like 'perl(Name) > 1.0'
dep
else
# Also replace '::' in the perl module name with '-'
modulename = m["name"].gsub("::", "-")
# Fix any upper-casing or other naming concerns Debian has about packa
ges
name = "#{attributes[:cpan_package_name_prefix]}-#{modulename}"
if m["op"].empty?
name
else
# 'dep' syntax was like this (version constraint): perl(Module) > 1.
0
"#{name} (#{m["op"]})"
end
end
end
rejects = [ "perl(vars)", "perl(warnings)", "perl(strict)", "perl(Config)"
]
self.dependencies = self.dependencies.reject do |dep|
# Reject non-module Perl dependencies like 'vars' and 'warnings'
rejects.include?(dep)
end.collect(&perldepfix).collect(&method(:fix_dependency))
# Also fix the Provides field 'perl(ModuleName) = version' to be 'perl-mod
ulename (= version)'
self.provides = self.provides.collect(&perldepfix).collect(&method(:fix_pr
ovides))
end # if origin == FPM::Packagin::CPAN
if origin == FPM::Package::Deb if origin == FPM::Package::Deb
changelog_path = staging_path("usr/share/doc/#{name}/changelog.Debian.gz") changelog_path = staging_path("usr/share/doc/#{name}/changelog.Debian.gz")
if File.exists?(changelog_path) if File.exists?(changelog_path)
logger.debug("Found a deb changelog file, using it.", :path => changelog _path) logger.debug("Found a deb changelog file, using it.", :path => changelog _path)
attributes[:deb_changelog] = build_path("deb_changelog") attributes[:deb_changelog] = build_path("deb_changelog")
File.open(attributes[:deb_changelog], "w") do |deb_changelog| File.open(attributes[:deb_changelog], "w") do |deb_changelog|
Zlib::GzipReader.open(changelog_path) do |gz| Zlib::GzipReader.open(changelog_path) do |gz|
IO::copy_stream(gz, deb_changelog) IO::copy_stream(gz, deb_changelog)
end end
end end
skipping to change at line 777 skipping to change at line 831
elsif (m = dep.match(/(\S+)\s+\(> (.+)\)/)) elsif (m = dep.match(/(\S+)\s+\(> (.+)\)/))
# Convert 'foo (> x) to 'foo (>> x)' # Convert 'foo (> x) to 'foo (>> x)'
name, version = m[1..2] name, version = m[1..2]
return ["#{name} (>> #{version})"] return ["#{name} (>> #{version})"]
else else
# otherwise the dep is probably fine # otherwise the dep is probably fine
return dep.rstrip return dep.rstrip
end end
end # def fix_dependency end # def fix_dependency
def valid_provides_field?(text)
m = RELATIONSHIP_FIELD_PATTERN.match(text)
if m.nil?
logger.error("Invalid relationship field for debian package: #{text}")
return false
end
# Per Debian Policy manual, https://www.debian.org/doc/debian-policy/ch-rela
tionships.html#syntax-of-relationship-fields
# >> The relations allowed are <<, <=, =, >= and >> for strictly earlier, ea
rlier or equal,
# >> exactly equal, later or equal and strictly later, respectively. The exc
eption is the
# >> Provides field, for which only = is allowed
if m["relation"] == "=" || m["relation"] == nil
return true
end
return false
end
def valid_relationship_field?(text)
m = RELATIONSHIP_FIELD_PATTERN.match(text)
if m.nil?
logger.error("Invalid relationship field for debian package: #{text}")
return false
end
return true
end
def fix_provides(provides) def fix_provides(provides)
name_re = /^[^ \(]+/ name_re = /^[^ \(]+/
name = provides[name_re] name = provides[name_re]
if name =~ /[A-Z]/ if name =~ /[A-Z]/
logger.warn("Downcasing provides '#{name}' because deb packages " \ logger.warn("Downcasing provides '#{name}' because deb packages " \
" don't work so good with uppercase names") " don't work so good with uppercase names")
provides = provides.gsub(name_re) { |n| n.downcase } provides = provides.gsub(name_re) { |n| n.downcase }
end end
if provides.include?("_") if provides.include?("_")
skipping to change at line 823 skipping to change at line 903
write_shlibs # write optional shlibs file write_shlibs # write optional shlibs file
write_scripts # write the maintainer scripts write_scripts # write the maintainer scripts
write_conffiles # write the conffiles write_conffiles # write the conffiles
write_debconf # write the debconf files write_debconf # write the debconf files
write_meta_files # write additional meta files write_meta_files # write additional meta files
write_triggers # write trigger config to 'triggers' file write_triggers # write trigger config to 'triggers' file
write_md5sums # write the md5sums file write_md5sums # write the md5sums file
# Tar up the staging_path into control.tar.{compression type} # Tar up the staging_path into control.tar.{compression type}
case self.attributes[:deb_compression] case self.attributes[:deb_compression]
when "gz", nil when "gz", "bzip2", nil
controltar = "control.tar.gz" controltar = "control.tar.gz"
compression = "-z" compression = "-z"
when "bzip2"
controltar = "control.tar.bz2"
compression = "-j"
when "xz" when "xz"
controltar = "control.tar.xz" controltar = "control.tar.xz"
compression = "-J" compression = "-J"
when "none" when "none"
controltar = "control.tar" controltar = "control.tar"
compression = "" compression = ""
else else
raise FPM::InvalidPackageConfiguration, raise FPM::InvalidPackageConfiguration,
"Unknown compression type '#{self.attributes[:deb_compression]}'" "Unknown compression type '#{self.attributes[:deb_compression]}'"
end end
skipping to change at line 933 skipping to change at line 1010
end end
end end
# check for any init scripts or default files # check for any init scripts or default files
inits = attributes.fetch(:deb_init_list, []) inits = attributes.fetch(:deb_init_list, [])
defaults = attributes.fetch(:deb_default_list, []) defaults = attributes.fetch(:deb_default_list, [])
upstarts = attributes.fetch(:deb_upstart_list, []) upstarts = attributes.fetch(:deb_upstart_list, [])
etcfiles = [] etcfiles = []
# Add everything in /etc # Add everything in /etc
begin begin
if !attributes[:deb_no_default_config_files?] if !attributes[:deb_no_default_config_files?] && File.exists?(staging_path ("/etc"))
logger.warn("Debian packaging tools generally labels all files in /etc a s config files, " \ logger.warn("Debian packaging tools generally labels all files in /etc a s config files, " \
"as mandated by policy, so fpm defaults to this behavior for deb packages. " \ "as mandated by policy, so fpm defaults to this behavior for deb packages. " \
"You can disable this default behavior with --deb-no-default -config-files flag") "You can disable this default behavior with --deb-no-default -config-files flag")
add_path("/etc", etcfiles) add_path("/etc", etcfiles)
end end
rescue Errno::ENOENT rescue Errno::ENOENT
end end
return unless (config_files.any? or inits.any? or defaults.any? or upstarts. any? or etcfiles.any?) return unless (config_files.any? or inits.any? or defaults.any? or upstarts. any? or etcfiles.any?)
 End of changes. 8 change blocks. 
6 lines changed or deleted 97 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)