Skip to content

Commit

Permalink
- Start working on a solaris package type.
Browse files Browse the repository at this point in the history
- md5sums aren't needed by most packages, disable it by default.
  In the future, should move the md5sums generator to the .deb package
  target and keep it away from other stuff.
  • Loading branch information
jordansissel committed Jun 15, 2011
1 parent 966348d commit 71443ec
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 11 deletions.
8 changes: 8 additions & 0 deletions bin/fpm
Expand Up @@ -6,6 +6,14 @@ $: << File.join(File.dirname(__FILE__), "..", "lib")
require "fpm"
require "fpm/program"

module Kernel
alias :orig_system :system
def system(*args)
p :system => args
orig_system(*args)
end
end

program = FPM::Program.new
ret = program.run(ARGV)
exit(ret.nil? ? 0 : ret)
1 change: 1 addition & 0 deletions lib/fpm.rb
Expand Up @@ -4,6 +4,7 @@
require "fpm/package"
require "fpm/target/deb"
require "fpm/target/rpm"
require "fpm/target/solaris"

require "fpm/source"
require "fpm/source/dir"
Expand Down
2 changes: 1 addition & 1 deletion lib/fpm/builder.rb
Expand Up @@ -84,7 +84,7 @@ def assemble!
::Dir.chdir root do
@source.make_tarball!(tar_path, builddir)

generate_md5sums
generate_md5sums if @package.needs_md5sums
generate_specfile
edit_specfile if @edit
end
Expand Down
15 changes: 10 additions & 5 deletions lib/fpm/package.rb
Expand Up @@ -111,11 +111,16 @@ def generate_specfile(builddir, paths)
File.open(specfile(builddir), "w") { |f| f.puts spec }
end # def generate_specfile

def generate_md5sums(builddir, paths)
md5sums = self.checksum(paths)
File.open("#{builddir}/md5sums", "w") { |f| f.puts md5sums }
md5sums
end # def generate_md5sums
# nobody needs md5sums by default.
def needs_md5sums
false
end # def needs_md5sums

#def generate_md5sums(builddir, paths)
#md5sums = self.checksum(paths)
#File.open("#{builddir}/md5sums", "w") { |f| f.puts md5sums }
#md5sums
#end # def generate_md5sums

# TODO [Jay]: make this better...?
def type
Expand Down
15 changes: 10 additions & 5 deletions lib/fpm/source.rb
Expand Up @@ -101,16 +101,21 @@ def tar(output, paths, chdir=".")
# TODO(sissel): To properly implement excludes as regexps, we
# will need to find files ourselves. That may be more work
# than it is worth. For now, rely on tar's --exclude.
dir_tar = ["tar", "-C", chdir, "--owner=root", "--group=root" ] \
dir_tar = ["tar", "--owner=root", "--group=root" ] \
+ excludes \
+ ["-cf", output, "--no-recursion" ] \
+ dirs
system(*dir_tar) if dirs.any?

files_tar = [ "tar", "-C", chdir ] \
::Dir.chdir(chdir) do
system(*dir_tar) if dirs.any?
end

files_tar = [ "tar" ] \
+ excludes \
+ [ "--owner=root", "--group=root", "-rf", output ] \
+ paths
system(*files_tar)
::Dir.chdir(chdir) do
system(*files_tar)
end
end # def tar
end
end # class FPM::Source
4 changes: 4 additions & 0 deletions lib/fpm/target/deb.rb
Expand Up @@ -4,6 +4,10 @@
require "fpm/errors"

class FPM::Target::Deb < FPM::Package
def needs_md5sums
true
end # def needs_md5sums

def architecture
if @architecture.nil? or @architecture == "native"
# Default architecture should be 'native' which we'll need
Expand Down

0 comments on commit 71443ec

Please sign in to comment.