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

⌈⌋ branch:  cross package maker


Check-in [1f8309017e]

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

Overview
Comment:Add --rpmbuild-define previously available in fpm
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:1f8309017ec57770ee9aac74f7714ace3545e352
User & Date: jls 2012-03-03 08:40:24
Context
2012-03-03
08:40
- The 'dir' package has no metadata, so provide some defaults check-in: d11a74caf0 user: jls tags: trunk
08:40
Add --rpmbuild-define previously available in fpm check-in: 1f8309017e user: jls tags: trunk
08:38
- document attributes check-in: 0cd4ba3406 user: jls tags: trunk
Changes

Changes to lib/fpm/package/rpm.rb.

1
2
3
4
5
6
7









8






9
10
11
12
13
14
15
..
80
81
82
83
84
85
86




87
88
89
90
91
92
93
require "fpm/package"
require "backports"
require "fileutils"
require "find"
require "rpm" # gem 'rpm'
require "rpm/file"










class FPM::Package::RPM < FPM::Package






  private

  def architecture
    case @architecture
      when nil
        return %x{uname -m}.chomp   # default to current arch
      when "native"
................................................................................
  def output(output_path)
    %w(BUILD RPMS SRPMS SOURCES SPECS).each { |d| FileUtils.mkdir_p(File.join(build_path, d)) }
    args = ["rpmbuild", "-bb",
      "--define", "buildroot #{build_path}/BUILD",
      "--define", "_topdir #{build_path}",
      "--define", "_sourcedir #{build_path}",
      "--define", "_rpmdir #{build_path}/RPMS"]





    rpmspec = template("rpm.erb").result(binding)
    specfile = File.join(build_path, "SPECS", "#{name}.spec")
    File.write(specfile, rpmspec)
    File.write("/tmp/rpm.spec", rpmspec)

    args << specfile







>
>
>
>
>
>
>
>
>

>
>
>
>
>
>







 







>
>
>
>







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
..
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
require "fpm/package"
require "backports"
require "fileutils"
require "find"
require "rpm" # gem 'rpm'
require "rpm/file"

# RPM Package type.
#
# Build RPMs without having to waste hours reading Maximum-RPM.
# Well, in case you want to read it, here: http://www.rpm.org/max-rpm/
#
# The following attributes are supported:
#
# * :rpm_rpmbuild_define - an array of definitions to give to rpmbuild.
#   These are used, verbatim, each as: --define ITEM
class FPM::Package::RPM < FPM::Package
  option "--rpmbuild-define", "DEFINITION",
    "Pass a --define argument to rpmbuild.", :default => [] do |define|
    @rpmbuild_define ||= []
    @rpmbuild_define << define
  end

  private

  def architecture
    case @architecture
      when nil
        return %x{uname -m}.chomp   # default to current arch
      when "native"
................................................................................
  def output(output_path)
    %w(BUILD RPMS SRPMS SOURCES SPECS).each { |d| FileUtils.mkdir_p(File.join(build_path, d)) }
    args = ["rpmbuild", "-bb",
      "--define", "buildroot #{build_path}/BUILD",
      "--define", "_topdir #{build_path}",
      "--define", "_sourcedir #{build_path}",
      "--define", "_rpmdir #{build_path}/RPMS"]

    attributes[:rpm_rpmbuild_define].each do |define|
      args += ["--define", define]
    end

    rpmspec = template("rpm.erb").result(binding)
    specfile = File.join(build_path, "SPECS", "#{name}.spec")
    File.write(specfile, rpmspec)
    File.write("/tmp/rpm.spec", rpmspec)

    args << specfile