Permalink
Browse files

Merge pull request #100 from kwilczynski/custom_v0.3.7

Lots of fixes from kwilczynski
  • Loading branch information...
2 parents 16734da + fbe9f0e commit e43584ce10e87272b3fa3324a0211e734daffdc2 @jordansissel committed Sep 3, 2011
Showing with 33 additions and 7 deletions.
  1. +6 −1 lib/fpm/builder.rb
  2. +8 −4 lib/fpm/source.rb
  3. +4 −2 lib/fpm/source/dir.rb
  4. +15 −0 lib/fpm/target/deb.rb
View
@@ -204,7 +204,12 @@ def generate_md5sums
def checksum(paths)
paths.collect do |path|
if File.directory? path
- %x{find #{path} -type f -printf %P\\\\0 | xargs -0 md5sum}.split("\n")
+ # This should work for both cases where we use -C or not ...
+ %x{ find #{path} -type f -print0 | xargs -0 md5sum }.split("\n").collect do |i|
+ # Remove leading path and "./" from the md5sum output if present ...
+ i = i.split(/\s+/)
+ "%s %s" % [i[0], i[1].sub(/#{path}\//, '').sub(/\.\//, '')]
+ end
elsif File.exists? path
%x{md5sum #{path}}
else
View
@@ -121,11 +121,15 @@ def tar(output, paths, chdir=".")
# than it is worth. For now, rely on tar's --exclude.
dir_tar = [tar_cmd, "--owner=root", "--group=root" ] \
+ excludes \
- + ["-cf", output, "--no-recursion" ] \
- + dirs
+ + ["-cf", output, "--no-recursion" ]
- ::Dir.chdir(chdir) do
- safesystem(*dir_tar) if dirs.any?
+ # Only if directories and paths do not have duplicates ...
+ dirs -= paths
+
+ if dirs.any?
+ ::Dir.chdir(chdir) do
+ safesystem *(dir_tar += dirs)
+ end
end
files_tar = [ tar_cmd ] \
View
@@ -31,7 +31,7 @@ def make_tarball!(tar_path, builddir)
::FileUtils.mkdir_p(dest)
rsync = ["rsync", "-a", path, dest]
- p rsync
+ p rsync if $DEBUG
safesystem(*rsync)
# FileUtils.cp_r is pretty silly about how it copies files in some
@@ -46,10 +46,12 @@ def make_tarball!(tar_path, builddir)
end
::Dir.chdir("#{builddir}/tarbuild") do
- safesystem("ls #{builddir}/tarbuild")
+ safesystem("ls #{builddir}/tarbuild") if $DEBUG
tar(tar_path, ".")
end
else
+ # Prefix everything with "./" as per the Debian way if needed ...
+ path = paths[0].match(/^(\.\/|\.)/) ? paths[0] : "./%s" % paths[0]
tar(tar_path, paths)
end
View
@@ -17,6 +17,12 @@ def self.flags(opts, settings)
opts.on("--pre-depends DEPENDENCY", "Add DEPENDENCY as Pre-Depends.") do |dep|
(settings.target[:pre_depends] ||= []) << dep
end
+
+ # Take care about the case when we want custom control file but still use fpm ...
+ opts.on("--custom-control FILEPATH",
+ "Custom version of the Debian control file.") do |control|
+ settings.target[:control] = File.expand_path(control)
+ end
end
def needs_md5sums
@@ -67,6 +73,15 @@ def name
def build!(params)
control_files = [ "control", "md5sums" ]
+
+ # Use custom Debian control file when given ...
+ if self.settings[:control]
+ %x{cp #{self.settings[:control]} ./control 2> /dev/null 2>&1}
+ @logger.warn("Unable to process custom Debian control file (exit " \
+ "code: #{$?.exitstatus}). Falling back to default " \
+ "template.") unless $?.exitstatus == 0
+ end
+
# place the postinst prerm files
self.scripts.each do |name, path|
case name

0 comments on commit e43584c

Please sign in to comment.