Commit 650f63be authored by Adam Leff's avatar Adam Leff Committed by Matt Ray

Adding support for wrlinux7 to support Cisco IOS-XR devices

Similar to the changes required to support wrlinux5 for Cisco
Nexus devices, this commit adds the necessary changes to support
WRL7 omnibus-chef builds.
parent 71ef6276
......@@ -51,16 +51,6 @@ module Omnibus
/libutil\.so/,
].freeze
WRLINUX_WHITELIST_LIBS = [
/libc\.so/,
/libcrypt\.so/,
/libdl\.so/,
/libm\.so/,
/libpthread\.so/,
/librt\.so/,
/libutil\.so/,
].freeze
AIX_WHITELIST_LIBS = [
/libpthread\.a/,
/libpthreads\.a/,
......@@ -420,8 +410,6 @@ module Omnibus
whitelist_libs = case Ohai['platform']
when 'arch'
ARCH_WHITELIST_LIBS
when 'nexus'
WRLINUX_WHITELIST_LIBS
when 'mac_os_x'
MAC_WHITELIST_LIBS
when 'solaris2'
......
......@@ -157,7 +157,7 @@ module Omnibus
#
def truncate_platform_version(platform_version, platform)
case platform
when 'centos', 'debian', 'el', 'fedora', 'freebsd', 'omnios', 'pidora', 'raspbian', 'rhel', 'sles', 'suse', 'smartos', 'nexus'
when 'centos', 'debian', 'el', 'fedora', 'freebsd', 'omnios', 'pidora', 'raspbian', 'rhel', 'sles', 'suse', 'smartos', 'nexus', 'ios_xr'
# Only want MAJOR (e.g. Debian 7, OmniOS r151006, SmartOS 20120809T221258Z)
platform_version.split('.').first
when 'aix', 'gentoo', 'mac_os_x', 'openbsd', 'slackware', 'solaris2', 'opensuse', 'ubuntu'
......
......@@ -282,27 +282,27 @@ module Omnibus
render_template(resource_path('spec.erb'),
destination: spec_file,
variables: {
name: safe_base_package_name,
version: safe_version,
iteration: safe_build_iteration,
vendor: vendor,
license: license,
dist_tag: dist_tag,
maintainer: project.maintainer,
homepage: project.homepage,
description: project.description,
priority: priority,
category: category,
conflicts: project.conflicts,
replaces: project.replaces,
dependencies: project.runtime_dependencies,
user: project.package_user,
group: project.package_group,
scripts: scripts,
config_files: config_files,
files: files,
build_dir: build_dir,
platform: Omnibus::Metadata.platform_shortname
name: safe_base_package_name,
version: safe_version,
iteration: safe_build_iteration,
vendor: vendor,
license: license,
dist_tag: dist_tag,
maintainer: project.maintainer,
homepage: project.homepage,
description: project.description,
priority: priority,
category: category,
conflicts: project.conflicts,
replaces: project.replaces,
dependencies: project.runtime_dependencies,
user: project.package_user,
group: project.package_group,
scripts: scripts,
config_files: config_files,
files: files,
build_dir: build_dir,
platform_family: Ohai['platform_family']
}
)
end
......@@ -496,18 +496,25 @@ module Omnibus
#
if version =~ /\-/
if Ohai['platform_family'] == 'wrlinux'
converted = version.gsub('-', '_') #WRL5 has an elderly RPM version
converted = version.gsub('-', '_') #WRL has an elderly RPM version
log.warn(log_key) do
"Omnibus replaces dashes (-) with tildes (~) so pre-release " \
"versions get sorted earlier than final versions. However, the " \
"version of rpmbuild on Wind River Linux does not support this. " \
"All dashes will be replaced with underscores (_). Converting " \
"`#{project.build_version}' to `#{converged}'."
end
else
converted = version.gsub('-', '~')
log.warn(log_key) do
"Tildes hold special significance in the RPM package versions. " \
"They mark a version as lower priority in RPM's version compare " \
"logic. We'll replace all dashes (-) with tildes (~) so pre-release" \
"versions get sorted earlier then final versions. Converting" \
"`#{project.build_version}' to `#{converted}'."
end
end
log.warn(log_key) do
"Tildes hold special significance in the RPM package versions. " \
"They mark a version as lower priority in RPM's version compare " \
"logic. We'll replace all dashes (-) with tildes (~) so pre-release" \
"versions get sorted earlier then final versions. Converting" \
"`#{project.build_version}' to `#{converted}'."
end
version = converted
end
......
......@@ -19,9 +19,10 @@ Name: <%= name %>
Version: <%= version %>
Release: <%= iteration %><%= dist_tag %>
Summary: <%= description.split("\n").first.empty? ? "_" : description.split("\n").first %>
-<% if platform != 'nexus' -%>
<% # Wind River Linux does not support BuildArch in its RPM spec files -%>
<% if platform_family != 'wrlinux' -%>
BuildArch: <%= architecture %>
-<% end -%>
<% end -%>
AutoReqProv: no
BuildRoot: %buildroot
Prefix: /
......
......@@ -80,7 +80,9 @@ module Omnibus
it_behaves_like 'a version manipulator', 'fedora', '11.5', '11'
it_behaves_like 'a version manipulator', 'freebsd', '10.0', '10'
it_behaves_like 'a version manipulator', 'gentoo', '2004.3', '2004.3'
it_behaves_like 'a version manipulator', 'ios_xr', '6.0.0.14I', '6'
it_behaves_like 'a version manipulator', 'mac_os_x', '10.9.1', '10.9'
it_behaves_like 'a version manipulator', 'nexus', '5.0', '5'
it_behaves_like 'a version manipulator', 'omnios', 'r151010', 'r151010'
it_behaves_like 'a version manipulator', 'openbsd', '5.4.4', '5.4'
it_behaves_like 'a version manipulator', 'opensuse', '5.9', '5.9'
......
......@@ -239,6 +239,30 @@ module Omnibus
expect(contents).to include("%dir %attr(0555,root,root) /usr/lib")
end
end
context 'when the platform_family is wrlinux' do
before do
# This stub_ohai call to be uncommented once the Fauxhai PR
# for adding wrlinux support is merged and a subsequent
# release is cut.
#
# See: https://github.com/customink/fauxhai/pull/161
#stub_ohai(platform: 'nexus', version: '7.0.0.2')
end
it 'writes out a spec file with no BuildArch' do
# This test to be removed from pending once the Fauxhai PR
# for adding wrlinux support is merged and a subsequent
# release is cut.
#
# See: https://github.com/customink/fauxhai/pull/161
pending 'release of Fauxhai that includes wrlinux platform_family support'
subject.write_rpm_spec
contents = File.read(spec_file)
expect(contents).not_to include("BuildArch")
end
end
end
describe '#create_rpm_file' do
......@@ -368,6 +392,48 @@ module Omnibus
expect(output).to include("The `version' component of RPM package names can only include")
end
end
context 'when the build is for nexus' do
before do
project.build_version('1.2-3')
# The stub_ohai call should be removed once the PR for wrlinux
# Fauxhai support is merged and a subsequent release is cut.
#
# See: https://github.com/customink/fauxhai/pull/161
#stub_ohai(platform: 'nexus', version: '5.1')
end
it 'returns the value while logging a message' do
pending 'release of Fauxhai with wrlinux support'
output = capture_logging do
expect(subject.safe_version).to eq('1.2_3')
end
expect(output).to include("rpmbuild on Wind River Linux does not support this")
end
end
context 'when the build is for ios_xr' do
before do
project.build_version('1.2-3')
# The stub_ohai call should be removed once the PR for wrlinux
# Fauxhai support is merged and a subsequent release is cut.
#
# See: https://github.com/customink/fauxhai/pull/160
#stub_ohai(platform: 'ios_xr', version: '6.0.0.14I')
end
it 'returns the value while logging a message' do
pending 'release of Fauxhai with wrlinux support'
output = capture_logging do
expect(subject.safe_version).to eq('1.2_3')
end
expect(output).to include("rpmbuild on Wind River Linux does not support this")
end
end
end
describe '#safe_architecture' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment