Skip to content

Commit 8322aff

Browse files
authored
Merge pull request #72 from OpenVoxProject/nmburgan/changelog
Add tasks for generating component info and adding to changelog
2 parents 40b8fd3 + caf8db1 commit 8322aff

File tree

9 files changed

+66096
-184
lines changed

9 files changed

+66096
-184
lines changed

component_info.json

Lines changed: 65887 additions & 0 deletions
Large diffs are not rendered by default.

configs/components/augeas.rb

Lines changed: 24 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -2,57 +2,38 @@
22
# Component release information: https://github.com/hercules-team/augeas/releases
33
#####
44
component 'augeas' do |pkg, settings, platform|
5-
version = settings[:augeas_version] || '1.14.1'
6-
pkg.version version
5+
# Solaris and AIX depend on libedit which breaks augeas compliation starting with 1.13.0.
6+
# Figure out a solution if we ever need to update augeas on those platforms.
7+
pkg.version '1.14.1'
8+
pkg.md5sum 'ac31216268b4b64809afd3a25f2515e5'
9+
pkg.url "https://github.com/hercules-team/augeas/releases/download/release-#{pkg.get_version}/augeas-#{pkg.get_version}.tar.gz"
710

8-
case version
9-
when '1.14.1'
10-
pkg.md5sum 'ac31216268b4b64809afd3a25f2515e5'
11+
pkg.apply_patch 'resources/patches/augeas/augeas-1.14.1-return_reg_enosys.patch'
1112

12-
pkg.apply_patch 'resources/patches/augeas/augeas-1.14.1-return_reg_enosys.patch'
13-
when '1.12.0'
14-
pkg.md5sum '74f1c7b8550f4e728486091f6b907175'
15-
16-
pkg.apply_patch 'resources/patches/augeas/augeas-1.12.0-allow-ad-groups-in-sudoers.patch'
17-
pkg.apply_patch 'resources/patches/augeas/augeas-1.12.0-allow-hyphen-postgresql-lens.patch'
18-
else
19-
raise "augeas version #{version} has not been configured; Cannot continue."
20-
end
21-
22-
# releases from 1.13.0 onward are only available from github
23-
if Gem::Version.new(pkg.get_version) < Gem::Version.new('1.13.0')
24-
# this url may be removed once 1.12.0 is no longer supported
25-
pkg.url "http://download.augeas.net/augeas-#{pkg.get_version}.tar.gz"
26-
else
27-
pkg.url "https://github.com/hercules-team/augeas/releases/download/release-#{pkg.get_version}/augeas-#{pkg.get_version}.tar.gz"
13+
if platform.is_el? || platform.is_fedora?
14+
# Augeas 1.11.0+ needs a libselinux pkgconfig file on these platforms:
15+
pkg.build_requires 'ruby-selinux'
2816
end
2917

30-
if ['1.12.0', '1.14.1'].include?(version)
31-
if platform.is_el? || platform.is_fedora?
32-
# Augeas 1.11.0 needs a libselinux pkgconfig file on these platforms:
33-
pkg.build_requires 'ruby-selinux'
34-
end
35-
36-
if platform.name =~ /solaris-10-sparc/
37-
# This patch to gnulib fixes a linking error around symbol versioning in pthread.
38-
pkg.add_source "file://resources/patches/augeas/augeas-#{version}-gnulib-pthread-in-use.patch"
39-
pkg.configure do
40-
# gnulib is a submodule, and its files don't exist until after configure,
41-
# so we apply the patch manually here instead of using pkg.apply_patch.
42-
["/usr/bin/gpatch -p0 < ../augeas-#{version}-gnulib-pthread-in-use.patch"]
43-
end
44-
end
45-
46-
if platform.is_macos?
47-
pkg.build_requires 'readline'
48-
pkg.build_requires 'autoconf'
49-
pkg.build_requires 'automake'
50-
pkg.build_requires 'libtool'
18+
if platform.name =~ /solaris-10-sparc/
19+
# This patch to gnulib fixes a linking error around symbol versioning in pthread.
20+
pkg.add_source "file://resources/patches/augeas/augeas-#{version}-gnulib-pthread-in-use.patch"
21+
pkg.configure do
22+
# gnulib is a submodule, and its files don't exist until after configure,
23+
# so we apply the patch manually here instead of using pkg.apply_patch.
24+
["/usr/bin/gpatch -p0 < ../augeas-#{version}-gnulib-pthread-in-use.patch"]
5125
end
26+
end
5227

53-
extra_config_flags = platform.name =~ /solaris-11|aix/ ? ' --disable-dependency-tracking' : ''
28+
if platform.is_macos?
29+
pkg.build_requires 'readline'
30+
pkg.build_requires 'autoconf'
31+
pkg.build_requires 'automake'
32+
pkg.build_requires 'libtool'
5433
end
5534

35+
extra_config_flags = platform.name =~ /solaris-11|aix/ ? ' --disable-dependency-tracking' : ''
36+
5637
pkg.mirror "#{settings[:buildsources_url]}/augeas-#{pkg.get_version}.tar.gz"
5738

5839
pkg.build_requires 'libxml2'

configs/projects/agent-runtime-main.rb

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,6 @@
33
proj.setting :ruby_version, '3.2' # Leave the .Z out for Ruby 3.2
44
proj.setting :rubygem_highline_version, '3.0.1'
55

6-
# Solaris and AIX depend on libedit which breaks augeas compliation starting with 1.13.0
7-
if platform.is_solaris?
8-
proj.setting :augeas_version, '1.12.0'
9-
else
10-
proj.setting :augeas_version, '1.14.1'
11-
end
12-
136
########
147
# Load shared agent settings
158
########

configs/projects/openbolt-runtime.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
proj.setting(:openssl_version, '3.0')
66
# Legacy algos must be enabled in OpenSSL >= 3.0 for OpenBolt's WinRM transport to work.
77
proj.setting(:use_legacy_openssl_algos, true)
8-
proj.setting(:augeas_version, '1.14.1')
98

109
platform = proj.get_platform
1110

resources/patches/augeas/augeas-1.12.0-allow-ad-groups-in-sudoers.patch

Lines changed: 0 additions & 26 deletions
This file was deleted.

resources/patches/augeas/augeas-1.12.0-allow-hyphen-postgresql-lens.patch

Lines changed: 0 additions & 70 deletions
This file was deleted.

resources/patches/augeas/augeas-1.12.0-gnulib-pthread-in-use.patch

Lines changed: 0 additions & 25 deletions
This file was deleted.

tasks/update_component_info.rake

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
require 'json'
2+
3+
FIRST_TAG = '202501080'.freeze # First tag to include when regenerating
4+
IGNORED_PLATFORMS = %w[aix solaris redhatfips windowsfips el-6 osx sles-11 windows-2012r2 ppc64le armhf i386].freeze
5+
INCLUDED_PROJECTS = %w[agent-runtime openbolt-runtime].freeze
6+
7+
def platforms
8+
# First item will be a `- Platforms` header. Also exclude
9+
# any platforms we don't actually build for or have problems parsing.
10+
`bundle exec vanagon list -l`.split("\n")[1..]
11+
.reject { |p| p =~ /(#{IGNORED_PLATFORMS.join('|')})/ }
12+
end
13+
14+
def projects
15+
# First item will be a `- Projects` header. Also exclude
16+
# any projects prefixed with '_' as these are not real projects and
17+
# are shared between projects. Also ignore any projects we don't care
18+
# about.
19+
`bundle exec vanagon list -r`.split("\n")[1..]
20+
.reject { |p| p.start_with?('_') || p !~ /^(#{INCLUDED_PROJECTS.join('|')})/ }
21+
end
22+
23+
# Sometimes the version is a git ref so extract
24+
# actual version numbers. Fall back to 0 if nothing
25+
# usable is found so everything is comparable.
26+
def parse_version(ver)
27+
Gem::Version.new(ver.to_s[/\d+(?:\.\d+)+/] || 0)
28+
end
29+
30+
def component_info
31+
# Build component list with version/ref for each project
32+
puts `pwd`
33+
project_data = {}
34+
projects.each do |project|
35+
puts "Processing project #{project}"
36+
project_data[project] = {}
37+
38+
platforms.each do |platform|
39+
puts " #{platform}"
40+
platform_data = JSON.parse(`bundle exec vanagon inspect #{project} #{platform}`)
41+
project_data[project][platform] = platform_data.map { |h| [h['name'], h['version'] || h.dig('options', 'ref')] }.to_h
42+
end
43+
end
44+
45+
component_data = project_data.values
46+
.flat_map(&:values).flatten # [{comp1 => ver1}, {comp2 => ver2}, ...]
47+
.flat_map(&:to_a) # [[comp1, ver1], [comp2, ver2], ...]
48+
.group_by(&:first) # { comp1 => [[comp1, ver1], [comp1, ver2], ...], ... }
49+
.transform_values do |pairs| # { comp1 => verN, ... }
50+
pairs.max_by { |_, ver| parse_version(ver) }.last
51+
end
52+
53+
{ 'components' => component_data, 'projects' => project_data }
54+
end
55+
56+
# We use `vanagon inspect` to get components instead of parsing the
57+
# files directly, so that we can populate a list of components per
58+
# platform, as they can differ between platforms.
59+
namespace :vox do
60+
desc 'Update component_info.json file with current component versions'
61+
task :update_component_info, [:tag] do |_, args|
62+
abort 'You must provide the tag that will be used for this release.' if args[:tag].nil? || args[:tag].empty?
63+
64+
File.write('component_info.json', '{}') unless File.exist?('component_info.json')
65+
data = JSON.parse(File.read('component_info.json'))
66+
67+
data[args[:tag]] = component_info
68+
69+
# Put the new data on top
70+
data = data.to_a.rotate(-1).to_h
71+
72+
File.write('component_info.json', JSON.pretty_generate(data))
73+
puts "Updated component_info.json with data for tag #{args[:tag]}"
74+
end
75+
76+
desc 'Regenerate component_info.json with all tags'
77+
task :regenerate_component_info do
78+
# Clone a copy of the repo to avoid messing up the current working dir
79+
`git clone https://github.com/openvoxproject/puppet-runtime puppet-runtime-tmp`
80+
begin
81+
all_data = {}
82+
Dir.chdir('puppet-runtime-tmp') do
83+
`git fetch origin --tags --prune --prune-tags`
84+
`git tag --sort=creatordate | awk '$0=="#{FIRST_TAG}"{seen=1; next} seen'`.split("\n").each do |tag|
85+
puts "Checking out tag #{tag}..."
86+
`git checkout #{tag}`
87+
Bundler.with_unbundled_env do
88+
`BUNDLER_GEMFILE=./Gemfile bundle install --path .bundle`
89+
all_data[tag] = component_info
90+
end
91+
end
92+
end
93+
# Reverse order to latest is on top
94+
all_data = all_data.to_a.reverse.to_h
95+
File.write('component_info.json', JSON.pretty_generate(all_data))
96+
puts 'Regenerated component_info.json with data for all tags.'
97+
ensure
98+
FileUtils.rm_rf('puppet-runtime-tmp')
99+
end
100+
end
101+
end

0 commit comments

Comments
 (0)