jordansissel / fpm

Effing package management! Build packages for multiple platforms (deb, rpm, etc) with great ease and sanity.
http://fpm.readthedocs.io/en/latest/
Other
11.13k stars 1.07k forks source link

Failure to package Railties 3.1.4 with rpm #222

Closed mathie closed 11 years ago

mathie commented 12 years ago

Trying to bundle up all our gem dependencies into an RPM for deployment, I came across a curious error:

Processing files: gem-bundle-2012.05.16.11.23.25-1
error: File not found: [...]/ruby/1.9.1/gems/railties-3.1.4/lib/rails/generators/rails/plugin_new/templates/gem-bundle%.gemspec

It turns out that railties has a file called %name%.gemspec, and a directory called %name%. I guess that RPM is helpfully substituting %name with the package name. I'm not terribly familiar with RPM any longer, but http://www.rpm.org/wiki/PackagerDocs/Macros (search the page for '%%') seems to suggest that literal % signs should be escaped by doubling them up?

Meanwhile, I'm going to work around it by nuking those files for now – we won't be templating up any new Rails apps in production anyway. :)

jordansissel commented 12 years ago

haha, fpm finds all kinds of strange behaviors in rpm ;)

I'll have a go at reproducing this and fixing it with the %% escape. Thanks for reporting!

rajatvig commented 12 years ago

Bothered by the same one right now for Railties 3.2.3 with an error like

RPM build errors: Macro %_binary_filedigest_algorithm has empty body Macro %_binary_payload has empty body Macro %_binary_filedigest_algorithm has empty body Macro %_binary_payload has empty body File not found: /tmp/package-rpm-build20120524-4701-39cn6v/BUILD/var/lib/nginx/callcenter/vendor/bundle/ruby/1.9.1/gems/railties-3.2.3/lib/rails/generators/rails/plugin_new/templates/callcenter%.gemspec File not found: /tmp/package-rpm-build20120524-4701-39cn6v/BUILD/var/lib/nginx/callcenter/vendor/bundle/ruby/1.9.1/gems/railties-3.2.3/lib/rails/generators/rails/plugin_new/templates/app/controllers/callcenter%/application_controller.rb.tt File not found: /tmp/package-rpm-build20120524-4701-39cn6v/BUILD/var/lib/nginx/callcenter/vendor/bundle/ruby/1.9.1/gems/railties-3.2.3/lib/rails/generators/rails/plugin_new/templates/app/helpers/callcenter%/application_helper.rb.tt File not found: /tmp/package-rpm-build20120524-4701-39cn6v/BUILD/var/lib/nginx/callcenter/vendor/bundle/ruby/1.9.1/gems/railties-3.2.3/lib/rails/generators/rails/plugin_new/templates/app/views/layouts/callcenter%/application.html.erb.tt File not found: /tmp/package-rpm-build20120524-4701-39cn6v/BUILD/var/lib/nginx/callcenter/vendor/bundle/ruby/1.9.1/gems/railties-3.2.3/lib/rails/generators/rails/plugin_new/templates/lib/callcenter%/engine.rb File not found: /tmp/package-rpm-build20120524-4701-39cn6v/BUILD/var/lib/nginx/callcenter/vendor/bundle/ruby/1.9.1/gems/railties-3.2.3/lib/rails/generators/rails/plugin_new/templates/lib/callcenter%/version.rb File not found: /tmp/package-rpm-build20120524-4701-39cn6v/BUILD/var/lib/nginx/callcenter/vendor/bundle/ruby/1.9.1/gems/railties-3.2.3/lib/rails/generators/rails/plugin_new/templates/lib/callcenter%.rb File not found: /tmp/package-rpm-build20120524-4701-39cn6v/BUILD/var/lib/nginx/callcenter/vendor/bundle/ruby/1.9.1/gems/railties-3.2.3/lib/rails/generators/rails/plugin_new/templates/lib/tasks/callcenter%_tasks.rake File not found: /tmp/package-rpm-build20120524-4701-39cn6v/BUILD/var/lib/nginx/callcenter/vendor/bundle/ruby/1.9.1/gems/railties-3.2.3/lib/rails/generators/rails/plugin_new/templates/test/callcenter%_test.rb

skull-squadron commented 12 years ago

+1

jordansissel commented 12 years ago

I've tried many different attempts to escape '%' in filenames. All have failed. I've escalated to the rpm mailling list seeking aid :)

jordansissel commented 12 years ago

This might actually be the nail in rpmbuild's coffin. Could use this bug as incentive to finish my work on the pure-ruby rpm read/write library (reading is already implemented).

hatless commented 12 years ago

Meh. Nuking the files too. Not so good, as this could result at some point in apps blowing up due to missing files referenced by some require somewhere.

jordansissel commented 12 years ago

indeed, I'll see if I can come up with a solution here.

jordansissel commented 12 years ago

I got it working with --exclude

jordansissel commented 12 years ago

This is the command known to fail:

This succeeds:

It excludes any files with '%' in the name.

jordansissel commented 12 years ago
% ruby bin/fpm -s gem -t rpm --exclude '*%*' -v 3.2.3 railties 
Successfully installed railties-3.2.3
1 gem installed
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.AcNxKs
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.ObIpLk
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.KqoVLc
Processing files: rubygem-railties-3.2.3-1.noarch
Wrote: /tmp/package-rpm-build20120807-6642-1wnw47m/RPMS/noarch/rubygem-railties-3.2.3-1.noarch.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.XP9hH8
Created rpm {"path":"rubygem-railties-3.2.3-1.noarch.rpm"}
hatless commented 12 years ago

Much obliged.

jordansissel commented 11 years ago

Thanks to #266:

% ruby bin/fpm -s gem -t rpm -v 3.1.4 railties 
Fetching: railties-3.1.4.gem (100%)
Successfully installed railties-3.1.4
1 gem installed
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.p0kJc1
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.nvzVgT
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.lnJJlL
Processing files: rubygem-railties-3.1.4-1.noarch
Wrote: /tmp/package-rpm-build20120926-22163-vyi0bj/RPMS/noarch/rubygem-railties-3.1.4-1.noarch.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.v53PtG
Created rpm {"path":"rubygem-railties-3.1.4-1.noarch.rpm"}