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

⌈⌋ branch:  cross package maker


Check-in [11e5c12d1d]

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

Overview
Comment:Add --zip-shebang option, useful for making Python zip apps (pyz).
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:11e5c12d1ddfeef4d3984cd4db7fdf63da94949a
User & Date: mario 2015-04-17 22:14:31
Context
2015-04-30
23:54
New `-t arch` output package module. (Arch Linux binary tarballs with .PKGINFO and .MTREE meta files.) check-in: 006fa58cfa user: mario tags: trunk
2015-04-17
22:14
Add --zip-shebang option, useful for making Python zip apps (pyz). check-in: 11e5c12d1d user: mario tags: trunk
2015-04-15
18:32
Add convenience PKG_FLAG variation (uppercase pkg type) for preprocessor usage. check-in: 863ccf8053 user: mario tags: trunk
Changes

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

1
2
3
4
5

6
7
8
9
10


11
12
13
14
15
16
17
..
38
39
40
41
42
43
44
45
46
47
48
49















50
51
52
require "backports" # gem backports
require "fpm/package"
require "fpm/util"
require "fileutils"
require "fpm/package/dir"


# Use a zip as a package.
#
# This provides no metadata. Both input and output are supported.
class FPM::Package::Zip < FPM::Package



  # Input a zipfile.
  def input(input_path)
    # use part of the filename as the package name
    self.name = File.extname(input_path)[1..-1]

    realpath = Pathname.new(input_path).realpath.to_s
................................................................................

  # Output a tarball.
  #
  # If the output path ends predictably (like in .tar.gz) it will try to obey
  # the compression type.
  def output(output_path)
    output_check( output_path = File.absolute_path(output_path) )

    ::Dir.chdir(staging_path) do
      files = Find.find(".").to_a
      safesystem("zip", output_path, *files)
    end















  end # def output

end # class FPM::Package::Zip





>





>
>







 







|




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



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
..
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
require "backports" # gem backports
require "fpm/package"
require "fpm/util"
require "fileutils"
require "fpm/package/dir"
#require "io"

# Use a zip as a package.
#
# This provides no metadata. Both input and output are supported.
class FPM::Package::Zip < FPM::Package

  option "--shebang", "#!line", "Prefix a shebang to zip file. Make it executable.", :default => false, :hidden => true

  # Input a zipfile.
  def input(input_path)
    # use part of the filename as the package name
    self.name = File.extname(input_path)[1..-1]

    realpath = Pathname.new(input_path).realpath.to_s
................................................................................

  # Output a tarball.
  #
  # If the output path ends predictably (like in .tar.gz) it will try to obey
  # the compression type.
  def output(output_path)
    output_check( output_path = File.absolute_path(output_path) )
    
    ::Dir.chdir(staging_path) do
      files = Find.find(".").to_a
      safesystem("zip", output_path, *files)
    end

    # Prefix a shebang
    if attributes[:zip_shebang_given?]
      File.rename(output_path, tmp = output_path + rand(36**5).to_s(36))
      File.open(tmp, "rb") do |r|
        File.open(output_path, "wb") do |w|
          w << "#!" + attributes[:zip_shebang].gsub("^\#\!\s*|\s+$", "") + "\n"
          IO.copy_stream(r, w)
        end
      end
      File.unlink(tmp)
      safesystem("zip", "-A", output_path)
      FileUtils.chmod("a+x", output_path)
    end

  end # def output

end # class FPM::Package::Zip