bernd / fpm-cookery

A tool for building software packages with fpm.
Other
460 stars 88 forks source link

Epoch method undefined, and Empty tag: Packager: {} #51

Closed sepulworld closed 10 years ago

sepulworld commented 10 years ago

Greetings,

Testing with erlang r15.rb recipe from fpm-recipes

When the version is set to

version '1:16.b.1'

I get:

/usr/local/lib/ruby/gems/2.0.0/gems/fpm-cookery-0.16.1/lib/fpm/cookery/packager.rb:155:in `block in build_package': undefined method `epoch=' for #<FPM::Cookery::Package::Dir:0x002ad0c7ea8540> (NoMethodError)
    from /usr/local/lib/ruby/gems/2.0.0/gems/fpm-cookery-0.16.1/lib/fpm/cookery/packager.rb:146:in `chdir'
    from /usr/local/lib/ruby/gems/2.0.0/gems/fpm-cookery-0.16.1/lib/fpm/cookery/packager.rb:146:in `build_package'
    from /usr/local/lib/ruby/gems/2.0.0/gems/fpm-cookery-0.16.1/lib/fpm/cookery/packager.rb:133:in `dispense'
    from /usr/local/lib/ruby/gems/2.0.0/gems/fpm-cookery-0.16.1/lib/fpm/cookery/cli.rb:104:in `exec'
    from /usr/local/lib/ruby/gems/2.0.0/gems/fpm-cookery-0.16.1/lib/fpm/cookery/cli.rb:68:in `block in execute'
    from /usr/local/lib/ruby/gems/2.0.0/gems/fpm-cookery-0.16.1/lib/fpm/cookery/book.rb:16:in `call'
    from /usr/local/lib/ruby/gems/2.0.0/gems/fpm-cookery-0.16.1/lib/fpm/cookery/book.rb:16:in `load_recipe'
    from /usr/local/lib/ruby/gems/2.0.0/gems/fpm-cookery-0.16.1/lib/fpm/cookery/cli.rb:64:in `execute'
    from /usr/local/lib/ruby/gems/2.0.0/gems/clamp-0.6.1/lib/clamp/command.rb:67:in `run'
    from /usr/local/lib/ruby/gems/2.0.0/gems/clamp-0.6.1/lib/clamp/subcommand/execution.rb:11:in `execute'
    from /usr/local/lib/ruby/gems/2.0.0/gems/clamp-0.6.1/lib/clamp/command.rb:67:in `run'
    from /usr/local/lib/ruby/gems/2.0.0/gems/clamp-0.6.1/lib/clamp/command.rb:125:in `run'
    from /usr/local/lib/ruby/gems/2.0.0/gems/fpm-cookery-0.16.1/bin/fpm-cook:7:in `<top (required)>'
    from /usr/local/bin/fpm-cook:23:in `load'
    from /usr/local/bin/fpm-cook:23:in `<main>'

When I change the version to

version '16.b.1'

I get:

 ===> [FPM] Converting dir to rpm {}
WARNING: [FPM] no value for epoch is set, defaulting to nil {}
===> [FPM] Reading template {"path":"/usr/local/lib/ruby/gems/2.0.0/gems/fpm-0.4.42/templates/rpm.erb"}
WARNING: [FPM] no value for epoch is set, defaulting to nil {}
===> [FPM] Running rpmbuild {"args":["rpmbuild","-bb","--define","buildroot /tmp/package-rpm-build20131014-18734-7gl6w5/BUILD","--define","_topdir /tmp/package-rpm-build20131014-18734-7gl6w5","--define","_sourcedir /tmp/package-rpm-build20131014-18734-7gl6w5","--define","_rpmdir /tmp/package-rpm-build20131014-18734-7gl6w5/RPMS","/tmp/package-rpm-build20131014-18734-7gl6w5/SPECS/erlang-r16.spec"]}
ERROR: [FPM] error: line 50: Empty tag: Packager: {}
WARNING: [FPM] no value for epoch is set, defaulting to nil {}
===> Created package: /src/fpm-recipes/erlang/pkg/erlang-r16-16.b.1.fpm0-1.x86_64.rpm

I tested with other recipes and (such as the redis recipe) and I get

===> Installing into /src/fpm-recipes/redis/tmp-dest
===> [FPM] Converting dir to rpm {}
WARNING: [FPM] no value for epoch is set, defaulting to nil {}
===> [FPM] Reading template {"path":"/usr/local/lib/ruby/gems/2.0.0/gems/fpm-0.4.42/templates/rpm.erb"}
WARNING: [FPM] no value for epoch is set, defaulting to nil {}
===> [FPM] Running rpmbuild {"args":["rpmbuild","-bb","--define","buildroot /tmp/package-rpm-build20131014-23860-ovavku/BUILD","--define","_topdir /tmp/package-rpm-build20131014-23860-ovavku","--define","_sourcedir /tmp/package-rpm-build20131014-23860-ovavku","--define","_rpmdir /tmp/package-rpm-build20131014-23860-ovavku/RPMS","/tmp/package-rpm-build20131014-23860-ovavku/SPECS/redis-server.spec"]}
ERROR: [FPM] error: line 50: Empty tag: Packager: {}
WARNING: [FPM] no value for epoch is set, defaulting to nil {}
===> Created package: /src/fpm-recipes/redis/pkg/redis-server-2.6.5.fpm0-1.x86_64.rpm
/usr/local/lib/ruby/gems/2.0.0/gems/fpm-0.4.42/lib/fpm/util.rb:55:in `safesystem': rpmbuild failed (exit code 1). Full command was:["rpmbuild", "-bb", "--define", "buildroot /tmp/package-rpm-build20131014-23860-ovavku/BUILD", "--define", "_topdir /tmp/package-rpm-build20131014-23860-ovavku", "--define", "_sourcedir /tmp/package-rpm-build20131014-23860-ovavku", "--define", "_rpmdir /tmp/package-rpm-build20131014-23860-ovavku/RPMS", "/tmp/package-rpm-build20131014-23860-ovavku/SPECS/redis-server.spec"] (FPM::Util::ProcessFailed)
    from /usr/local/lib/ruby/gems/2.0.0/gems/fpm-0.4.42/lib/fpm/package/rpm.rb:352:in `output'
    from /usr/local/lib/ruby/gems/2.0.0/gems/fpm-cookery-0.16.1/lib/fpm/cookery/packager.rb:165:in `block in build_package'
    from /usr/local/lib/ruby/gems/2.0.0/gems/fpm-cookery-0.16.1/lib/fpm/cookery/packager.rb:146:in `chdir'
    from /usr/local/lib/ruby/gems/2.0.0/gems/fpm-cookery-0.16.1/lib/fpm/cookery/packager.rb:146:in `build_package'
    from /usr/local/lib/ruby/gems/2.0.0/gems/fpm-cookery-0.16.1/lib/fpm/cookery/packager.rb:133:in `dispense'
    from /usr/local/lib/ruby/gems/2.0.0/gems/fpm-cookery-0.16.1/lib/fpm/cookery/cli.rb:104:in `exec'
    from /usr/local/lib/ruby/gems/2.0.0/gems/fpm-cookery-0.16.1/lib/fpm/cookery/cli.rb:68:in `block in execute'
    from /usr/local/lib/ruby/gems/2.0.0/gems/fpm-cookery-0.16.1/lib/fpm/cookery/book.rb:16:in `call'
    from /usr/local/lib/ruby/gems/2.0.0/gems/fpm-cookery-0.16.1/lib/fpm/cookery/book.rb:16:in `load_recipe'
    from /usr/local/lib/ruby/gems/2.0.0/gems/fpm-cookery-0.16.1/lib/fpm/cookery/cli.rb:64:in `execute'
    from /usr/local/lib/ruby/gems/2.0.0/gems/clamp-0.6.1/lib/clamp/command.rb:67:in `run'
    from /usr/local/lib/ruby/gems/2.0.0/gems/clamp-0.6.1/lib/clamp/subcommand/execution.rb:11:in `execute'
    from /usr/local/lib/ruby/gems/2.0.0/gems/clamp-0.6.1/lib/clamp/command.rb:67:in `run'
    from /usr/local/lib/ruby/gems/2.0.0/gems/clamp-0.6.1/lib/clamp/command.rb:125:in `run'
    from /usr/local/lib/ruby/gems/2.0.0/gems/fpm-cookery-0.16.1/bin/fpm-cook:7:in `<top (required)>'
    from /usr/local/bin/fpm-cook:23:in `load'
    from /usr/local/bin/fpm-cook:23:in `<main>'

Running centos5 system for the build.

Ruby 2.0.0

VERSION = '0.16.1'

sepulworld commented 10 years ago

Also tried build from Ruby 1.8.7, output was the same.

sepulworld commented 10 years ago

I tested recipe builds out from a new CentOS 6 install and getting same error:

ERROR: [FPM] error: line 50: Empty tag: Packager: {}

Attempting to find out where this is happening exactly in the code now...

beddari commented 10 years ago

On a general note I don't think rpm has seen much testing with these recipies. I've seen the same issue but only worked around it. I'm not sure if it is even possible to keep the same kind of versioning format (1:16.b.1) across deb and rpm. I do remember this was discussed at some point in time in the fpm project.

sepulworld commented 10 years ago

Thank you for the background and info! Yeah, I tested without the epoch value on a few different recipes (16.b.1 for example with Erlang) and it provides a warning about the missing epoch value but also the error:

ERROR: [FPM] error: line 50: Empty tag: Packager: {}

And the fpm package build fails. I'm assuming it is passing an empty value for the epoch that is causing fpm to fail? I will fork and try to uncover the issue and see if there is something I can do to help out. I really like this project, and would like to see it succeed with rpm builds! The deb builds do seem fine, as I tested the Erlang recipe out on Ubuntu fine.

sepulworld commented 10 years ago

fpm-0.4.42/templates/rpm.erb has a tag for 'maintainer'

If the recipe doesn't specify the maintainer then fpm-cook errors out with

ERROR: [FPM] error: line 50: Empty tag: Packager: {}

Quick fix is to put maintainer value in the recipe.

maintainer 'Zane <sepulworld@gmail.com>'

Real fix would be a default maintainer value set to based upon user/hostname

maintainer = "<#{ENV["USER"]}@#{Socket.gethostname}>"

Any thoughts on that?

bernd commented 10 years ago

@sepulworld I pushed a fix for this and released version 0.16.2 to rubygems. Please test if this works for you and reopen the issue if not.

Thank you for the report!

bernd commented 10 years ago

@sepulworld Also, a default maintainer is set based on your suggestion. Thanks!