bernd / fpm-cookery

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

chain recipe broken with cache #128

Open glensc opened 8 years ago

glensc commented 8 years ago

i tried to create subpackages using chain recipe (#30), basically the recipes are just top level recipes that i include in main recipe to achieve the goal.

but seems there's some issue with cache:

# cat recipe.rb
class TestChain < FPM::Cookery::Recipe
        name    'test'
        version '1.0'

        chain_package true
        chain_recipes 'fe'
end

# cat fe.rb
class Fe < FPM::Cookery::Recipe
        description 'Fe Test'
        name        'fe'
        version     '1.0'
        revision    '1'

        source      "https://github.com/bernd/fpm-cookery/trunk", :with => :svn
        arch        'all'

        def build
        end

        def install
        end
end
# fpm-cook package -p centos -D
===> Recipe test is a chain package; looking for child recipes to build
===> Located recipe at /vagrant/fpm-recipe/subpackage-test/fe.rb for child recipe fe; starting build
===> Starting package creation for fe-1.0 (centos, rpm)
===> 
DEBUG: Run lifecycle hook: before_dependency_installation
===> Verifying build_depends and depends with Puppet
===> All build_depends and depends packages installed
DEBUG: Run lifecycle hook: after_dependency_installation
===> Fetching source: 
===> Building in /vagrant/fpm-recipe/subpackage-test/tmp-build/trunk
===> Installing into /vagrant/fpm-recipe/subpackage-test/tmp-dest
"package input: "
{:color=>true, :debug=>true, :target=>nil, :platform=>"centos", :maintainer=>nil, :vendor=>nil, :skip_package=>false, :keep_destdir=>false, :dependency_check=>true, :quiet=>false, :tmp_root=>nil, :pkg_dir=>nil, :cache_dir=>nil}
"input path: "
"."
===> [FPM] Converting dir to rpm {}
WARNING: [FPM] no value for epoch is set, defaulting to nil {}
DDD=/tmp/package-rpm-build20150908-30279-17dbxjc/BUILD
DDD=/tmp/package-rpm-build20150908-30279-17dbxjc/RPMS
DDD=/tmp/package-rpm-build20150908-30279-17dbxjc/SRPMS
DDD=/tmp/package-rpm-build20150908-30279-17dbxjc/SOURCES
DDD=/tmp/package-rpm-build20150908-30279-17dbxjc/SPECS
===> [FPM] Reading template {"path":"/usr/share/ruby/vendor_ruby/fpm/templates/rpm.erb"}
WARNING: [FPM] no value for epoch is set, defaulting to nil {}
===> [FPM] Running rpmbuild {"args":["rpmbuild","-bb","--target","noarch","--define","buildroot /tmp/package-rpm-build20150908-30279-17dbxjc/BUILD","--define","_topdir /tmp/package-rpm-build20150908-30279-17dbxjc","--define","_sourcedir /tmp/package-rpm-build20150908-30279-17dbxjc","--define","_rpmdir /tmp/package-rpm-build20150908-30279-17dbxjc/RPMS","/tmp/package-rpm-build20150908-30279-17dbxjc/SPECS/fe.spec"]}
===> [FPM] Building target platforms: noarch {}
===> [FPM] Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.79548 {}
===> [FPM] Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.79548 {}
===> [FPM] Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.79548 {}
===> [FPM] Processing files: fe-1.0-1.noarch {}
===> [FPM] Wrote: /tmp/package-rpm-build20150908-30279-17dbxjc/RPMS/fe-1.0-1.noarch.rpm {}
===> [FPM] Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.79548 {}
WARNING: [FPM] no value for epoch is set, defaulting to nil {}
===> Created package: /vagrant/fpm-recipe/subpackage-test/pkg/fe-1.0-1.noarch.rpm
===> Finished building fe, moving on to next recipe
===> Starting package creation for test-1.0 (centos, rpm)
===> 
DEBUG: Run lifecycle hook: before_dependency_installation
===> Verifying build_depends and depends with Puppet
===> All build_depends and depends packages installed
DEBUG: Run lifecycle hook: after_dependency_installation
===> Fetching source: 
===> Using cached file /vagrant/fpm-recipe/subpackage-test/cache
/usr/share/ruby/vendor_ruby/fpm/cookery/source_integrity_check.rb:63:in `read': Is a directory - /vagrant/fpm-recipe/subpackage-test/cache (Errno::EISDIR)
        from /usr/share/ruby/vendor_ruby/fpm/cookery/source_integrity_check.rb:63:in `block in build_checksum'
        from /usr/share/ruby/vendor_ruby/fpm/cookery/source_integrity_check.rb:62:in `open'
        from /usr/share/ruby/vendor_ruby/fpm/cookery/source_integrity_check.rb:62:in `build_checksum'
        from /usr/share/ruby/vendor_ruby/fpm/cookery/source_integrity_check.rb:37:in `verify!'
        from /usr/share/ruby/vendor_ruby/fpm/cookery/source_integrity_check.rb:15:in `initialize'
        from /usr/share/ruby/vendor_ruby/fpm/cookery/packager.rb:80:in `new'
        from /usr/share/ruby/vendor_ruby/fpm/cookery/packager.rb:80:in `block in dispense'
        from /usr/share/ruby/vendor_ruby/fpm/cookery/packager.rb:75:in `chdir'
        from /usr/share/ruby/vendor_ruby/fpm/cookery/packager.rb:75:in `dispense'
        from /usr/share/ruby/vendor_ruby/fpm/cookery/chain_packager.rb:47:in `run'
        from /usr/share/ruby/vendor_ruby/fpm/cookery/cli.rb:111:in `exec'
        from /usr/share/ruby/vendor_ruby/fpm/cookery/cli.rb:77:in `block in execute'
        from /usr/share/ruby/vendor_ruby/fpm/cookery/book.rb:16:in `call'
        from /usr/share/ruby/vendor_ruby/fpm/cookery/book.rb:16:in `load_recipe'
        from /usr/share/ruby/vendor_ruby/fpm/cookery/cli.rb:73:in `execute'
        from /usr/share/ruby/vendor_ruby/clamp/command.rb:69:in `run'
        from /usr/share/ruby/vendor_ruby/clamp/subcommand/execution.rb:11:in `execute'
        from /usr/share/ruby/vendor_ruby/clamp/command.rb:69:in `run'
        from /usr/share/ruby/vendor_ruby/clamp/command.rb:127:in `run'
        from /usr/bin/fpm-cook:7:in `<main>'

# 
glensc commented 8 years ago

actually, looks like it successfully finished the chained package, and then attempts to do something with "main" recipe

which fails because no source defined, so i add one:

    source '', :with => :noop

now it fails because build not defined:

===> Finished building fe, moving on to next recipe
===> Starting package creation for test-1.0 (centos, rpm)
===> 
DEBUG: Run lifecycle hook: before_dependency_installation
===> Verifying build_depends with Puppet
===> All build_depends packages installed
DEBUG: Run lifecycle hook: after_dependency_installation
===> Fetching source: 
===> Noop source_handler; do nothing.
===> Not extracting - noop source handler
===> Building in /vagrant/fpm-recipe/subpackage-test/tmp-build
/usr/share/ruby/vendor_ruby/fpm/cookery/packager.rb:123:in `block (2 levels) in dispense': undefined method `build' for #<#<Module:0xa78d4f8>::TestChain:0xa78c7c4> (NoMethodError)
        from /usr/share/ruby/vendor_ruby/fpm/cookery/packager.rb:113:in `chdir'
        from /usr/share/ruby/vendor_ruby/fpm/cookery/packager.rb:113:in `block in dispense'
        from /usr/share/ruby/vendor_ruby/fpm/cookery/packager.rb:105:in `chdir'
        from /usr/share/ruby/vendor_ruby/fpm/cookery/packager.rb:105:in `dispense'
        from /usr/share/ruby/vendor_ruby/fpm/cookery/chain_packager.rb:47:in `run'
        from /usr/share/ruby/vendor_ruby/fpm/cookery/cli.rb:111:in `exec'
        from /usr/share/ruby/vendor_ruby/fpm/cookery/cli.rb:77:in `block in execute'
        from /usr/share/ruby/vendor_ruby/fpm/cookery/book.rb:16:in `call'
        from /usr/share/ruby/vendor_ruby/fpm/cookery/book.rb:16:in `load_recipe'
        from /usr/share/ruby/vendor_ruby/fpm/cookery/cli.rb:73:in `execute'
        from /usr/share/ruby/vendor_ruby/clamp/command.rb:69:in `run'
        from /usr/share/ruby/vendor_ruby/clamp/subcommand/execution.rb:11:in `execute'
        from /usr/share/ruby/vendor_ruby/clamp/command.rb:69:in `run'
        from /usr/share/ruby/vendor_ruby/clamp/command.rb:127:in `run'
        from /usr/bin/fpm-cook:7:in `<main>'

so i add build:

    def build
    end

now it fails with missing install:

===> Finished building fe, moving on to next recipe
===> Starting package creation for test-1.0 (centos, rpm)
===> 
DEBUG: Run lifecycle hook: before_dependency_installation
===> Verifying build_depends with Puppet
===> All build_depends packages installed
DEBUG: Run lifecycle hook: after_dependency_installation
===> Fetching source: 
===> Noop source_handler; do nothing.
===> Not extracting - noop source handler
===> Building in /vagrant/fpm-recipe/subpackage-test/tmp-build
===> Installing into /vagrant/fpm-recipe/subpackage-test/tmp-dest
/usr/share/ruby/vendor_ruby/fpm/cookery/packager.rb:132:in `block (2 levels) in dispense': private method `install' called for #<#<Module:0xa5394f4>::TestChain:0xa538680> (NoMethodError)
        from /usr/share/ruby/vendor_ruby/fpm/cookery/packager.rb:113:in `chdir'
        from /usr/share/ruby/vendor_ruby/fpm/cookery/packager.rb:113:in `block in dispense'
        from /usr/share/ruby/vendor_ruby/fpm/cookery/packager.rb:105:in `chdir'
        from /usr/share/ruby/vendor_ruby/fpm/cookery/packager.rb:105:in `dispense'
        from /usr/share/ruby/vendor_ruby/fpm/cookery/chain_packager.rb:47:in `run'
        from /usr/share/ruby/vendor_ruby/fpm/cookery/cli.rb:111:in `exec'
        from /usr/share/ruby/vendor_ruby/fpm/cookery/cli.rb:77:in `block in execute'
        from /usr/share/ruby/vendor_ruby/fpm/cookery/book.rb:16:in `call'
        from /usr/share/ruby/vendor_ruby/fpm/cookery/book.rb:16:in `load_recipe'
        from /usr/share/ruby/vendor_ruby/fpm/cookery/cli.rb:73:in `execute'
        from /usr/share/ruby/vendor_ruby/clamp/command.rb:69:in `run'
        from /usr/share/ruby/vendor_ruby/clamp/subcommand/execution.rb:11:in `execute'
        from /usr/share/ruby/vendor_ruby/clamp/command.rb:69:in `run'
        from /usr/share/ruby/vendor_ruby/clamp/command.rb:127:in `run'
        from /usr/bin/fpm-cook:7:in `<main>'

i add empty install as well:

    def install
    end

and now it fails with rpmbuild:

===> Finished building fe, moving on to next recipe
===> Starting package creation for test-1.0 (centos, rpm)
===> 
DEBUG: Run lifecycle hook: before_dependency_installation
===> Verifying build_depends with Puppet
===> All build_depends packages installed
DEBUG: Run lifecycle hook: after_dependency_installation
===> Fetching source: 
===> Noop source_handler; do nothing.
===> Not extracting - noop source handler
===> Building in /vagrant/fpm-recipe/subpackage-test/tmp-build
===> Installing into /vagrant/fpm-recipe/subpackage-test/tmp-dest
===> [FPM] Converting dir to rpm {}
WARNING: [FPM] no value for epoch is set, defaulting to nil {}
===> [FPM] Reading template {"path":"/usr/share/ruby/vendor_ruby/fpm/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-build20150908-1959-19jt1w6/BUILD","--define","_topdir /tmp/package-rpm-build20150908-1959-19jt1w6","--define","_sourcedir /tmp/package-rpm-build20150908-1959-19jt1w6","--define","_rpmdir /tmp/package-rpm-build20150908-1959-19jt1w6/RPMS","/tmp/package-rpm-build20150908-1959-19jt1w6/SPECS/test.spec"]}
===> [FPM] Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.84463 {}
===> [FPM] Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.84463 {}
===> [FPM] Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.84463 {}
===> [FPM] Processing files: test-1.0-1.i686 {}
===> [FPM] Processing files: test-debuginfo-1.0-1.i686 {}
===> [FPM] error: Could not open %files file /tmp/package-rpm-build20150908-1959-19jt1w6/BUILD/debugfiles.list: No such file or directory {}
===> [FPM]  {}
===> [FPM]     Could not open %files file /tmp/package-rpm-build20150908-1959-19jt1w6/BUILD/debugfiles.list: No such file or directory {}
===> [FPM]  {}
===> [FPM] RPM build errors: {}
WARNING: [FPM] no value for epoch is set, defaulting to nil {}
===> Created package: /vagrant/fpm-recipe/subpackage-test/pkg/test-1.0-1.i686.rpm
/usr/share/ruby/vendor_ruby/fpm/util.rb:83:in `safesystem': rpmbuild failed (exit code 1). Full command was:["rpmbuild", "-bb", "--define", "buildroot /tmp/package-rpm-build20150908-1959-19jt1w6/BUILD", "--define", "_topdir /tmp/package-rpm-build20150908-1959-19jt1w6", "--define", "_sourcedir /tmp/package-rpm-build20150908-1959-19jt1w6", "--define", "_rpmdir /tmp/package-rpm-build20150908-1959-19jt1w6/RPMS", "/tmp/package-rpm-build20150908-1959-19jt1w6/SPECS/test.spec"] (FPM::Util::ProcessFailed)
        from /usr/share/ruby/vendor_ruby/fpm/package/rpm.rb:498:in `output'
        from /usr/share/ruby/vendor_ruby/fpm/cookery/packager.rb:174:in `block in build_package'
        from /usr/share/ruby/vendor_ruby/fpm/cookery/packager.rb:156:in `chdir'
        from /usr/share/ruby/vendor_ruby/fpm/cookery/packager.rb:156:in `build_package'
        from /usr/share/ruby/vendor_ruby/fpm/cookery/packager.rb:143:in `dispense'
        from /usr/share/ruby/vendor_ruby/fpm/cookery/chain_packager.rb:47:in `run'
        from /usr/share/ruby/vendor_ruby/fpm/cookery/cli.rb:111:in `exec'
        from /usr/share/ruby/vendor_ruby/fpm/cookery/cli.rb:77:in `block in execute'
        from /usr/share/ruby/vendor_ruby/fpm/cookery/book.rb:16:in `call'
        from /usr/share/ruby/vendor_ruby/fpm/cookery/book.rb:16:in `load_recipe'
        from /usr/share/ruby/vendor_ruby/fpm/cookery/cli.rb:73:in `execute'
        from /usr/share/ruby/vendor_ruby/clamp/command.rb:69:in `run'
        from /usr/share/ruby/vendor_ruby/clamp/subcommand/execution.rb:11:in `execute'
        from /usr/share/ruby/vendor_ruby/clamp/command.rb:69:in `run'
        from /usr/share/ruby/vendor_ruby/clamp/command.rb:127:in `run'
        from /usr/bin/fpm-cook:7:in `<main>'

so apparently it treats the "main" package also like it should produce something. i thought chain_package = true means it only has chain_recipes.

also imho source and build and install could be predefined (defaulted to noop), so i do not have to declare them as empty. it's perfectly valid to build package without build or install section, i.e if your package contains only dependency metadata.

beddari commented 8 years ago

Sorry, I have not have looked at the rest of this - but predefining source, build and install to be empty is a change I'd like :+1: