fpm-cookery 0.36.0 → 0.38.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9d635234a7161b1b47ba35bf07f4a3c58209482d57ead1d2e7d42e59ead4090f
4
- data.tar.gz: 15c95843c18e2b098236b68fa4249fad32387dfae68b92ae734087379179d337
3
+ metadata.gz: 9dd8cf427fc81df78b55732516e91b8c98dcae6af6c465cd790042539098efaf
4
+ data.tar.gz: 67f996dc214f34ff79f35c670dfd082bb8cca472068207dc457025c911668240
5
5
  SHA512:
6
- metadata.gz: b9c9ef894547aa17415134b1de01ba2cf4b594429f4d7a93fe24166bf0a1eed82961d1cdf155f16edb96907f4a9f36bc3517bae12e384c60fbd126daad953753
7
- data.tar.gz: 79b01c1bb917e0ae2ab6e90c64a521d930d8e3d80512345b6df98ca82ce1ece074229eaff0044c39a8a451c79954b2b84966a9d440b827bbd978f771ae548c70
6
+ metadata.gz: d6df5723d6457029da89f9d5a64ccf73e46804171a94e474e48a9447442628c2141ccf63db3672b56d27b2c29308e95e70071744745f94d9c30f5773da8e123d
7
+ data.tar.gz: 31a87981c9f66d194a57595a71eaf1745ea4959a0cfdfd2789ce5c10613c5d7bdaafffb37b297799e05647f8065d5417f2bd81f6427994e14852d394d5b41c02
@@ -1,24 +1,38 @@
1
1
  name: Ruby
2
2
 
3
- on: [push]
3
+ on:
4
+ pull_request:
5
+ types: [ opened, reopened, synchronize, edited ]
6
+ push:
7
+ branches: [ main ]
4
8
 
5
9
  jobs:
6
10
  build:
11
+ name: "Ruby ${{ matrix.ruby }}"
7
12
 
8
13
  runs-on: ubuntu-latest
9
14
  strategy:
10
15
  matrix:
11
- ruby: ["2.4", "2.5", "2.6", "2.7", "3.0", "3.1"]
16
+ ruby: ["2.7", "3.0", "3.1", "3.2", "3.3", "3.4"]
12
17
 
13
18
  steps:
14
- - uses: actions/checkout@v1
19
+ - uses: actions/checkout@v4
20
+
15
21
  - name: Set up Ruby ${{ matrix.ruby }}
16
22
  uses: ruby/setup-ruby@v1
17
23
  with:
18
24
  ruby-version: ${{ matrix.ruby }}
19
25
  bundler-cache: true
26
+
20
27
  - name: Build and test with Rake
21
28
  run: |
22
- gem install bundler
29
+ sudo apt-get update -qq
30
+ sudo apt-get install -yqq python3-sphinx
31
+ if [ "${{ matrix.ruby }}" = "2.7" ]; then
32
+ # Last supported bundler version for Ruby 2.7
33
+ gem install bundler -v 2.4.22
34
+ else
35
+ gem install bundler
36
+ fi
23
37
  bundle install --jobs 4 --retry 3
24
38
  bundle exec rake
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ # v0.38.0 (2025-07-07)
2
+ * Fix compatibility with Ruby 3.2. (aalmenar / #221)
3
+ * Fix compatibility with Ruby 3.4. (#222)
4
+
5
+ # v0.37.0 (2023-04-04)
6
+ * Add `osfamily` fact and choose package target based on it. (FooBarQuaxx / #216)
7
+ * Install Sphinx toolchain for GitHub Action workflow. (FooBarQuaxx / #217)
8
+ * Add support for Ruby 3.2. (FooBarQuaxx / #218, bernd / #219)
9
+
1
10
  # v0.36.0 (2022-07-13)
2
11
  * Add Dockerfile for Ubuntu 18.04.
3
12
  * Allow newer versions of Puppet (gmathes / #211)
data/Rakefile CHANGED
@@ -6,6 +6,25 @@ RSpec::Core::RakeTask.new(:spec)
6
6
 
7
7
  task :default => :spec
8
8
 
9
+ namespace 'test:ruby' do |ns|
10
+ src = File.dirname(File.expand_path(__FILE__))
11
+
12
+ %w(3.4 3.3 3.2 3.1 3.0 2.7).each do |version|
13
+ task version do
14
+ sh %(
15
+ docker run -i --rm -v #{src}:/src ruby:#{version}
16
+ bash -c '
17
+ git config --global --add safe.directory /src/.git
18
+ && git clone -s /src /work
19
+ && cd /work
20
+ && bundle install -j 4
21
+ && bundle exec rake
22
+ '
23
+ ).gsub(/\s+/, ' ').strip
24
+ end
25
+ end
26
+ end
27
+
9
28
  namespace :docs do |ns|
10
29
  require 'systemu'
11
30
 
data/fpm-cookery.gemspec CHANGED
@@ -31,4 +31,5 @@ Gem::Specification.new do |s|
31
31
  s.add_runtime_dependency "json_pure", "~> 2.6"
32
32
  s.add_runtime_dependency "safe_yaml", "~> 1.0.4"
33
33
  s.add_runtime_dependency "uri-ssh_git", "~> 2.0"
34
+ s.add_runtime_dependency "base64", "~> 0.3.0"
34
35
  end
@@ -20,7 +20,7 @@ module FPM
20
20
  DependencyInspector.verify!([], recipe.build_depends)
21
21
  recipe.chain_recipes.each do |name|
22
22
  recipe_file = build_recipe_file_path(name)
23
- unless File.exists?(recipe_file)
23
+ unless File.exist?(recipe_file)
24
24
  error_message = "Cannot find a recipe for #{name} at #{recipe_file}"
25
25
  Log.fatal error_message
26
26
  raise Error::ExecutionFailure, error_message
@@ -49,7 +49,7 @@ module FPM
49
49
  recipe.chain_recipes.each do |name|
50
50
  recipe_file = build_recipe_file_path(name)
51
51
 
52
- unless File.exists?(recipe_file)
52
+ unless File.exist?(recipe_file)
53
53
  Log.fatal "Cannot find a recipe for #{name} at #{recipe_file}"
54
54
  exit 1
55
55
  end
@@ -60,7 +60,7 @@ module FPM
60
60
  file = File.expand_path(recipe)
61
61
 
62
62
  # Allow giving the directory containing a recipe.rb
63
- if File.directory?(file) && File.exists?(File.join(file, 'recipe.rb'))
63
+ if File.directory?(file) && File.exist?(File.join(file, 'recipe.rb'))
64
64
  file = File.join(file, 'recipe.rb')
65
65
  end
66
66
 
@@ -68,7 +68,7 @@ module FPM
68
68
  end
69
69
 
70
70
  def validate
71
- unless File.exists?(recipe_file)
71
+ unless File.exist?(recipe_file)
72
72
  Log.error 'No recipe.rb found in the current directory, abort.'
73
73
  exit 1
74
74
  end
@@ -28,13 +28,20 @@ module FPM
28
28
  @osmajorrelease ||= value(:operatingsystemmajrelease, false)
29
29
  end
30
30
 
31
+ def osfamily
32
+ @osfamily ||= value(:osfamily)
33
+ end
34
+
35
+ def osfamily=(value)
36
+ @osfamily = value.downcase.to_sym
37
+ end
38
+
31
39
  def target
32
- @target ||= case platform
33
- when :centos, :redhat, :fedora, :amazon,
34
- :scientific, :oraclelinux, :sles then :rpm
35
- when :debian, :ubuntu then :deb
36
- when :darwin then :osxpkg
37
- when :alpine then :apk
40
+ @target ||= case osfamily
41
+ when :redhat, :suse then :rpm
42
+ when :debian then :deb
43
+ when :darwin then :osxpkg
44
+ when :alpine then :apk
38
45
  end
39
46
  end
40
47
 
@@ -27,9 +27,6 @@ module FPM
27
27
  # Provides a default scope, and attempts to look up the key both as a
28
28
  # string and as a symbol.
29
29
  def lookup(key, default = nil, scope = self.scope, *rest)
30
-
31
- (Gem::Version.new(::Hiera.version) < Gem::Version.new('2.0.0') &&
32
- super(key.to_sym, default, scope, *rest)) ||
33
30
  super(key.to_s, default, scope, *rest)
34
31
  end
35
32
  alias_method :[], :lookup
@@ -21,7 +21,7 @@ module FPM
21
21
  _recipe.omnibus_recipes.each do |name|
22
22
  recipe_file = build_recipe_file_path(name)
23
23
  Log.info "Loading dependency recipe #{name} from #{recipe_file}"
24
- unless File.exists?(recipe_file)
24
+ unless File.exist?(recipe_file)
25
25
  error_message = "Cannot find a recipe for #{name} at #{recipe_file}"
26
26
  Log.fatal error_message
27
27
  raise Error::ExecutionFailure, error_message
@@ -119,7 +119,7 @@ module FPM
119
119
 
120
120
  # Do not extract source again because it might destroy changes
121
121
  # that have been made to the source. (like patches)
122
- if File.exists?(extract_cookie)
122
+ if File.exist?(extract_cookie)
123
123
  extracted_source = File.read(extract_cookie).chomp
124
124
  Log.debug "Extract cookie exists, using existing source directory: #{extracted_source}"
125
125
  else
@@ -149,7 +149,7 @@ module FPM
149
149
 
150
150
  build_cookie = build_cookie_name(package_name)
151
151
 
152
- if File.exists?(build_cookie)
152
+ if File.exist?(build_cookie)
153
153
  Log.warn "Skipping build of #{recipe.name} because build cookie found (#{build_cookie})," \
154
154
  " use \"fpm-cook clean\" to rebuild!"
155
155
  else
@@ -161,7 +161,7 @@ module FPM
161
161
  end
162
162
 
163
163
  FileUtils.rm_rf(recipe.destdir) unless keep_destdir?
164
- recipe.destdir.mkdir unless File.exists?(recipe.destdir)
164
+ recipe.destdir.mkdir unless File.exist?(recipe.destdir)
165
165
 
166
166
  begin
167
167
  recipe.installing = true
@@ -243,7 +243,7 @@ module FPM
243
243
  script_file = File.expand_path("../#{script_file.to_s}", recipe.filename)
244
244
  end
245
245
 
246
- if File.exists?(script_file)
246
+ if File.exist?(script_file)
247
247
  input.add_script(script, File.read(script_file.to_s))
248
248
  else
249
249
  Log.error "#{script} script '#{script_file}' is missing"
@@ -86,7 +86,7 @@ module FPM
86
86
  alias_method :inreplace, :inline_replace # homebrew compat
87
87
 
88
88
  def patch(src, level = 0)
89
- raise "patch level must be integer" unless level.is_a?(Fixnum)
89
+ raise "patch level must be integer" unless level.is_a?(::Integer)
90
90
  raise "#{src} does not exist" unless File.exist? src
91
91
 
92
92
  if "#{src}".end_with?('.gz')
@@ -1,5 +1,5 @@
1
1
  module FPM
2
2
  module Cookery
3
- VERSION = '0.36.0'
3
+ VERSION = '0.38.0'
4
4
  end
5
5
  end
data/spec/facts_spec.rb CHANGED
@@ -69,81 +69,59 @@ describe "Facts" do
69
69
  end
70
70
  end
71
71
 
72
- describe "target" do
73
-
74
- describe "with platform Scientific" do
75
- it "returns rpm" do
76
- FPM::Cookery::Facts.platform = 'Scientific'
77
- expect(FPM::Cookery::Facts.target).to eq(:rpm)
78
- end
79
- end
72
+ describe "osfamily" do
73
+ include_context "mock facts", { :osfamily => 'RedHat' }
80
74
 
81
- describe "with platform CentOS" do
82
- it "returns rpm" do
83
- FPM::Cookery::Facts.platform = 'CentOS'
84
- expect(FPM::Cookery::Facts.target).to eq(:rpm)
85
- end
75
+ it "is using Facter to autodetect the osfamily" do
76
+ expect(FPM::Cookery::Facts.osfamily).to eq(:redhat)
86
77
  end
87
78
 
88
- describe "with platform RedHat" do
89
- it "returns rpm" do
90
- FPM::Cookery::Facts.platform = 'RedHat'
91
- expect(FPM::Cookery::Facts.target).to eq(:rpm)
92
- end
79
+ it "can be set" do
80
+ FPM::Cookery::Facts.platform = 'RedHat'
81
+ expect(FPM::Cookery::Facts.osfamily).to eq(:redhat)
93
82
  end
83
+ end
94
84
 
95
- describe "with platform Fedora" do
96
- it "returns rpm" do
97
- FPM::Cookery::Facts.platform = 'Fedora'
98
- expect(FPM::Cookery::Facts.target).to eq(:rpm)
99
- end
100
- end
85
+ describe "target" do
101
86
 
102
- describe "with platform Amazon" do
87
+ describe "with os family RedHat" do
103
88
  it "returns rpm" do
104
- FPM::Cookery::Facts.platform = 'Amazon'
89
+ FPM::Cookery::Facts.osfamily = 'RedHat'
105
90
  expect(FPM::Cookery::Facts.target).to eq(:rpm)
106
91
  end
107
92
  end
108
93
 
109
- describe "with platform OracleLinux" do
94
+ describe "with os family Suse" do
110
95
  it "returns rpm" do
111
- FPM::Cookery::Facts.platform = 'OracleLinux'
96
+ FPM::Cookery::Facts.osfamily = 'Suse'
112
97
  expect(FPM::Cookery::Facts.target).to eq(:rpm)
113
98
  end
114
99
  end
115
100
 
116
- describe "with platform Debian" do
117
- it "returns deb" do
118
- FPM::Cookery::Facts.platform = 'Debian'
119
- expect(FPM::Cookery::Facts.target).to eq(:deb)
120
- end
121
- end
122
-
123
- describe "with platform Ubuntu" do
101
+ describe "with os family Debian" do
124
102
  it "returns deb" do
125
- FPM::Cookery::Facts.platform = 'Ubuntu'
103
+ FPM::Cookery::Facts.osfamily = 'Debian'
126
104
  expect(FPM::Cookery::Facts.target).to eq(:deb)
127
105
  end
128
106
  end
129
107
 
130
- describe "with platform Darwin" do
108
+ describe "with os family Darwin" do
131
109
  it "returns osxpkg" do
132
- FPM::Cookery::Facts.platform = 'Darwin'
110
+ FPM::Cookery::Facts.osfamily = 'Darwin'
133
111
  expect(FPM::Cookery::Facts.target).to eq(:osxpkg)
134
112
  end
135
113
  end
136
114
 
137
- describe "with platform Alpine" do
115
+ describe "with os family Alpine" do
138
116
  it "returns apk" do
139
- FPM::Cookery::Facts.platform = 'Alpine'
117
+ FPM::Cookery::Facts.osfamily = 'Alpine'
140
118
  expect(FPM::Cookery::Facts.target).to eq(:apk)
141
119
  end
142
120
  end
143
121
 
144
- describe "with an unknown platform" do
122
+ describe "with an unknown os family" do
145
123
  it "returns nil" do
146
- FPM::Cookery::Facts.platform = '___X___'
124
+ FPM::Cookery::Facts.osfamily = '___X___'
147
125
  expect(FPM::Cookery::Facts.target).to eq(nil)
148
126
  end
149
127
  end
data/spec/path_spec.rb CHANGED
@@ -91,10 +91,10 @@ describe "Path" do
91
91
  it "creates the directory" do
92
92
  dir = Dir.mktmpdir
93
93
  FileUtils.rm_rf(dir)
94
- expect(File.exists?(dir)).to eq(false)
94
+ expect(File.exist?(dir)).to eq(false)
95
95
 
96
96
  FPM::Cookery::Path.new(dir).mkdir
97
- expect(File.exists?(dir)).to eq(true)
97
+ expect(File.exist?(dir)).to eq(true)
98
98
 
99
99
  FileUtils.rm_rf(dir)
100
100
  end
@@ -102,7 +102,7 @@ describe "Path" do
102
102
  describe "directory exists" do
103
103
  it "does not throw an error" do
104
104
  dir = Dir.mktmpdir
105
- expect(File.exists?(dir)).to eq(true)
105
+ expect(File.exist?(dir)).to eq(true)
106
106
 
107
107
  expect(FPM::Cookery::Path.new(dir).mkdir).to eq([dir])
108
108
 
data/spec/utils_spec.rb CHANGED
@@ -28,6 +28,14 @@ describe FPM::Cookery::Utils do
28
28
  def run_go_build_hash
29
29
  go :build, :mod => 'vendor', :v => true
30
30
  end
31
+
32
+ def run_patch_level
33
+ patch 'file.patch', 'one'
34
+ end
35
+
36
+ def run_patch_missing
37
+ patch 'missing.patch'
38
+ end
31
39
  end
32
40
 
33
41
  let(:test) { TestUtils.new }
@@ -81,4 +89,14 @@ describe FPM::Cookery::Utils do
81
89
  end
82
90
  end
83
91
  end
92
+ describe '#patch' do
93
+ it 'raises error if level is not an integer' do
94
+ expect { test.run_patch_level }.to raise_error("patch level must be integer")
95
+ end
96
+
97
+ it 'raises error if file does not exist' do
98
+ allow(File).to receive(:exist?).and_return(false)
99
+ expect { test.run_patch_missing }.to raise_error("missing.patch does not exist")
100
+ end
101
+ end
84
102
  end
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.36.0
4
+ version: 0.38.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bernd Ahlers
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-13 00:00:00.000000000 Z
11
+ date: 2025-07-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -198,6 +198,20 @@ dependencies:
198
198
  - - "~>"
199
199
  - !ruby/object:Gem::Version
200
200
  version: '2.0'
201
+ - !ruby/object:Gem::Dependency
202
+ name: base64
203
+ requirement: !ruby/object:Gem::Requirement
204
+ requirements:
205
+ - - "~>"
206
+ - !ruby/object:Gem::Version
207
+ version: 0.3.0
208
+ type: :runtime
209
+ prerelease: false
210
+ version_requirements: !ruby/object:Gem::Requirement
211
+ requirements:
212
+ - - "~>"
213
+ - !ruby/object:Gem::Version
214
+ version: 0.3.0
201
215
  description: A tool for building software packages with fpm.
202
216
  email:
203
217
  - bernd@tuneafish.de
@@ -347,7 +361,7 @@ files:
347
361
  homepage: ''
348
362
  licenses: []
349
363
  metadata: {}
350
- post_install_message:
364
+ post_install_message:
351
365
  rdoc_options: []
352
366
  require_paths:
353
367
  - lib
@@ -362,8 +376,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
362
376
  - !ruby/object:Gem::Version
363
377
  version: '0'
364
378
  requirements: []
365
- rubygems_version: 3.3.5
366
- signing_key:
379
+ rubygems_version: 3.4.20
380
+ signing_key:
367
381
  specification_version: 4
368
382
  summary: A tool for building software packages with fpm.
369
383
  test_files: []