[Pkg-puppet-devel] [facter] 138/180: (FACT-567) Restore Windows gem package dependencies
Stig Sandbeck Mathisen
ssm at debian.org
Mon Jun 30 15:06:40 UTC 2014
This is an automated email from the git hooks/post-receive script.
ssm pushed a commit to branch master
in repository facter.
commit 83db49c73a6d526bee383da7c40561763c1dd3f3
Author: Josh Cooper <josh at puppetlabs.com>
Date: Tue Jun 17 13:44:02 2014 -0700
(FACT-567) Restore Windows gem package dependencies
The gem packaging (rake package:gem) and the bundler (bundle install)
workflows can be driven by the same ext/project_data.yaml file for
simple use cases like the CFPropertyList gem on darwin.
However, it doesn't work for Windows gem dependencies across different
ruby versions (ruby 1.9 x86 and ruby 2.0 x64) and windows architectures
(x86 and x64).
For example, the following will fail on ruby 1.9 x86:
platform(:mingw, :x64_mingw) do
gem 'ffi'
end
Because only bundler version 1.5.0 and up understand the `:x64_mingw`
platform[1]. Running with an earlier version of bundler will fail
hard with '`x64_mingw` is not a valid platform.'
Another issue is that the current packaging workflow assumes the same
gem, e.g. `ffi`, isn't expressed across multiple platforms, e.g.
x86-mingw and x64-mingw. If you do this in project_data.yaml, then
during a `bundle install` we effectively end up doing:
platform(:mingw) do
gem 'ffi'
end
platform(:x64_mingw) do
gem 'ffi'
end
which results in warnings like:
Your Gemfile lists the gem ffi (~> 1.9.3) more than once.
You should probably keep only one of them. While it's not
a problem now, it could cause errors if you change the
version of just one of them later.
Alternatively, you can do `gem 'ffi', :platforms => :mingw, :x64_mingw`,
but the project_data.yaml file is not setup to express dependencies like
that.
Commit 72f820d01 moved windows dependencies from project_data back to
the Gemfile. As a result, windows specific facter gems did not contain
any dependency info. So doing a `bundle install` on code that depends on
facter, would not include the transitive windows gem dependencies, e.g.
ffi.
This commit duplicates the windows gem dependencies in the
project_data.yaml. Also when using bundler on windows, we only pull in
dependencies from the Gemfile, but not project_data.yaml. Otherwise, we
would get the 'Your Gemfile lists the gem ... more than once' error on
all platforms.
As a result of this change, we need to keep the dependencies in the
Gemfile and project_data.yaml in sync. At a future date, we can look at
improving the packaging repository to handle more complex gem
dependencies.
[1] https://github.com/bundler/bundler/commit/facdbf0a962
---
Gemfile | 1 +
ext/project_data.yaml | 13 +++++++++++--
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/Gemfile b/Gemfile
index e8e8c6a..ace9cdb 100644
--- a/Gemfile
+++ b/Gemfile
@@ -20,6 +20,7 @@ require 'yaml'
data = YAML.load_file(File.join(File.dirname(__FILE__), 'ext', 'project_data.yaml'))
bundle_platforms = data['bundle_platforms']
data['gem_platform_dependencies'].each_pair do |gem_platform, info|
+ next if gem_platform =~ /mingw/
if bundle_deps = info['gem_runtime_dependencies']
bundle_platform = bundle_platforms[gem_platform] or raise "Missing bundle_platform"
platform(bundle_platform.intern) do
diff --git a/ext/project_data.yaml b/ext/project_data.yaml
index 763265a..d136853 100644
--- a/ext/project_data.yaml
+++ b/ext/project_data.yaml
@@ -18,9 +18,18 @@ gem_platform_dependencies:
gem_runtime_dependencies:
CFPropertyList: '~> 2.2.6'
x86-mingw32:
- gem_runtime_dependencies: {}
+ gem_runtime_dependencies:
+ ffi: '~> 1.9.3'
+ win32-dir: '~> 0.4.8'
+ windows-pr: '~> 1.2'
+ win32-security: '>= 0.2.0'
+ win32console: '~> 1.3.2'
x64-mingw32:
- gem_runtime_dependencies: {}
+ gem_runtime_dependencies:
+ ffi: '~> 1.9.3'
+ win32-dir: '~> 0.4.8'
+ windows-pr: '~> 1.2'
+ win32-security: '>= 0.2.0'
bundle_platforms:
universal-darwin: ruby
x86-mingw32: mingw
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-puppet/facter.git
More information about the Pkg-puppet-devel
mailing list