Permalink
Browse files

Use local-PERL-DIGEST for carton install

The DIGEST is based on the sha1sum of carton.lock. This
ensures that if carton.lock changes, a fresh library
directory will be created.

Note: the old library is not removed. This speeds reversion
as the old library is still available, but will cause
clutter over time.
  • Loading branch information...
1 parent 985ec30 commit 4cedc44951959298504e9537ab0c0d0c77cf729d @xdg xdg committed Feb 10, 2012
Showing with 8 additions and 2 deletions.
  1. +8 −2 cookbooks/carton/providers/app.rb
@@ -23,12 +23,18 @@
include Chef::Mixin::ShellOut
action :create do
+ # XXX should probably fail if no carton.lock is found in cwd
+
app_perlbrew = new_resource.perlbrew
- app_cwd = new_resource.cwd
app_user = new_resource.user
app_group = new_resource.group
- app_local = "local-#{app_perlbrew}"
+ app_cwd = new_resource.cwd
app_command = "carton exec -I lib -- #{new_resource.command}"
+
+ # hash carton.lock to ensure library dir is unique to a lock file
+ lock_hash = `sha1sum #{app_cwd}/carton.lock`[0..7]
+
+ app_local = "local-#{app_perlbrew}-#{lock_hash}"
app_env = new_resource.environment.merge({
'PERLBREW_ROOT' => node['perlbrew']['perlbrew_root'],
'PERLBREW_HOME' => node['perlbrew']['perlbrew_root'],

0 comments on commit 4cedc44

Please sign in to comment.