bernd / fpm-cookery

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

location of cache and pkg dirs for chain recipes #130

Open glensc opened 9 years ago

glensc commented 9 years ago

while chain_recipe supports locating chain_recipes from subdirs, i would still expect it's results be stored where main recipe resides, not aside subrecipe.

also clean command does not wipe dirs from subrecipes with current situation, then that would be solved as well.

here's the setup:

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

        source '', :with => :noop
        arch        'all'

        def build
        end

        def install
        end

        chain_package true
        chain_recipes 'recipes/fe'
        chain_recipes 'recipes/admin'
end

# cat recipes/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

# cat recipes/admin.rb 
class Admin < FPM::Cookery::Recipe
        description 'Admin Test'
        name        'admin'
        version     '1.0'
        revision    '1'

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

        def build
        end

        def install
        end
end

# ls -lR
.:
total 4
-rw-rw-r-- 1 vagrant vagrant 237 Sep  9 11:00 recipe.rb
drwxrwxr-x 1 vagrant vagrant  33 Sep  9 11:03 recipes/

./recipes:
total 8
-rw-rw-r-- 1 vagrant vagrant 251 Sep  9 10:56 admin.rb
-rw-rw-r-- 1 vagrant vagrant 242 Sep  8 12:09 fe.rb

and outcome:

# fpm-cook package -p centos
...

# find -name cache -o -name pkg -o -name '*.rpm' -o -name 'tmp-*'
./recipes/cache
./recipes/tmp-build
./recipes/pkg
./recipes/pkg/fe-1.0-1.noarch.rpm
./recipes/pkg/admin-1.0-1.noarch.rpm
./recipes/tmp-dest
./cache
./tmp-build
./tmp-dest
./pkg
./pkg/test-1.0-1.noarch.rpm

# fpm-cook clean -p centos 
===> Cleanup!

# find -name cache -o -name pkg -o -name '*.rpm' -o -name 'tmp-*'
./recipes/cache
./recipes/tmp-build
./recipes/pkg
./recipes/pkg/fe-1.0-1.noarch.rpm
./recipes/pkg/admin-1.0-1.noarch.rpm
./recipes/tmp-dest
./cache
./pkg
./pkg/test-1.0-1.noarch.rpm