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

⌈⌋ ⎇ branch:  cross package maker


Check-in [c2a301ce07]

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

Overview
Comment:Switch from custom @attributes[:meta] to just sharing @attrs, and command.rb fixed to not empty it. (Code probably was intended and will return as --attr option).
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: c2a301ce07e5b23fadeff7b1fdaea1003142972b
User & Date: mario 2014-12-24 04:46:01
Context
2014-12-24
04:46
Add attributes and support comma-separated version/dependency lists. check-in: c688acd9f5 user: mario tags: trunk
04:46
Switch from custom @attributes[:meta] to just sharing @attrs, and command.rb fixed to not empty it. (Code probably was intended and will return as --attr option). check-in: c2a301ce07 user: mario tags: trunk
2014-12-23
12:00
Safeguards against empty composer.json [packages], merge [packages-dev] in; and completely absent entry for input directory. Fix dependency conversion, prepare for complex CSV specifiers. check-in: 1d587e58c4 user: mario tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to lib/fpm/command.rb.

︙︙
381
382
383
384
385
386
387

388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
    input.conflicts += conflicts
    input.dependencies += dependencies
    input.provides += provides
    input.replaces += replaces
    input.config_files += config_files
    input.directories += directories


    h = {}
    attrs.each do | e |

      s = e.split(':', 2)
      h[s.last] = s.first
    end

    input.attrs = h

    
    script_errors = []
    setscript = proc do |scriptname|
      # 'self.send(scriptname) == self.before_install == --before-install
      # Gets the path to the script
      path = self.send(scriptname)







>
|
|
|
|
|
|
<
|







381
382
383
384
385
386
387
388
389
390
391
392
393
394

395
396
397
398
399
400
401
402
    input.conflicts += conflicts
    input.dependencies += dependencies
    input.provides += provides
    input.replaces += replaces
    input.config_files += config_files
    input.directories += directories

#-- not sure what this was meant for, attrs was a hash already
    #h = {}
    #attrs.each do | e |
    #
    #  s = e.split(':', 2)
    #  h[s.last] = s.first
    #end

    #input.attrs = h

    
    script_errors = []
    setscript = proc do |scriptname|
      # 'self.send(scriptname) == self.before_install == --before-install
      # Gets the path to the script
      path = self.send(scriptname)
︙︙

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

︙︙
140
141
142
143
144
145
146


147
148
149
150
151
152
153
      #self.dependencies = meta["depends"] .to_a ? JSON.parse ? eval ?
      #self.provides   = meta["provides"]
      attributes[:post_install]    = meta["exec"]
      attributes[:exe_dest]        = meta["defaultpath"]
      attributes[:exe_autoextract] = meta["autoextract"]
      attributes[:exe_delete]      = meta["delete"]
      attributes[:exe_shortcut]    = meta["shortcut0"]


    end
    # extract via Zip
    zip = convert(FPM::Package::Zip)
    zip.input(path)
    #safesystem("unzip", "-d", build_path, path)
  end








>
>







140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
      #self.dependencies = meta["depends"] .to_a ? JSON.parse ? eval ?
      #self.provides   = meta["provides"]
      attributes[:post_install]    = meta["exec"]
      attributes[:exe_dest]        = meta["defaultpath"]
      attributes[:exe_autoextract] = meta["autoextract"]
      attributes[:exe_delete]      = meta["delete"]
      attributes[:exe_shortcut]    = meta["shortcut0"]
      # keep other attributes?
      #@attrs.merge!(meta)
    end
    # extract via Zip
    zip = convert(FPM::Package::Zip)
    zip.input(path)
    #safesystem("unzip", "-d", build_path, path)
  end

︙︙

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

︙︙
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
  def output(output_path)

    # Flags
    o_nocase = attributes[:phar_nocase] || false
    o_stub = attributes[:phar_stub] || ""
    o_sign = attributes[:phar_sign] || ""
    
    # Retain package meta information, either from fpm attributes, or collected :meta hash (src module)
    meta = attributes[:meta] || {
      "id" => @name,
      "version" => @version.to_s,
      "epoch" => @epoch.to_s,
      "iteration" => @iteration.to_s,
      "architecture" => @architecture,
      "category" => @category == "none" ? nil : @category,
      "author" => @maintainer,
      "url" => @url,
      "license" => @license,
    }
    meta = meta.delete_if{ |k,v| v.nil? || v==""}
    
    # Match format specifier/extension onto type/settings
    fmt = (attributes[:phar_format] + output_path).downcase
    fmt, enc = fmt.match(/zip|phaz|tar|t[gb]z|pz/).to_s||"phar", fmt.match(/gz|bz2/).to_s
    map2 = { "tgz" => ["tar", "gz"], "tbz" => ["tar", "bz2"], "pz" => ["phaz", ""]  }
    map = {
        # fmt,  enc          extension   format        per-file-gz   extns ← archive-compr







|
|









<
|







65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82

83
84
85
86
87
88
89
90
  def output(output_path)

    # Flags
    o_nocase = attributes[:phar_nocase] || false
    o_stub = attributes[:phar_stub] || ""
    o_sign = attributes[:phar_sign] || ""
    
    # Retain package meta information, either from fpm attributes, or collected :attr hash (src module, formerly :meta)
    meta = attrs.merge({
      "id" => @name,
      "version" => @version.to_s,
      "epoch" => @epoch.to_s,
      "iteration" => @iteration.to_s,
      "architecture" => @architecture,
      "category" => @category == "none" ? nil : @category,
      "author" => @maintainer,
      "url" => @url,
      "license" => @license,

    }).delete_if{ |k,v| v.nil? || v==""}
    
    # Match format specifier/extension onto type/settings
    fmt = (attributes[:phar_format] + output_path).downcase
    fmt, enc = fmt.match(/zip|phaz|tar|t[gb]z|pz/).to_s||"phar", fmt.match(/gz|bz2/).to_s
    map2 = { "tgz" => ["tar", "gz"], "tbz" => ["tar", "bz2"], "pz" => ["phaz", ""]  }
    map = {
        # fmt,  enc          extension   format        per-file-gz   extns ← archive-compr
︙︙

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

︙︙
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
      @description = "#{m['description']}\n#{m['comment']}" if not attributes[:description_given?]
      @url = m["url"] || m["homepage"] if not attributes[:url_given?]
      @category = m["category"] if not attributes[:category_given?]
      @priority = m["priority"] if not attributes[:priority_given?]
      @license = m["license"] if not attributes[:license_given?]
      @vendor = m["author"] if not attributes[:maintainer_given?]
      @maintainer = m["author"] if not attributes[:maintainer_given?]
      # pass all available attributes on in a hash
      @attributes[:meta] = m
          #@todo preparse and collect config: structures
    end

    # Assemble rewrite map
    # {
    #   rel/src1 => { src2=>dest, src3=>dest } ,
    #   rel/src2 => { src4=> .. }







|
|







81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
      @description = "#{m['description']}\n#{m['comment']}" if not attributes[:description_given?]
      @url = m["url"] || m["homepage"] if not attributes[:url_given?]
      @category = m["category"] if not attributes[:category_given?]
      @priority = m["priority"] if not attributes[:priority_given?]
      @license = m["license"] if not attributes[:license_given?]
      @vendor = m["author"] if not attributes[:maintainer_given?]
      @maintainer = m["author"] if not attributes[:maintainer_given?]
      # retain all available attributes (formerly :meta, now in shared :attrs)
      @attrs.merge!(m)
          #@todo preparse and collect config: structures
    end

    # Assemble rewrite map
    # {
    #   rel/src1 => { src2=>dest, src3=>dest } ,
    #   rel/src2 => { src4=> .. }
︙︙