Skip to content

Commit

Permalink
Merge pull request #403 from r4um/fix_401
Browse files Browse the repository at this point in the history
Closes #401 debian add md5sums to control
  • Loading branch information
jordansissel committed Apr 8, 2013
2 parents a9b8c40 + 873d36a commit 4c6c488
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions lib/fpm/package/deb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
require "fpm/util"
require "backports"
require "fileutils"
require "digest"

# Support for debian packages (.deb files)
#
Expand Down Expand Up @@ -403,6 +404,7 @@ def write_control_tarball
write_scripts # write the maintainer scripts
write_conffiles # write the conffiles
write_debconf # write the debconf files
write_md5sums # write the md5sums file

# Make the control.tar.gz
with(build_path("control.tar.gz")) do |controltar|
Expand Down Expand Up @@ -485,6 +487,26 @@ def write_debconf
end
end # def write_debconf

def write_md5sums
md5_sums = {}

Find.find(staging_path) do |path|
if File.file? path
md5 = Digest::MD5.file(path).hexdigest
md5_path = path.gsub("#{staging_path}/", "")
md5_sums[md5_path] = md5
end
end

if not md5_sums.empty?
File.open(control_path("md5sums"), "w") do |out|
md5_sums.each do |path, md5|
out.puts "#{md5} #{path}"
end
end
end
end # def write_md5sums

def to_s(format=nil)
# Default format if nil
# git_1.7.9.3-1_amd64.deb
Expand Down

0 comments on commit 4c6c488

Please sign in to comment.