Cross package maker. DEB/RPM generation or conversion. Derived from jordansissel/fpm.

⌈⌋ ⎇ branch:  cross package maker


Check-in [95a601856c]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:add in stubby FPM::Rpm and FPM::Gem TODO: put sources and packages in separate namespaces
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 95a601856c5e3ff7bfbc48260c93acbef536bb21
User & Date: jjmadkisson@gmail.com 2011-01-06 04:02:22
Context
2011-01-06
04:18
don't expose rpm, gem, and tar functionality until they're done check-in: 76e218a632 user: jjmadkisson@gmail.com tags: trunk
04:02
add in stubby FPM::Rpm and FPM::Gem TODO: put sources and packages in separate namespaces check-in: 95a601856c user: jjmadkisson@gmail.com tags: trunk
02:38
stupid syntax error *facepalm check-in: c61ed12c91 user: jjmadkisson@gmail.com tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Added lib/fpm/gem.rb.







































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
require 'fpm/namespace'

require 'rubygems/package'

class FPM::Gem < FPM::Source

  def get_metadata
    File.open(@path, 'r') do |f|
      ::Gem::Package.open(f, 'r') do |gem|
        spec = gem.metadata
        %w(
          description
          license
          summary
          version
        ).each do |field|
          self[field] = spec.send(field)
        end

        self[:name] = "rubygem-#{spec.name}"
        self[:maintainer] = spec.author
        self[:url] = spec.homepage

        # TODO [Jay]: this will be different for different
        # package managers.  Need to decide how to handle this.
        self[:category] = 'Languages/Development/Ruby'

        self[:dependencies] = spec.runtime_dependencies.map do |dep|
          reqs = dep.requirements.gsub(/,/, '')
          "rubygem-#{dep.name} #{reqs}"
        end
      end
    end
  end
end

Added lib/fpm/rpm.rb.





















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
class FPM::Rpm < FPM::Package
  def assemble(params)
    # TODO [Jay] a lot of this is duplication from deb.rb,
    # and can be factored out.

    raise "No package name given. Can't assemble package" if !@name

    root = params['root'] || '.'
    paths = params['paths']
    output = params['output']

    type = "rpm"

    output.gsub!(/VERSION/, "#{@version}-#{@iteration}")
    output.gsub!(/ARCH/, @architecture)

    builddir = "#{Dir.pwd}/build-#{type}-#{File.basename(output)}"

    Dir.mkdir(builddir) if !File.directory?(builddir)

    Dir.chdir root do
      tar("#{builddir}/data.tar", paths)
      system(*["gzip", "-f", "#{builddir}/data.tar"])
    end
  end
end

Added templates/rpm.erb.

















































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# eruby_subtype=spec
%define rbname <%= spec.name %>

Name: <%= @name %>
Version: <%= @version %>
Release: <%= @iteration %>
Summary: <%= @summary %>

Group: <%= @category %>
<%#
TODO: [Jay] rpms require a license
let's detect it intelligently
%>
License: <%= @license %> 
Source0:  %{_sourcedir}/data.tar.gz
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)

Requires: <%= @dependencies.join(", ") %>

%description
<%= @summary %>

%prep
#noop

%build
#noop

%install
#noop

%clean
rm -rf $RPM_BUILD_ROOT


%files
%defattr(-,root,root,-)
<%= paths %>

%changelog