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

⌈⌋ branch:  cross package maker


Check-in [275407c9b1]

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

Overview
Comment:Retain more attributes: provides=, conflicts=, config_files as backup=, deb_recomends as optdepends=, update_filter as makepkgopt= for arch .PKGINFO
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:275407c9b1ab54e169d51382f713c200fdb5d014
User & Date: mario 2015-05-01 22:40:35
Context
2015-05-05
12:05
Update notes, no longer using custom etcfiles() scanning; default to --config-files list. check-in: 2a6b544a7a user: mario tags: trunk
2015-05-01
22:40
Retain more attributes: provides=, conflicts=, config_files as backup=, deb_recomends as optdepends=, update_filter as makepkgopt= for arch .PKGINFO check-in: 275407c9b1 user: mario tags: trunk
02:17
Add architecture mapping, limit mode per & 07777. check-in: 32632f2a8d user: mario tags: trunk
Changes

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

1
2
3
4
5

6
7
8

9
10
11
12
13
14
15
16
17
18
19
20
21
..
28
29
30
31
32
33
34

35

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

48















49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65



66
67
68
# encoding: utf-8
# api: fpm
# title: arch tarball
# description: xzipped tarball with meta .PKGINFO and .MTREE files
# version: 0.1

#
# Arch binary packages are just .tar.xz archives with an
# extra .PKGINFO and .MTREE top-level.

#
# Care must be taken with dependencies. They're mostly
# literal upstream release basenames, but there's also
# some variance with version numbers embedded still.
# Python packages for example are named `python2-xyz`
# usually.


require "backports" # gem backports
require "fpm/package"
require "fpm/package/dir"
require "fpm/version"
require "fpm/util"
................................................................................
class FPM::Package::Arch < FPM::Package

  # Craft .PKGINFO and .MTREE (gzipped),
  # then generate a tarball (always .xz compressed).
  #
  def output(output_path)
    output_check(output_path)



    # Convert meta
    pkginfo()
    mtree()

    # Generate tarball
    tarfn = File.absolute_path(output_path)
    ::Dir::chdir(staging_path) do
      args = ["tar", "-c", "-J", "--owner=0", "--group=0", "--xform", "s:./::", "--exclude", "./", "-f", tarfn, "."]
      safesystem(*args)
    end
  end # def output
  

  def pkginfo()















    map = {
      "all" => "any",
      "amd64" => "x86-84",
      "x86" => "i686",
    }
    if map.has_key?(architecture)
      @architecture = map[architecture]
    end
    File.open(staging_path + "/.PKGINFO", "w") do |f|
      f.write template("arch/PKGINFO.erb").result(binding)
    end
  end

  def mtree()
    Zlib::GzipWriter.open(staging_path + "/.MTREE") do |f|
      f.write template("arch/MTREE.erb").result(binding)
    end



  end

end # class FPM::Package::Arch





>

|
<
>

|
|
<
|
<







 







>
|
>
|
|
|

|
<
<
|
<


|
>

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>








<
<
|
<

<
<
<
<
>
>
>



1
2
3
4
5
6
7
8

9
10
11
12

13

14
15
16
17
18
19
20
..
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41


42

43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70


71

72




73
74
75
76
77
78
# encoding: utf-8
# api: fpm
# title: arch tarball
# description: xzipped tarball with meta .PKGINFO and .MTREE files
# version: 0.1
# doc: https://github.com/an146/pacman/blob/master/scripts/makepkg.sh.in#L1268
#
# Arch binary packages are just .tar.xz archives with an extra .PKGINFO and

# a gzipped .MTREE (usually created by `bsdtar`) topmost in the tarball.
#
# Care must be taken with dependencies. They're mostly literal upstream
# release basenames, but there are frequently also embedded version numbers.

# For instance python packages follow a scheme like `python2-xyz` usually.



require "backports" # gem backports
require "fpm/package"
require "fpm/package/dir"
require "fpm/version"
require "fpm/util"
................................................................................
class FPM::Package::Arch < FPM::Package

  # Craft .PKGINFO and .MTREE (gzipped),
  # then generate a tarball (always .xz compressed).
  #
  def output(output_path)
    output_check(output_path)
    tarfn = File.absolute_path(output_path)
    
    ::Dir::chdir(staging_path) do
      # Convert meta
      pkginfo()
      mtree()

      # Generate tarball


      safesystem("tar", "-c", "-J", "--owner=0", "--group=0", "--xform", "s:./::", "-f", tarfn, ".")

    end
  end # def output

  # .PKGINFO
  def pkginfo()
    maparch()
    File.open(".PKGINFO", "w") do |f|
      f.write template("arch/PKGINFO.erb").result(binding)
    end
  end

  # bsdtar --format mtree
  def mtree()
    Zlib::GzipWriter.open(".MTREE") do |f|
      f.write template("arch/MTREE.erb").result(binding)
    end
  end

  # architecture  
  def maparch()
    map = {
      "all" => "any",
      "amd64" => "x86-84",
      "x86" => "i686",
    }
    if map.has_key?(architecture)
      @architecture = map[architecture]
    end


  end






  # search etc files
  def etcscan()
    return ::Dir.glob("etc/**")
  end

end # class FPM::Package::Arch

Changes to templates/arch/PKGINFO.erb.

1

2
3
4
5
6
7
8
9
10
11
12

















13
14

15

# Generated by fpm/xpm <%= FPM::VERSION %>

# <%= Time.now.utc.iso8601 %>
pkgname = <%= name %>
pkgver = <%= version %>
pkgdesc = <%= (description or "no desc").split("\n")[0] %>
url = <%= url or "http://nourlgiven.example.com/" %>
builddate = <%= Time.now.to_i %>
packager = <%= maintainer %>
size = <%= `du -b -s -c .`.split("\t")[0] %>
arch = <%= architecture %>
license = custom
<%= dependencies.collect { |d| "depend = #{d}" }.flatten.join("\n") %>

















makepkgopt = docs
makepkgopt = emptydirs

makepkgopt = zipman


>







|

|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>


>
|
>
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
# Generated by fpm/xpm <%= FPM::VERSION %>
# `xpm <%= ARGV.join(" ") %>`
# <%= Time.now.utc.iso8601 %>
pkgname = <%= name %>
pkgver = <%= version %>
pkgdesc = <%= (description or "no desc").split("\n")[0] %>
url = <%= url or "http://nourlgiven.example.com/" %>
builddate = <%= Time.now.to_i %>
packager = <%= maintainer %>
size = <%= `du -sbc #{staging_path}`.split("\t")[0] %>
arch = <%= architecture %>
license = custom:<%= license %>
<% dependencies.each do |pkg| -%>
depend = <%= pkg %>
<% end -%>
<% (@deb_recommends or []).each do |pkg| -%>
optdepend = <%= pkg %>
<% end -%>
<% provides.each do |pkg| -%>
provides = <%= pkg %>
<% end -%>
<% conflicts.each do |pkg| -%>
conflicts = <%= pkg %>
<% end -%>
<% replaces.each do |pkg| -%>
replaces = <%= pkg %>
<% end -%>
<% config_files.each do |fn| -%>
backup = <%= fn %>
<% end -%>
makepkgopt = docs
makepkgopt = emptydirs
<% attributes[:update_filter].each do |fn| -%>
makepkgopt = <%= fn %>
<% end -%>