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

⌈⌋ ⎇ branch:  cross package maker


Check-in [f76d91a812]

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

Overview
Comment:- include some more paths in npm packages - set more default values since apt-get barfs on packages with missing data, it seems. Hard to debug since the error messages are totally meaningless.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: f76d91a812f23408727194881f6ee25175d60936
User & Date: jls@semicomplete.com 2011-01-04 09:29:15
Context
2011-01-04
09:30
- bump check-in: 606fe63c7c user: jls@semicomplete.com tags: trunk, v0.1.4
09:29
- include some more paths in npm packages - set more default values since apt-get barfs on packages with missing data, it seems. Hard to debug since the error messages are totally meaningless. check-in: f76d91a812 user: jls@semicomplete.com tags: trunk
08:16
- Add 'bin' scripts to the package, too. check-in: 6ef50e4296 user: jls@semicomplete.com tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to bin/fpm-npm.

83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
  depends.each do |dep|
    pkgcmd += ["-d", dep]
  end

  pkgcmd += ["-p", "#{PACKAGEPREFIX}#{package["name"]}-VERSION_ARCH.deb"]
  pkgcmd += ["-C", builddir]
  pkgcmd << "usr/lib/node/.npm/#{package["name"]}/active"
  pkgcmd << "usr/lib/node/#{package["name"]}"
  pkgcmd << "usr/lib/node/#{package["name"]}@#{package["version"]}"
  pkgcmd << "usr/lib/node/#{package["name"]}@#{package["version"]}"

  # Include bin files, install to usr/lib/node/bin
  (package["bin"] or []).each do |bin, script|
    pkgcmd << "usr/lib/node/bin/#{bin}"
    pkgcmd << "usr/lib/node/bin/#{bin}@#{package["version"]}"
  end

  # TODO(sissel): We could include manpages and docs, but I don't care right
  # now. If you want it, I accept patches! :)

  system *pkgcmd
end







|
|













83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
  depends.each do |dep|
    pkgcmd += ["-d", dep]
  end

  pkgcmd += ["-p", "#{PACKAGEPREFIX}#{package["name"]}-VERSION_ARCH.deb"]
  pkgcmd += ["-C", builddir]
  pkgcmd << "usr/lib/node/.npm/#{package["name"]}/active"
  pkgcmd << "usr/lib/node/.npm/#{package["name"]}/#{package["version"]}"
  pkgcmd << "usr/lib/node/#{package["name"]}"
  pkgcmd << "usr/lib/node/#{package["name"]}@#{package["version"]}"

  # Include bin files, install to usr/lib/node/bin
  (package["bin"] or []).each do |bin, script|
    pkgcmd << "usr/lib/node/bin/#{bin}"
    pkgcmd << "usr/lib/node/bin/#{bin}@#{package["version"]}"
  end

  # TODO(sissel): We could include manpages and docs, but I don't care right
  # now. If you want it, I accept patches! :)

  system *pkgcmd
end

Changes to lib/fpm/deb.rb.

43
44
45
46
47
48
49
50
51
52
53
54
55
56
57

      # Generate md5sums
      md5sums = self.checksum(paths)
      File.open("#{builddir}/md5sums", "w") { |f| f.puts md5sums.join("\n") }

      # Generate 'control' file
      template = File.new("#{File.dirname(__FILE__)}/../../templates/deb.erb").read()
      control = ERB.new(template).result(binding)
      File.open("#{builddir}/control", "w") { |f| f.puts control }
    end

    # create control.tar.gz
    Dir.chdir(builddir) do
      # Make the control
      system("tar -zcf control.tar.gz control md5sums")







|







43
44
45
46
47
48
49
50
51
52
53
54
55
56
57

      # Generate md5sums
      md5sums = self.checksum(paths)
      File.open("#{builddir}/md5sums", "w") { |f| f.puts md5sums.join("\n") }

      # Generate 'control' file
      template = File.new("#{File.dirname(__FILE__)}/../../templates/deb.erb").read()
      control = ERB.new(template, nil, "<>").result(binding)
      File.open("#{builddir}/control", "w") { |f| f.puts control }
    end

    # create control.tar.gz
    Dir.chdir(builddir) do
      # Make the control
      system("tar -zcf control.tar.gz control md5sums")

Changes to lib/fpm/package.rb.

36
37
38
39
40
41
42
43
44
45
46
47

48
49
50
51
52
53
54
  attr_accessor :architecture

  # Array of dependencies.
  attr_accessor :dependencies
  
  def initialize
    @iteration = 1
    @url = ""
    @category = "default"
    @license = "unknown"
    @maintainer = "<#{ENV["USER"]}@#{Socket.gethostname}>"
    @architecture = nil


    # Garbage is stuff you may want to clean up.
    @garbage = []
  end

  def tar(output, paths)
    dirs = []







|




>







36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
  attr_accessor :architecture

  # Array of dependencies.
  attr_accessor :dependencies
  
  def initialize
    @iteration = 1
    @url = "http://nourlgiven.example.com/no/url/given"
    @category = "default"
    @license = "unknown"
    @maintainer = "<#{ENV["USER"]}@#{Socket.gethostname}>"
    @architecture = nil
    @summary = "no summary given"

    # Garbage is stuff you may want to clean up.
    @garbage = []
  end

  def tar(output, paths)
    dirs = []

Changes to templates/deb.erb.

1
2
3
4

5


6
7
8
9
10
11
Package: <%= @name %>
Version: <%= @version %>-<%= @iteration %>
Architecture: <%= @architecture %>
Maintainer: <%= @maintainer %>

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


Section: <%= @category %> 
Priority: extra
Homepage: <%= @url %>
Description: <%= @summary %>
  <%= @summary %>




|
>

>
>
|

|
|
|
<
1
2
3
4
5
6
7
8
9
10
11
12
13

Package: <%= @name %>
Version: <%= @version %>-<%= @iteration %>
Architecture: <%= @architecture %>
Maintainer: <%= @maintainer or "<unknown>" %>
<% if @dependencies.size > 0 %>
Depends: <%= @dependencies.join(", ") %>
<% end %>
Standards-Version: 3.9.1
Section: <%= @category or "unknown" %> 
Priority: extra
Homepage: <%= @url or "http://nourlgiven.example.com/" %>
Description: <%= @summary or "no summary given" %>
  <%= @summary or "no description given"%>