Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consolidate all changes under one commit. #100

Merged
merged 1 commit into from
Sep 3, 2011
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/fpm/builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 8 additions & 4 deletions lib/fpm/source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 ] \
Expand Down
6 changes: 4 additions & 2 deletions lib/fpm/source/dir.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down
15 changes: 15 additions & 0 deletions lib/fpm/target/deb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down