Skip to content

Commit

Permalink
(SIMP-3837) simp-rake-helpers: Fix for simp-doc RPM build (#93)
Browse files Browse the repository at this point in the history
- Determine the build/rpm_metadata/* files when the pkg:rpm
  rake task is called, not when the rake object is constructed.

SIMP-3837 #comment simp-rake-helpers fix
  • Loading branch information
lnemsick-simp authored and Nick Markowski committed Oct 4, 2017
1 parent bad04bf commit a929a53
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 11 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
### 5.0.2 / 2017-10-03
* Determine the build/rpm_metadata/* files when the pkg:rpm
rake task is called, not when the rake object is constructed.
This is required for simp-doc RPM building.

### 5.0.1 / 2017-09-28
* Removed rpmkeys and rpmspec from the required list of commands,
as they are not present in CentOS 6 and are automatically
Expand Down
7 changes: 7 additions & 0 deletions lib/simp/rake/build/pkg.rb
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,13 @@ def populate_rpm_dir(rpm_dir)
- Set `SIMP_PKG_verbose=yes` to report file operations as they happen.
EOM
task :doc => [:prep] do |t,args|
# Need to make sure that the docs have the version updated
# appropriately prior to building

Dir.chdir(@build_dirs[:doc]) do
sh %{rake munge:prep}
end

build(@build_dirs[:doc],t)
end

Expand Down
2 changes: 1 addition & 1 deletion lib/simp/rake/helpers/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ module Simp; end
module Simp::Rake; end

class Simp::Rake::Helpers
VERSION = '5.0.1'
VERSION = '5.0.2'
end
29 changes: 19 additions & 10 deletions lib/simp/rake/pkg.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@ def initialize( base_dir, unique_namespace = nil, simp_version=nil )
'spec/fixtures/modules'
]

# This is only meant to be used to work around the case where particular
# packages need to ignore some set of artifacts that get updated out of
# band. This should not be set as a regular environment variable and
# should be fixed properly at some time in the future.
#
# Presently, this is used by simp-doc
if ENV['SIMP_INTERNAL_pkg_ignore']
@ignore_changes_list += ENV['SIMP_INTERNAL_pkg_ignore'].split(',')
end

FileUtils.mkdir_p(@pkg_tmp_dir)

local_spec = Dir.glob(File.join(@base_dir, 'build', '*.spec'))
Expand All @@ -71,15 +81,6 @@ def initialize( base_dir, unique_namespace = nil, simp_version=nil )
FileUtils.chmod(0640, @spec_file)
end

# The following are required to build successful RPMs using the new
# LUA-based RPM template

@puppet_module_info_files = [
Dir.glob(%(#{@base_dir}/build/rpm_metadata/*)),
%(#{@base_dir}/CHANGELOG),
%(#{@base_dir}/metadata.json)
].flatten

::CLEAN.include( @pkg_dir )

yield self if block_given?
Expand Down Expand Up @@ -226,7 +227,15 @@ def define_pkg_rpm
Dir.chdir(@pkg_dir) do

# Copy in the materials required for the module builds
@puppet_module_info_files.each do |f|
# The following are required to build successful RPMs using
# the new LUA-based RPM template
puppet_module_info_files = [
Dir.glob(%(#{@base_dir}/build/rpm_metadata/*)),
%(#{@base_dir}/CHANGELOG),
%(#{@base_dir}/metadata.json)
].flatten

puppet_module_info_files.each do |f|
if File.exist?(f)
FileUtils.cp_r(f, @rpm_srcdir)
end
Expand Down

0 comments on commit a929a53

Please sign in to comment.