fpm 1.9.3 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.rst +17 -0
- data/bin/fpm +0 -1
- data/lib/fpm/package.rb +7 -3
- data/lib/fpm/package/apk.rb +3 -3
- data/lib/fpm/package/deb.rb +46 -2
- data/lib/fpm/package/pyfpm/get_metadata.py +5 -0
- data/lib/fpm/package/python.rb +2 -2
- data/lib/fpm/package/rpm.rb +1 -0
- data/lib/fpm/version.rb +1 -1
- data/templates/deb/deb.changes.erb +31 -0
- data/templates/rpm.erb +7 -4
- metadata +8 -7
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 824ec3106d694f1d5255fca89d94623a327b108e
         | 
| 4 | 
            +
              data.tar.gz: 5c9b1395dc9f49c29de9550f59df4efefae77ab9
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 4c9df69a9c986277fcba302920d920dd8833fb70b66f06278702d6ffc208bfaff201507db4df29036883f845e2fc0474927ec5f8b4dd3db48410465adf546021
         | 
| 7 | 
            +
              data.tar.gz: 4db630cd9769205dd8c21fef6f846467ab98625ab584c5b9f2e30fa6de4101000fa572f269663169c8c70c5479ac6575bcdc19d5778614b66c1a3340fddbf92c
         | 
    
        data/CHANGELOG.rst
    CHANGED
    
    | @@ -1,6 +1,23 @@ | |
| 1 1 | 
             
            Release Notes and Change Log
         | 
| 2 2 | 
             
            ============================
         | 
| 3 3 |  | 
| 4 | 
            +
            1.10.0 (May 21, 2018)
         | 
| 5 | 
            +
            ^^^^^^^^^^^^^^^^^^^^
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            * Pin `ruby-xz` dependency to one which allows Ruby versions older than 2.3.0 (`#1494`_; Marat Sharafutdinov)
         | 
| 8 | 
            +
            * Documentation improvements: `#1488`_; Arthur Burkart. `#1384`_; Justin Kolberg. `#1452`_; Anatoli Babenia.
         | 
| 9 | 
            +
            * python: Improve support for the `~=` dependency comparison. (`#1482`_; Roman Vasilyev)
         | 
| 10 | 
            +
            * deb: Add `--deb-generate-changes` flag to have fpm output a `.changes` file (`#1492`_; Spida)
         | 
| 11 | 
            +
            * deb: Add `--deb-dist` flag to set the target distribution (similar to `--rpm-dist`). (`#1492`_; Spida)
         | 
| 12 | 
            +
            * apk: Make --before-install, --before-upgrade, and --after-upgrade work correctly. (`#1422`_; Charles R. Portwood II)
         | 
| 13 | 
            +
            * rpm: add `xzmt` for multithreaded xz compression (Amnon BC)
         | 
| 14 | 
            +
            * rpm: fix shell function name `install` conflicting with `install` program. In
         | 
| 15 | 
            +
              postinst (after-install), the function is now called `_install` to avoid
         | 
| 16 | 
            +
              conflicting with `/usr/bin/install` (`#1434`_; Torsten Schmidt)
         | 
| 17 | 
            +
            * - deb: --config-files ? (`#1440`_, `#1443`_; NoBodyCam)
         | 
| 18 | 
            +
            * FPM source repo now contains a Brewfile for use with Homebrew.
         | 
| 19 | 
            +
            * FPM source repo has a Dockerfile for invoking fpm with docker. (`#1484`_, ;Allan Lewis
         | 
| 20 | 
            +
             | 
| 4 21 | 
             
            1.9.3 (September 11, 2017)
         | 
| 5 22 | 
             
            ^^^^^^^^^^^^^^^^^^^^^^^^^^
         | 
| 6 23 |  | 
    
        data/bin/fpm
    CHANGED
    
    
    
        data/lib/fpm/package.rb
    CHANGED
    
    | @@ -3,7 +3,8 @@ require "fpm/util" # local | |
| 3 3 | 
             
            require "pathname" # stdlib
         | 
| 4 4 | 
             
            require "find"
         | 
| 5 5 | 
             
            require "tmpdir" # stdlib
         | 
| 6 | 
            -
            require " | 
| 6 | 
            +
            require "ostruct"
         | 
| 7 | 
            +
            require "backports/2.0.0/stdlib/ostruct"
         | 
| 7 8 | 
             
            require "socket" # stdlib, for Socket.gethostname
         | 
| 8 9 | 
             
            require "shellwords" # stdlib, for Shellwords.escape
         | 
| 9 10 | 
             
            require "erb" # stdlib, for template processing
         | 
| @@ -118,7 +119,10 @@ class FPM::Package | |
| 118 119 |  | 
| 119 120 | 
             
              def initialize
         | 
| 120 121 | 
             
                # Attributes for this specific package
         | 
| 121 | 
            -
                @attributes = { | 
| 122 | 
            +
                @attributes = {
         | 
| 123 | 
            +
                  # Default work location
         | 
| 124 | 
            +
                  :workdir => ::Dir.tmpdir
         | 
| 125 | 
            +
                }
         | 
| 122 126 |  | 
| 123 127 | 
             
                # Reference
         | 
| 124 128 | 
             
                # http://www.debian.org/doc/manuals/maint-guide/first.en.html
         | 
| @@ -507,7 +511,7 @@ class FPM::Package | |
| 507 511 | 
             
                  end
         | 
| 508 512 | 
             
                end
         | 
| 509 513 | 
             
              end
         | 
| 510 | 
            -
             | 
| 514 | 
            +
             | 
| 511 515 | 
             
              # Get the contents of the script by a given name.
         | 
| 512 516 | 
             
              #
         | 
| 513 517 | 
             
              # If template_scripts? is set in attributes (often by the --template-scripts
         | 
    
        data/lib/fpm/package/apk.rb
    CHANGED
    
    | @@ -144,9 +144,9 @@ class FPM::Package::APK< FPM::Package | |
| 144 144 | 
             
                scripts = {}
         | 
| 145 145 |  | 
| 146 146 | 
             
                scripts = register_script('post-install',   :after_install,   scripts)
         | 
| 147 | 
            -
                scripts = register_script(' | 
| 148 | 
            -
                scripts = register_script(' | 
| 149 | 
            -
                scripts = register_script('post- | 
| 147 | 
            +
                scripts = register_script('pre-install',   :before_install,  scripts)
         | 
| 148 | 
            +
                scripts = register_script('pre-upgrade',   :before_upgrade,  scripts)
         | 
| 149 | 
            +
                scripts = register_script('post-upgrade',   :after_upgrade,  scripts)
         | 
| 150 150 | 
             
                scripts = register_script('pre-deinstall',  :before_remove,   scripts)
         | 
| 151 151 | 
             
                scripts = register_script('post-deinstall', :after_remove,    scripts)
         | 
| 152 152 |  | 
    
        data/lib/fpm/package/deb.rb
    CHANGED
    
    | @@ -50,6 +50,8 @@ class FPM::Package::Deb < FPM::Package | |
| 50 50 | 
             
                value
         | 
| 51 51 | 
             
              end
         | 
| 52 52 |  | 
| 53 | 
            +
              option "--dist", "DIST-TAG", "Set the deb distribution.", :default => "unstable"
         | 
| 54 | 
            +
             | 
| 53 55 | 
             
              # Take care about the case when we want custom control file but still use fpm ...
         | 
| 54 56 | 
             
              option "--custom-control", "FILEPATH",
         | 
| 55 57 | 
             
                "Custom version of the Debian control file." do |control|
         | 
| @@ -88,6 +90,10 @@ class FPM::Package::Deb < FPM::Package | |
| 88 90 | 
             
                File.expand_path(file)
         | 
| 89 91 | 
             
              end
         | 
| 90 92 |  | 
| 93 | 
            +
              option "--generate-changes", :flag,
         | 
| 94 | 
            +
                "Generate PACKAGENAME.changes file.",
         | 
| 95 | 
            +
                :default => false
         | 
| 96 | 
            +
             | 
| 91 97 | 
             
              option "--upstream-changelog", "FILEPATH", "Add FILEPATH as upstream changelog" do |file|
         | 
| 92 98 | 
             
                File.expand_path(file)
         | 
| 93 99 | 
             
              end
         | 
| @@ -574,6 +580,30 @@ class FPM::Package::Deb < FPM::Package | |
| 574 580 | 
             
                    safesystem(*ar_cmd, output_path, "debian-binary", "control.tar.gz", datatar)
         | 
| 575 581 | 
             
                  end
         | 
| 576 582 | 
             
                end
         | 
| 583 | 
            +
             | 
| 584 | 
            +
                # if a PACKAGENAME.changes file is to be created
         | 
| 585 | 
            +
                if self.attributes[:deb_generate_changes?]
         | 
| 586 | 
            +
                  distribution = self.attributes[:deb_dist]
         | 
| 587 | 
            +
             | 
| 588 | 
            +
                  # gather information about the files to distribute
         | 
| 589 | 
            +
                  files = [ output_path ]
         | 
| 590 | 
            +
                  changes_files = []
         | 
| 591 | 
            +
                  files.each do |path|
         | 
| 592 | 
            +
                    changes_files.push({
         | 
| 593 | 
            +
                      :name => path,
         | 
| 594 | 
            +
                      :size => File.size?(path),
         | 
| 595 | 
            +
                      :md5sum => Digest::MD5.file(path).hexdigest,
         | 
| 596 | 
            +
                      :sha1sum => Digest::SHA1.file(path).hexdigest,
         | 
| 597 | 
            +
                      :sha256sum => Digest::SHA2.file(path).hexdigest,
         | 
| 598 | 
            +
                    })
         | 
| 599 | 
            +
                  end
         | 
| 600 | 
            +
             | 
| 601 | 
            +
                  # write change infos to .changes file
         | 
| 602 | 
            +
                  changes_path = File.basename(output_path, '.deb') + '.changes'
         | 
| 603 | 
            +
                  changes_data = template("deb/deb.changes.erb").result(binding)
         | 
| 604 | 
            +
                  File.write(changes_path, changes_data)
         | 
| 605 | 
            +
                  logger.log("Created changes", :path => changes_path)
         | 
| 606 | 
            +
                end # if deb_generate_changes
         | 
| 577 607 | 
             
              end # def output
         | 
| 578 608 |  | 
| 579 609 | 
             
              def converted_from(origin)
         | 
| @@ -827,11 +857,25 @@ class FPM::Package::Deb < FPM::Package | |
| 827 857 |  | 
| 828 858 | 
             
                # scan all conf file paths for files and add them
         | 
| 829 859 | 
             
                config_files.each do |path|
         | 
| 860 | 
            +
                  logger.debug("Checking if #{path} exists")
         | 
| 861 | 
            +
                  cfe = File.exist?("#{path}")
         | 
| 862 | 
            +
                  logger.debug("Check result #{cfe}")
         | 
| 830 863 | 
             
                  begin
         | 
| 831 864 | 
             
                    add_path(path, allconfigs)
         | 
| 832 865 | 
             
                  rescue Errno::ENOENT
         | 
| 833 | 
            -
                     | 
| 834 | 
            -
                       | 
| 866 | 
            +
                    if !cfe
         | 
| 867 | 
            +
                      raise FPM::InvalidPackageConfiguration,
         | 
| 868 | 
            +
                        "Error trying to use '#{path}' as a config file in the package. Does it exist?"
         | 
| 869 | 
            +
                    else
         | 
| 870 | 
            +
                      dcl = File.join(staging_path, path)
         | 
| 871 | 
            +
                      if !File.exist?("#{dcl}")
         | 
| 872 | 
            +
                        logger.debug("Adding config file #{path} to Staging area #{staging_path}")
         | 
| 873 | 
            +
                        FileUtils.mkdir_p(File.dirname(dcl))
         | 
| 874 | 
            +
                        FileUtils.cp_r path, dcl
         | 
| 875 | 
            +
                      else
         | 
| 876 | 
            +
                        logger.debug("Config file aready exists in staging area.")
         | 
| 877 | 
            +
                      end
         | 
| 878 | 
            +
                    end
         | 
| 835 879 | 
             
                  end
         | 
| 836 880 | 
             
                end
         | 
| 837 881 |  | 
| @@ -47,6 +47,11 @@ class get_metadata(Command): | |
| 47 47 |  | 
| 48 48 | 
             
                def process_dep(self, dep):
         | 
| 49 49 | 
             
                    deps = []
         | 
| 50 | 
            +
                    if hasattr(dep, 'marker') and dep.marker:
         | 
| 51 | 
            +
                        # PEP0508 marker present
         | 
| 52 | 
            +
                        if not dep.marker.evaluate():
         | 
| 53 | 
            +
                            return deps
         | 
| 54 | 
            +
             | 
| 50 55 | 
             
                    if dep.specs:
         | 
| 51 56 | 
             
                        for operator, version in dep.specs:
         | 
| 52 57 | 
             
                            deps.append("%s %s %s" % (dep.project_name,
         | 
    
        data/lib/fpm/package/python.rb
    CHANGED
    
    | @@ -229,7 +229,7 @@ class FPM::Package::Python < FPM::Package | |
| 229 229 |  | 
| 230 230 | 
             
                if !attributes[:no_auto_depends?] and attributes[:python_dependencies?]
         | 
| 231 231 | 
             
                  metadata["dependencies"].each do |dep|
         | 
| 232 | 
            -
                    dep_re = /^([^<>!= ]+)\s*(?:([ | 
| 232 | 
            +
                    dep_re = /^([^<>!= ]+)\s*(?:([~<>!=]{1,2})\s*(.*))?$/
         | 
| 233 233 | 
             
                    match = dep_re.match(dep)
         | 
| 234 234 | 
             
                    if match.nil?
         | 
| 235 235 | 
             
                      logger.error("Unable to parse dependency", :dependency => dep)
         | 
| @@ -240,7 +240,7 @@ class FPM::Package::Python < FPM::Package | |
| 240 240 | 
             
                    next if attributes[:python_disable_dependency].include?(name)
         | 
| 241 241 |  | 
| 242 242 | 
             
                    # convert == to =
         | 
| 243 | 
            -
                    if cmp == "=="
         | 
| 243 | 
            +
                    if cmp == "==" or cmp == "~="
         | 
| 244 244 | 
             
                      logger.info("Converting == dependency requirement to =", :dependency => dep )
         | 
| 245 245 | 
             
                      cmp = "="
         | 
| 246 246 | 
             
                    end
         | 
    
        data/lib/fpm/package/rpm.rb
    CHANGED
    
    
    
        data/lib/fpm/version.rb
    CHANGED
    
    
| @@ -0,0 +1,31 @@ | |
| 1 | 
            +
            Format: 1.8
         | 
| 2 | 
            +
            Date: <%= (if attributes[:source_date_epoch].nil? then Time.now() else Time.at(attributes[:source_date_epoch].to_i) end).strftime("%a, %d %b %Y %T %z") %>
         | 
| 3 | 
            +
            Source: <%= name %>
         | 
| 4 | 
            +
            Binary: <%= name %>
         | 
| 5 | 
            +
            Architecture: <%= architecture %>
         | 
| 6 | 
            +
            Version: <%= "#{epoch}:" if epoch %><%= version %><%= "-" + iteration.to_s if iteration %>
         | 
| 7 | 
            +
            Distribution: <%= distribution %>
         | 
| 8 | 
            +
            Urgency: medium
         | 
| 9 | 
            +
            Maintainer: <%= maintainer %>
         | 
| 10 | 
            +
            <% lines = (description or "no description given").split("\n") -%>
         | 
| 11 | 
            +
            <% firstline, *remainder = lines -%>
         | 
| 12 | 
            +
            Description: <%= firstline %>
         | 
| 13 | 
            +
            <% if remainder.any? -%>
         | 
| 14 | 
            +
            <%= remainder.collect { |l| l =~ /^ *$/ ? " ." : " #{l}" }.join("\n") %>
         | 
| 15 | 
            +
            <% end -%>
         | 
| 16 | 
            +
            Changes:
         | 
| 17 | 
            +
            <%= name %> (<%= "#{epoch}:" if epoch %><%= version %><%= "-" + iteration.to_s if iteration %>) whatever; urgency=medium
         | 
| 18 | 
            +
             .
         | 
| 19 | 
            +
               * Package created with FPM.
         | 
| 20 | 
            +
            Checksums-Sha1:
         | 
| 21 | 
            +
            <% changes_files.each do |file| -%>
         | 
| 22 | 
            +
             <%= file[:sha1sum] %> <%= file[:size] %> <%= file[:name] %>
         | 
| 23 | 
            +
            <% end -%>
         | 
| 24 | 
            +
            Checksums-Sha256:
         | 
| 25 | 
            +
            <% changes_files.each do |file| -%>
         | 
| 26 | 
            +
             <%= file[:sha256sum] %> <%= file[:size] %> <%= file[:name] %>
         | 
| 27 | 
            +
            <% end -%>
         | 
| 28 | 
            +
            Files:
         | 
| 29 | 
            +
            <% changes_files.each do |file| -%>
         | 
| 30 | 
            +
             <%= file[:md5sum] %> <%= file[:size] %> default <%= attributes[:deb_priority] %> <%= file[:name] %>
         | 
| 31 | 
            +
            <% end -%>
         | 
    
        data/templates/rpm.erb
    CHANGED
    
    | @@ -17,6 +17,9 @@ | |
| 17 17 | 
             
            # Disable checking for unpackaged files ?
         | 
| 18 18 | 
             
            #%undefine __check_files
         | 
| 19 19 |  | 
| 20 | 
            +
            # Allow building noarch packages that contain binaries
         | 
| 21 | 
            +
            %define _binaries_in_noarch_packages_terminate_build 0
         | 
| 22 | 
            +
             | 
| 20 23 | 
             
            # Use <%= attributes[:rpm_digest] %> file digest method. 
         | 
| 21 24 | 
             
            # The first macro is the one used in RPM v4.9.1.1
         | 
| 22 25 | 
             
            %define _binary_filedigest_algorithm <%= digest_algorithm %>
         | 
| @@ -133,7 +136,7 @@ upgrade() { | |
| 133 136 | 
             
            <%=      script(:before_upgrade) %>
         | 
| 134 137 | 
             
            <%     end -%>
         | 
| 135 138 | 
             
            }
         | 
| 136 | 
            -
             | 
| 139 | 
            +
            _install() {
         | 
| 137 140 | 
             
            <%# Making sure that at least one command is in the function -%>
         | 
| 138 141 | 
             
            <%# avoids a lot of potential errors, including the case that -%>
         | 
| 139 142 | 
             
            <%# the script is non-empty, but just whitespace and/or comments -%>
         | 
| @@ -145,7 +148,7 @@ install() { | |
| 145 148 | 
             
            if [ "${1}" -eq 1 ]
         | 
| 146 149 | 
             
            then
         | 
| 147 150 | 
             
                # "before install" goes here
         | 
| 148 | 
            -
                 | 
| 151 | 
            +
                _install
         | 
| 149 152 | 
             
            elif [ "${1}" -gt 1 ]
         | 
| 150 153 | 
             
            then
         | 
| 151 154 | 
             
                # "before upgrade" goes here
         | 
| @@ -163,7 +166,7 @@ upgrade() { | |
| 163 166 | 
             
            <%=      script(:after_upgrade) %>
         | 
| 164 167 | 
             
            <%     end -%>
         | 
| 165 168 | 
             
            }
         | 
| 166 | 
            -
             | 
| 169 | 
            +
            _install() {
         | 
| 167 170 | 
             
            <%# Making sure that at least one command is in the function -%>
         | 
| 168 171 | 
             
            <%# avoids a lot of potential errors, including the case that -%>
         | 
| 169 172 | 
             
            <%# the script is non-empty, but just whitespace and/or comments -%>
         | 
| @@ -175,7 +178,7 @@ install() { | |
| 175 178 | 
             
            if [ "${1}" -eq 1 ]
         | 
| 176 179 | 
             
            then
         | 
| 177 180 | 
             
                # "after install" goes here
         | 
| 178 | 
            -
                 | 
| 181 | 
            +
                _install
         | 
| 179 182 | 
             
            elif [ "${1}" -gt 1 ]
         | 
| 180 183 | 
             
            then
         | 
| 181 184 | 
             
                # "after upgrade" goes here
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: fpm
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1. | 
| 4 | 
            +
              version: 1.10.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Jordan Sissel
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2018-05-19 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: json
         | 
| @@ -132,16 +132,16 @@ dependencies: | |
| 132 132 | 
             
              name: ruby-xz
         | 
| 133 133 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 134 134 | 
             
                requirements:
         | 
| 135 | 
            -
                - - " | 
| 135 | 
            +
                - - "~>"
         | 
| 136 136 | 
             
                  - !ruby/object:Gem::Version
         | 
| 137 | 
            -
                    version:  | 
| 137 | 
            +
                    version: 0.2.3
         | 
| 138 138 | 
             
              type: :runtime
         | 
| 139 139 | 
             
              prerelease: false
         | 
| 140 140 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 141 141 | 
             
                requirements:
         | 
| 142 | 
            -
                - - " | 
| 142 | 
            +
                - - "~>"
         | 
| 143 143 | 
             
                  - !ruby/object:Gem::Version
         | 
| 144 | 
            -
                    version:  | 
| 144 | 
            +
                    version: 0.2.3
         | 
| 145 145 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 146 146 | 
             
              name: pleaserun
         | 
| 147 147 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -260,6 +260,7 @@ files: | |
| 260 260 | 
             
            - lib/fpm/version.rb
         | 
| 261 261 | 
             
            - templates/deb.erb
         | 
| 262 262 | 
             
            - templates/deb/changelog.erb
         | 
| 263 | 
            +
            - templates/deb/deb.changes.erb
         | 
| 263 264 | 
             
            - templates/deb/ldconfig.sh.erb
         | 
| 264 265 | 
             
            - templates/deb/postinst_upgrade.sh.erb
         | 
| 265 266 | 
             
            - templates/deb/postrm_upgrade.sh.erb
         | 
| @@ -293,7 +294,7 @@ required_ruby_version: !ruby/object:Gem::Requirement | |
| 293 294 | 
             
              requirements:
         | 
| 294 295 | 
             
              - - ">="
         | 
| 295 296 | 
             
                - !ruby/object:Gem::Version
         | 
| 296 | 
            -
                  version:  | 
| 297 | 
            +
                  version: 1.9.3
         | 
| 297 298 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 298 299 | 
             
              requirements:
         | 
| 299 300 | 
             
              - - ">="
         |