Commit 837460ae authored by Seth Chisamore's avatar Seth Chisamore

Merge pull request #539 from mattray/wrlinux5

initial Wind River Linux 5/7 support for Cisco Nexus devices
parents 9fd45554 d3800139
......@@ -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'
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'
......
......@@ -37,6 +37,7 @@ module Omnibus
'debian' => DEB,
'fedora' => RPM,
'rhel' => RPM,
'wrlinux' => RPM,
'aix' => BFF,
'solaris2' => Solaris,
'windows' => MSI,
......
......@@ -282,26 +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,
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
......@@ -494,16 +495,27 @@ module Omnibus
# http://rpm.org/ticket/56
#
if version =~ /\-/
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}'."
if Ohai['platform_family'] == 'wrlinux'
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 `#{converted}'."
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
version = converted
end
......
......@@ -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,21 @@ module Omnibus
expect(contents).to include("%dir %attr(0555,root,root) /usr/lib")
end
end
context 'when the platform_family is wrlinux' do
let(:spec_file) { "#{staging_dir}/SPECS/project-1.2.3-2.nexus5.x86_64.rpm.spec" }
before do
stub_ohai(platform: 'nexus', version: '5')
end
it 'writes out a spec file with no BuildArch' do
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 +383,36 @@ 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')
stub_ohai(platform: 'nexus', version: '5')
end
it 'returns the value while logging a message' do
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')
stub_ohai(platform: 'ios_xr', version: '6.0.0.14I')
end
it 'returns the value while logging a message' do
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