- Start work on rpm support using my pure-ruby rpm library.

This commit is contained in:
Jordan Sissel 2012-02-24 01:21:12 -08:00
parent 86a88dbaf5
commit d05c332455
2 changed files with 31 additions and 1 deletions

View File

@ -38,7 +38,7 @@ class FPM::Package::Dir < FPM::Package
# Copy all files from 'path' into staging_path
::Dir.chdir(@attributes[:chdir] || ".") do
p :chdir => ::Dir.pwd, :source => source
#p :chdir => ::Dir.pwd, :source => source
Find.find(source).each do |file|
next if source == file # ignore the directory itself
# Translate file paths with attributes like 'prefix' and 'chdir'

30
lib/fpm/package/rpm.rb Normal file
View File

@ -0,0 +1,30 @@
require "fpm/package"
require "backports"
require "fileutils"
require "find"
require "rpm" # gem 'rpm'
require "rpm/file"
class FPM::Package::RPM < FPM::Package
private
def <<(path)
rpm = ::RPM::File.new(path)
tags = {}
rpm.header.tags.each do |tag|
tags[tag.tag] = tag.value
end
# For all meaningful tags, set package metadata
# TODO(sissel): find meaningful tags
# Extract to the staging directory
rpm.extract(staging_path)
end # def <<
def output(dir)
end
public(:<<, :output)
end # class FPM::Package::Dir