vanagon 0.39.2 → 0.40.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
  SHA256:
3
- metadata.gz: 0bbab09cfcd3f8a91841bb070ac6fbdd57b37ba5833e4992f3c2251df12c825a
4
- data.tar.gz: 1a14dea7853f5e623ae1d8fbccf35f63d5fb63c2ab6b9c013ce50bc37a2ba791
3
+ metadata.gz: 49e90bdaa700172f444cb3849dfbaa7d422c4912f081eb45a3466a45857b23d6
4
+ data.tar.gz: b88bbbadd07826f06f05d0ae766048af7e3bba74a859bc029c35bedcda6d710e
5
5
  SHA512:
6
- metadata.gz: f167828ef7a0012965b349b670fa4c3b3712bdb6065ae0ced63acca1ec8b909b850ada729cf4151271c62781f4576e088b8f5289de12e94f3748c64f311fdb4a
7
- data.tar.gz: 4ab66f44f2b4fabd72ab2fa42c00bd4f3756b4dc9681c1ba05d2715fdacf82092327f297986f3fe872cdf3e306195d1fa3ee66b1ba9e2c8cf575e61b8b5386ae
6
+ metadata.gz: 188b11f3ca921713dba0f9c790b5bec8039dd3d2fe79488a76f4cb065ac616cc98ea3af03a5d7c78d29070d5bea547d8dc977beeaddfccf988f3dc738cbd18a2
7
+ data.tar.gz: e7d53de5ec39fbc9975e610f987511dbcf652ece373d7d2ed72c6965f5c358c734410f2992de2918bd38d5402fccdb9a753ada37a05c205fb0eee1143d340664
@@ -503,6 +503,16 @@ class Vanagon
503
503
  @component.activate_triggers << OpenStruct.new(:activate_name => activate_name)
504
504
  end
505
505
 
506
+ # Add post installation action that must exit successfully before restarting the service
507
+ #
508
+ # @param pkg_state [Array] the state in which the scripts should execute. Can be
509
+ # one or multiple of 'install' and 'upgrade'.
510
+ # @param scripts [Array] the Bourne shell compatible scriptlet(s) to execute
511
+ def add_postinstall_required_action(pkg_state, scripts)
512
+ check_pkg_state_array(pkg_state)
513
+ @component.postinstall_required_actions << OpenStruct.new(:pkg_state => Array(pkg_state), :scripts => Array(scripts))
514
+ end
515
+
506
516
  # Adds action to run during the postinstall phase of packaging
507
517
  #
508
518
  # @param pkg_state [Array] the state in which the scripts should execute. Can be
@@ -106,6 +106,9 @@ class Vanagon
106
106
  # activate_triggers is a one-dimentional Array of Strings, describing scripts that
107
107
  # should be executed when a package identifies an activate trigger
108
108
  attr_accessor :activate_triggers
109
+ # postinstall_required_actions is a two-dimensional Array, describing scripts that
110
+ # must be executed successfully after a given component is installed.
111
+ attr_accessor :postinstall_required_actions
109
112
  # postinstall_actions is a two-dimensional Array, describing scripts that
110
113
  # should be executed after a given component is installed.
111
114
  attr_accessor :postinstall_actions
@@ -176,6 +179,7 @@ class Vanagon
176
179
  @install_triggers = []
177
180
  @interest_triggers = []
178
181
  @activate_triggers = []
182
+ @postinstall_required_actions = []
179
183
  @postinstall_actions = []
180
184
  @preremove_actions = []
181
185
  @postremove_actions = []
@@ -0,0 +1,11 @@
1
+ platform "debian-11-aarch64" do |plat|
2
+ plat.servicedir "/lib/systemd/system"
3
+ plat.defaultdir "/etc/default"
4
+ plat.servicetype "systemd"
5
+ plat.codename "bullseye"
6
+
7
+ packages = %w(build-essential devscripts make quilt pkg-config debhelper rsync fakeroot cmake)
8
+ plat.provision_with "export DEBIAN_FRONTEND=noninteractive; apt-get update -qq; apt-get install -qy --no-install-recommends #{packages.join(' ')}"
9
+ plat.install_build_dependencies_with "DEBIAN_FRONTEND=noninteractive; apt-get install -qy --no-install-recommends "
10
+ plat.vmpooler_template "debian-11-arm64"
11
+ end
@@ -494,6 +494,18 @@ class Vanagon
494
494
  end
495
495
  end
496
496
 
497
+ # Collects the postinstall packaging actions that must exit successfully for the project and it's components
498
+ # for the specified packaging state
499
+ #
500
+ # @param pkg_state [String] the package state we want to run the given scripts for.
501
+ # Can be one of 'install' or 'upgrade'
502
+ # @return [String] string of Bourne shell compatible scriptlets to execute during the postinstall
503
+ # phase of packaging during the state of the system defined by pkg_state (either install or upgrade)
504
+ def get_postinstall_required_actions(pkg_state)
505
+ scripts = components.flat_map(&:postinstall_required_actions).compact.select { |s| s.pkg_state.include? pkg_state }.map(&:scripts)
506
+ return ': no postinstall required scripts provided' if scripts.empty?
507
+ scripts.join("\n")
508
+ end
497
509
  # Collects the preremove packaging actions for the project and it's components
498
510
  # for the specified packaging state
499
511
  #
@@ -850,7 +862,7 @@ class Vanagon
850
862
  source.file
851
863
  end
852
864
 
853
- @settings.merge!(yaml_safe_load_shim(yaml_path))
865
+ @settings.merge!(YAML.safe_load(File.read(yaml_path), permitted_classes: [Symbol]))
854
866
  end
855
867
  end
856
868
 
@@ -876,19 +888,6 @@ class Vanagon
876
888
  source_type
877
889
  end
878
890
 
879
- # YAML.safe_load introduced an incompatible change in Ruby 3.1.0
880
- # Shim that until no longer relevant.
881
- def yaml_safe_load_shim(yaml_path)
882
- new_safe_load_version = Gem::Version.new('3.1.0')
883
- this_version = Gem::Version.new(RUBY_VERSION)
884
-
885
- if this_version >= new_safe_load_version
886
- YAML.safe_load(File.read(yaml_path), permitted_classes: [Symbol])
887
- else
888
- YAML.safe_load(File.read(yaml_path), [Symbol])
889
- end
890
- end
891
-
892
891
  def load_upstream_metadata(metadata_uri)
893
892
  VanagonLogger.info "Loading metadata from #{metadata_uri}"
894
893
  case metadata_uri
@@ -242,6 +242,17 @@ fi
242
242
 
243
243
 
244
244
  %post
245
+ # Run required postinstall scripts on install if defined
246
+ if [ -e %{_localstatedir}/lib/rpm-state/%{name}/install ] ; then
247
+ <%= get_postinstall_required_actions("install") %>
248
+ rm %{_localstatedir}/lib/rpm-state/%{name}/install
249
+ fi
250
+
251
+ # Run required postinstall scripts on upgrade if defined
252
+ if [ -e %{_localstatedir}/lib/rpm-state/%{name}/upgrade ] ; then
253
+ <%= get_postinstall_required_actions("upgrade") %>
254
+ rm %{_localstatedir}/lib/rpm-state/%{name}/upgrade
255
+ fi
245
256
  <%- if @platform.is_aix? || (@platform.is_el? && @platform.os_version.to_i == 4) -%>
246
257
  ## EL-4 and AIX RPM don't have %posttrans, so we'll put them here
247
258
  # Run postinstall scripts on install if defined
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vanagon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.39.2
4
+ version: 0.40.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet By Perforce
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-29 00:00:00.000000000 Z
11
+ date: 2023-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: docopt
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: psych
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '4.0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '4.0'
83
97
  description: |2
84
98
  Vanagon takes a set of project, component, and platform configuration files, to perform
85
99
  multiplatform builds that are packaged into rpms, debs, dmgs, etc.
@@ -157,6 +171,7 @@ files:
157
171
  - lib/vanagon/platform.rb
158
172
  - lib/vanagon/platform/deb.rb
159
173
  - lib/vanagon/platform/defaults/debian-10-amd64.rb
174
+ - lib/vanagon/platform/defaults/debian-11-aarch64.rb
160
175
  - lib/vanagon/platform/defaults/debian-11-amd64.rb
161
176
  - lib/vanagon/platform/defaults/debian-8-amd64.rb
162
177
  - lib/vanagon/platform/defaults/debian-8-i386.rb