Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Consolidate all changes under one commit. #100

Merged
merged 1 commit into from

2 participants

@kwilczynski

Signed-off-by: Krzysztof Wilczynski krzysztof.wilczynski@linux.com

@kwilczynski kwilczynski Consolidate all changes under one commit.
Signed-off-by: Krzysztof Wilczynski <krzysztof.wilczynski@linux.com>
fbe9f0e
@kwilczynski

This pull request is sane :-)

@jordansissel
Owner

hah, much more so! Thanks for cleaning it up!

@jordansissel jordansissel merged commit e43584c into jordansissel:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 3, 2011
  1. @kwilczynski

    Consolidate all changes under one commit.

    kwilczynski authored
    Signed-off-by: Krzysztof Wilczynski <krzysztof.wilczynski@linux.com>
This page is out of date. Refresh to see the latest.
View
7 lib/fpm/builder.rb
@@ -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
12 lib/fpm/source.rb
@@ -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
6 lib/fpm/source/dir.rb
@@ -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
15 lib/fpm/target/deb.rb
@@ -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
Something went wrong with that request. Please try again.