fpm-cookery 0.31.0 → 0.32.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 82401ffb722aef0a168578e624216a7ccd85310d
4
- data.tar.gz: d223a2d22f15a430e97d2fddaab03c4733a3ba13
3
+ metadata.gz: a8092cdd01badb7c7c69adc60983e1d8b220f878
4
+ data.tar.gz: b31722bf137e40a7201b1b8b00aaa6adc89ca165
5
5
  SHA512:
6
- metadata.gz: 0a1c032e19a090b2856e51f111bfa8e74b376fab56861921d7d3b0970c7ad2584f7b35d7fac71bde72aec2260577d622f679287f23e0afe4acd2893f1d3f2c20
7
- data.tar.gz: 9c72fcfaf623cfbd3aecc7d87c5ffb586828a1fbe0a9113bfaa97a6a3f9e06c6799388696fe8ca3550943277bbf66150a967792ea3ae3e246c4396c4fb88cfe3
6
+ metadata.gz: cf005ab828be976ab4372ea4366155ac3e0c9b21d545d462a7000430ceebd4117c0cff927c7feb17a39873e6057b79d8a5f83e8bb30789f3ff216efc2a2674af
7
+ data.tar.gz: a3b7a495348df7a575f802f7f4881a4996791a7ae5a4fade00f62111c5da79196fa99c08ee4cfa2a95e339e0caa07511bafcdbad5b074647e6682ee3e335a894
data/.gitignore CHANGED
@@ -12,3 +12,6 @@ tmp-dest/
12
12
  .vagrant
13
13
  Vagrantfile
14
14
  /vendor
15
+
16
+ # vim backups
17
+ *~
@@ -1,3 +1,13 @@
1
+ # v0.32.0
2
+ * Add `sourcedir` accessor that holds the path to the extracted source. (#132)
3
+ * Add support for DirRecipe and Directory Handler. (cas-ei / #147)
4
+ * Extend virtualenv support. (MrPrimate / #146)
5
+ * Don't dereference symlinks in 'install'. (phyber / #143)
6
+ * Add support for OracleLinux. (#148)
7
+ * Initialize submodules after sha/tag/branch has been set. (#144)
8
+ * Fix configure arguments for list of strings.
9
+
10
+
1
11
  # v0.31.0 (2015-11-07)
2
12
  * Add support for .tar archives. (devkid / #132)
3
13
  * Add support for virtualenv recipes. (skoenig/zalando / #137)
@@ -23,6 +23,6 @@ Gem::Specification.new do |s|
23
23
  s.add_runtime_dependency "fpm", "~> 1.1"
24
24
  s.add_runtime_dependency "facter"
25
25
  s.add_runtime_dependency "puppet", "~> 3.4"
26
- s.add_runtime_dependency "addressable"
26
+ s.add_runtime_dependency "addressable", "~> 2.3.8"
27
27
  s.add_runtime_dependency "systemu"
28
28
  end
@@ -25,9 +25,10 @@ module FPM
25
25
 
26
26
  def self.target
27
27
  @target ||= case platform
28
- when :centos, :redhat, :fedora, :amazon, :scientific then :rpm
29
- when :debian, :ubuntu then :deb
30
- when :darwin then :osxpkg
28
+ when :centos, :redhat, :fedora, :amazon,
29
+ :scientific, :oraclelinux then :rpm
30
+ when :debian, :ubuntu then :deb
31
+ when :darwin then :osxpkg
31
32
  end
32
33
  end
33
34
 
@@ -12,8 +12,11 @@ module FPM
12
12
  def package_setup
13
13
  fpm.version = recipe.version
14
14
  fpm.attributes[:virtualenv_pypi] = recipe.virtualenv_pypi unless recipe.virtualenv_pypi.nil?
15
+ fpm.attributes[:virtualenv_pypi_extra_index_urls] = recipe.virtualenv_pypi_extra_index_urls unless recipe.virtualenv_pypi_extra_index_urls.nil?
15
16
  fpm.attributes[:virtualenv_install_location] = recipe.virtualenv_install_location unless recipe.virtualenv_install_location.nil?
16
17
  fpm.attributes[:virtualenv_fix_name?] = false
18
+ fpm.attributes[:virtualenv_package_name_prefix] = recipe.virtualenv_package_name_prefix unless recipe.virtualenv_package_name_prefix.nil?
19
+ fpm.attributes[:virtualenv_other_files_dir] = recipe.virtualenv_other_files_dir unless recipe.virtualenv_other_files_dir.nil?
17
20
  end
18
21
 
19
22
  def package_input
@@ -131,7 +131,9 @@ module FPM
131
131
  extracted_source = recipe.extracted_source
132
132
  end
133
133
 
134
- recipe.run_lifecycle_hook(:after_source_extraction, recipe.builddir(extracted_source))
134
+ # Make the path to the extracted source available in the recipe.
135
+ recipe.sourcedir = recipe.builddir(extracted_source)
136
+ recipe.run_lifecycle_hook(:after_source_extraction, recipe.sourcedir)
135
137
 
136
138
  Log.info "Using source directory: #{extracted_source}"
137
139
 
@@ -66,7 +66,10 @@ module FPM
66
66
 
67
67
  # We used to use :preserve => true here, but that broke package
68
68
  # building when the file tree contains broken symlinks.
69
- FileUtils.cp_r src, dst
69
+ # :dereference_root => false, results in symlinks being copied instead
70
+ # of dereferencing them first. Copying a symlink that points to a
71
+ # non-existent file is not an error.
72
+ FileUtils.cp_r src, dst, :dereference_root => false
70
73
 
71
74
  # if File.symlink? src
72
75
  # # we use the BSD mv command because FileUtils copies the target and
@@ -14,6 +14,7 @@ require 'fpm/cookery/package/npm'
14
14
  require 'fpm/cookery/package/pear'
15
15
  require 'fpm/cookery/package/python'
16
16
  require 'fpm/cookery/package/virtualenv'
17
+ require 'fpm/cookery/log'
17
18
 
18
19
  module FPM
19
20
  module Cookery
@@ -184,7 +185,11 @@ module FPM
184
185
  self.class.extracted_source
185
186
  end
186
187
 
187
- attr_reader :source_handler
188
+ def sourcedir=(sourcedir)
189
+ @sourcedir = sourcedir
190
+ end
191
+
192
+ attr_reader :source_handler, :sourcedir
188
193
 
189
194
  extend Forwardable
190
195
  def_delegator :@source_handler, :local_path
@@ -223,10 +228,36 @@ module FPM
223
228
  end
224
229
 
225
230
  class VirtualenvRecipe < BaseRecipe
226
- attr_rw :virtualenv_pypi, :virtualenv_install_location, :virtualenv_fix_name
231
+ attr_rw :virtualenv_pypi, :virtualenv_install_location, :virtualenv_fix_name,
232
+ :virtualenv_pypi_extra_index_urls, :virtualenv_package_name_prefix,
233
+ :virtualenv_other_files_dir
227
234
  def input(config)
228
235
  FPM::Cookery::Package::Virtualenv.new(self, config)
229
236
  end
230
237
  end
238
+
239
+ # Helps packaging a directory of content
240
+ class DirRecipe < Recipe
241
+
242
+ def input(config)
243
+ FPM::Cookery::Package::Dir.new(self, config)
244
+ end
245
+
246
+ # Dir Recipes by default build action.
247
+ def build
248
+ end
249
+
250
+ # Default action for a dir recipe install is to copy items selected
251
+ def install
252
+ FileUtils.cp_r File.join(builddir, '.'), destdir
253
+ # Remove build cookies
254
+ %w(build extract).each do |cookie|
255
+ Dir.glob("#{destdir}/.#{cookie}-cookie-*").each do |f|
256
+ Log.info "Deleting FPM Cookie #{f}"
257
+ File.delete(f)
258
+ end
259
+ end
260
+ end
261
+ end
231
262
  end
232
263
  end
@@ -5,6 +5,7 @@ require 'fpm/cookery/source_handler/git'
5
5
  require 'fpm/cookery/source_handler/hg'
6
6
  require 'fpm/cookery/source_handler/local_path'
7
7
  require 'fpm/cookery/source_handler/noop'
8
+ require 'fpm/cookery/source_handler/directory'
8
9
  require 'fpm/cookery/log'
9
10
 
10
11
  module FPM
@@ -0,0 +1,33 @@
1
+ require 'fpm/cookery/source_handler/template'
2
+ require 'fpm/cookery/log'
3
+ require 'fileutils'
4
+
5
+ module FPM
6
+ module Cookery
7
+ class SourceHandler
8
+ class Directory < FPM::Cookery::SourceHandler::Template
9
+ CHECKSUM = false
10
+ NAME = :directory
11
+
12
+ def fetch(config = {})
13
+ path = source.path
14
+ cached_file = File.join(@cachedir, path)
15
+ if File.exist? cached_file
16
+ Log.info "Using cached file #{cached_file}"
17
+ else
18
+ # Exclude source directory
19
+ path = File.join(path,'.')
20
+ Log.info "Copying #{path} to cache"
21
+ FileUtils.cp_r(path, cachedir)
22
+ end
23
+ cachedir
24
+ end
25
+
26
+ def extract(config = {})
27
+ FileUtils.cp_r(File.join(cachedir,'.'), builddir)
28
+ builddir
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -24,9 +24,6 @@ module FPM
24
24
  Dir.chdir(cachedir) do
25
25
  git('clone', url, local_path)
26
26
  end
27
- Dir.chdir(local_path) do
28
- git('submodule', 'update', '--init') if options[:submodule]
29
- end
30
27
  end
31
28
 
32
29
  local_path
@@ -50,6 +47,9 @@ module FPM
50
47
  extracted_source << '-HEAD'
51
48
  end
52
49
 
50
+ # Initialize submodules after sha/tag/branch has been set.
51
+ # See: https://github.com/bernd/fpm-cookery/issues/144
52
+ git('submodule', 'update', '--init') if options[:submodule]
53
53
 
54
54
  case options.fetch(:extract, :default).to_s.to_sym
55
55
  when :clone
@@ -37,6 +37,7 @@ module FPM
37
37
  end
38
38
  }
39
39
  end
40
+ args
40
41
  end
41
42
 
42
43
  def configure(*args)
@@ -1,5 +1,5 @@
1
1
  module FPM
2
2
  module Cookery
3
- VERSION = '0.31.0'
3
+ VERSION = '0.32.0'
4
4
  end
5
5
  end
@@ -280,6 +280,17 @@ describe "Recipe" do
280
280
  end
281
281
  end
282
282
 
283
+ describe ".sourcedir" do
284
+ it "is not set by default" do
285
+ expect(recipe.sourcedir).to be_nil
286
+ end
287
+
288
+ it "can be set" do
289
+ recipe.sourcedir = '/tmp/foo/bar'
290
+ expect(recipe.sourcedir).to eq('/tmp/foo/bar')
291
+ end
292
+ end
293
+
283
294
  describe "#local_path" do
284
295
  it "returns the path to the local source file" do
285
296
  klass.class_eval do
@@ -8,6 +8,18 @@ describe FPM::Cookery::Utils do
8
8
  def run_configure_no_arg
9
9
  configure
10
10
  end
11
+
12
+ def run_configure
13
+ configure '--prefix=/usr', '--test=yo'
14
+ end
15
+
16
+ def run_configure_hash
17
+ configure :hello_world => true, :prefix => '/usr', 'a-dash' => 1
18
+ end
19
+
20
+ def run_configure_mix
21
+ configure '--first=okay', '--second=okay', :hello_world => true, :prefix => '/usr', 'a-dash' => 1
22
+ end
11
23
  end
12
24
 
13
25
  let(:test) { TestUtils.new }
@@ -18,6 +30,27 @@ describe FPM::Cookery::Utils do
18
30
  end
19
31
 
20
32
  describe '#configure' do
33
+ context 'with a list of string arguments' do
34
+ it 'calls ./configure with the correct arguments' do
35
+ expect(test).to receive(:system).with('./configure', '--prefix=/usr', '--test=yo')
36
+ test.run_configure
37
+ end
38
+ end
39
+
40
+ context 'with hash arguments' do
41
+ it 'calls ./configure with the correct arguments' do
42
+ expect(test).to receive(:system).with('./configure', '--hello-world', '--prefix=/usr', '--a-dash=1')
43
+ test.run_configure_hash
44
+ end
45
+ end
46
+
47
+ context 'with string and hash arguments' do
48
+ it 'calls ./configure with the correct arguments' do
49
+ expect(test).to receive(:system).with('./configure', '--first=okay', '--second=okay', '--hello-world', '--prefix=/usr', '--a-dash=1')
50
+ test.run_configure_mix
51
+ end
52
+ end
53
+
21
54
  context 'without any arguments' do
22
55
  it 'calls ./configure without any arguments' do
23
56
  expect(test).to receive(:system).with('./configure')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fpm-cookery
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.31.0
4
+ version: 0.32.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bernd Ahlers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-07 00:00:00.000000000 Z
11
+ date: 2016-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -84,16 +84,16 @@ dependencies:
84
84
  name: addressable
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ">="
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '0'
89
+ version: 2.3.8
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ">="
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '0'
96
+ version: 2.3.8
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: systemu
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -164,6 +164,7 @@ files:
164
164
  - lib/fpm/cookery/source.rb
165
165
  - lib/fpm/cookery/source_handler.rb
166
166
  - lib/fpm/cookery/source_handler/curl.rb
167
+ - lib/fpm/cookery/source_handler/directory.rb
167
168
  - lib/fpm/cookery/source_handler/git.rb
168
169
  - lib/fpm/cookery/source_handler/hg.rb
169
170
  - lib/fpm/cookery/source_handler/local_path.rb
@@ -244,7 +245,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
244
245
  version: '0'
245
246
  requirements: []
246
247
  rubyforge_project: fpm-cookery
247
- rubygems_version: 2.4.5.1
248
+ rubygems_version: 2.5.1
248
249
  signing_key:
249
250
  specification_version: 4
250
251
  summary: A tool for building software packages with fpm.