Hello community,
here is the log from the commit of package rubygem-mini_portile2 for
openSUSE:Factory checked in at 2017-06-20 11:00:53
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-mini_portile2 (Old)
and /work/SRC/openSUSE:Factory/.rubygem-mini_portile2.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-mini_portile2"
Tue Jun 20 11:00:53 2017 rev:3 rq:503344 version:2.2.0
Changes:
--------
---
/work/SRC/openSUSE:Factory/rubygem-mini_portile2/rubygem-mini_portile2.changes
2016-04-07 13:27:23.000000000 +0200
+++
/work/SRC/openSUSE:Factory/.rubygem-mini_portile2.new/rubygem-mini_portile2.changes
2017-06-20 11:01:14.936330447 +0200
@@ -1,0 +2,17 @@
+Tue Jun 6 05:37:45 UTC 2017 - [email protected]
+
+- updated to version 2.2.0
+ see installed CHANGELOG.md
+
+ ### 2.2.0 / 2017-06-04
+
+ #### Enhancements
+
+ * Remove MD5 hashing of configure options, not avialbale in FIPS mode. (#78)
+ * Add experimental support for cmake-based projects.
+ * Retry on HTTP failures during downloads. [#63] (Thanks, @jtarchie and
@jvshahid!)
+ * Support Ruby 2.4 frozen string literals.
+ * Support applying patches for users with misconfigured git worktree. [#69]
+ * Support gpg signature verification of download resources.
+
+-------------------------------------------------------------------
Old:
----
mini_portile2-2.1.0.gem
New:
----
mini_portile2-2.2.0.gem
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ rubygem-mini_portile2.spec ++++++
--- /var/tmp/diff_new_pack.6s5o4e/_old 2017-06-20 11:01:15.656228973 +0200
+++ /var/tmp/diff_new_pack.6s5o4e/_new 2017-06-20 11:01:15.660228409 +0200
@@ -1,7 +1,7 @@
#
# spec file for package rubygem-mini_portile2
#
-# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -24,7 +24,7 @@
#
Name: rubygem-mini_portile2
-Version: 2.1.0
+Version: 2.2.0
Release: 0
%define mod_name mini_portile2
%define mod_full_name %{mod_name}-%{version}
++++++ mini_portile2-2.1.0.gem -> mini_portile2-2.2.0.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/.concourse.yml new/.concourse.yml
--- old/.concourse.yml 1970-01-01 01:00:00.000000000 +0100
+++ new/.concourse.yml 2017-06-05 03:10:16.000000000 +0200
@@ -0,0 +1,83 @@
+---
+resources:
+- name: mini_portile
+ type: git
+ source:
+ uri: https://github.com/flavorjones/mini_portile
+ branch: master
+jobs:
+- name: "Minitest"
+ plan:
+ - get: mini_portile
+ - task: With version 1.9.3
+ config:
+ platform: linux
+ image: docker:///ruby#1.9.3
+ inputs:
+ - name: mini_portile
+ run:
+ path: bash
+ args:
+ - "-c"
+ - cd mini_portile && bundle install && rake
+ privileged: false
+ - task: With version 2.0
+ config:
+ platform: linux
+ image: docker:///ruby#2.0
+ inputs:
+ - name: mini_portile
+ run:
+ path: bash
+ args:
+ - "-c"
+ - cd mini_portile && bundle install && rake
+ privileged: false
+ - task: With version 2.1
+ config:
+ platform: linux
+ image: docker:///ruby#2.1
+ inputs:
+ - name: mini_portile
+ run:
+ path: bash
+ args:
+ - "-c"
+ - cd mini_portile && bundle install && rake
+ privileged: false
+ - task: With version 2.2
+ config:
+ platform: linux
+ image: docker:///ruby#2.2
+ inputs:
+ - name: mini_portile
+ run:
+ path: bash
+ args:
+ - "-c"
+ - cd mini_portile && bundle install && rake
+ privileged: false
+ - task: With version jruby-1.7.23
+ config:
+ platform: linux
+ image: docker:///jruby#1.7.23
+ inputs:
+ - name: mini_portile
+ run:
+ path: bash
+ args:
+ - "-c"
+ - cd mini_portile && bundle install && rake
+ privileged: false
+ - task: With version jruby-9.0.4.0
+ config:
+ platform: linux
+ image: docker:///jruby#9.0.4.0
+ inputs:
+ - name: mini_portile
+ run:
+ path: bash
+ args:
+ - "-c"
+ - cd mini_portile && bundle install && rake
+ privileged: false
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/.gitignore new/.gitignore
--- old/.gitignore 2016-01-06 20:10:15.000000000 +0100
+++ new/.gitignore 2017-06-05 03:10:16.000000000 +0200
@@ -3,3 +3,5 @@
Gemfile.lock
.bundle
ports
+concourse/private.yml
+concourse/mini_portile.final.yml
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/.travis.yml new/.travis.yml
--- old/.travis.yml 2016-01-06 20:10:15.000000000 +0100
+++ new/.travis.yml 2017-06-05 03:10:16.000000000 +0200
@@ -1,11 +1,15 @@
---
language: ruby
sudo: false
-rvm:
- - 1.9.3
- - 2.0
- - 2.1
- - 2.2
- - ruby-head
- - jruby-1.7.23
- - jruby-9.0.4.0
+matrix:
+ include:
+ - rvm: 1.9.3
+ - rvm: 2.0
+ - rvm: 2.1
+ - rvm: 2.2.5
+ - rvm: 2.3.1
+ - rvm: 2.4.0
+ env:
+ - RUBYOPT="--enable-frozen-string-literal --debug=frozen-string-literal"
+ - rvm: jruby-1.7
+ - rvm: jruby-9.1.5.0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/CHANGELOG.md new/CHANGELOG.md
--- old/CHANGELOG.md 2016-01-06 20:10:15.000000000 +0100
+++ new/CHANGELOG.md 2017-06-05 03:10:16.000000000 +0200
@@ -1,3 +1,15 @@
+### 2.2.0 / 2017-06-04
+
+#### Enhancements
+
+* Remove MD5 hashing of configure options, not avialbale in FIPS mode. (#78)
+* Add experimental support for cmake-based projects.
+* Retry on HTTP failures during downloads. [#63] (Thanks, @jtarchie and
@jvshahid!)
+* Support Ruby 2.4 frozen string literals.
+* Support applying patches for users with misconfigured git worktree. [#69]
+* Support gpg signature verification of download resources.
+
+
### 2.1.0 / 2016-01-06
#### Enhancements
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/README.md new/README.md
--- old/README.md 2016-01-06 20:10:15.000000000 +0100
+++ new/README.md 2017-06-05 03:10:16.000000000 +0200
@@ -46,15 +46,17 @@
## Sounds easy, but where's the catch?
-At this time (and highly likely will be always) `mini_portile2` is
-only compatible with **GCC compilers** and **autoconf**- or
-**configure**-based projects.
+At this time `mini_portile2` only supports **autoconf**- or
+**configure**-based projects. (That is, it assumes the library you
+want to build contains a `configure` script, which all the
+autoconf-based libraries do.)
-That is, it assumes the library you want to build contains a
-`configure` script, which all the autoconf-based libraries do.
+As of v2.2.0, there is experimental support for **CMake**-based
+projects. We welcome your feedback on this, particularly for Windows
+platforms.
-### How to use
+### How to use (for autoconf projects)
Now that you know the catch, and you're still reading this, here is a
quick example:
@@ -82,6 +84,11 @@
system-wide installation.
+### How to use (for cmake projects)
+
+Same as above, but instead of `MiniPortile.new`, call `MiniPortileCMake.new`.
+
+
### Directory Structure Conventions
`mini_portile2` follows the principle of **convention over configuration** and
@@ -140,7 +147,7 @@
recipe = MiniPortile.new("libiconv", "1.13.1")
recipe.files << {
url: "http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz"],
- md5: "7ab33ebd26687c744a37264a330bbe9a"
+ sha256: "55a36168306089009d054ccdd9d013041bfc3ab26be7033d107821f1c4949a49"
}
checkpoint = ".#{recipe.name}-#{recipe.version}.installed"
@@ -167,6 +174,45 @@
As an exercise for the reader, you could specify the libiconv version
in an environment variable or a configuration file.
+### Download verification
+MiniPortile supports HTTPS, HTTP, FTP and FILE sources for download.
+The integrity of the downloaded file can be verified per hash value or PGP
signature.
+This is particular important for untrusted sources (non-HTTPS).
+
+#### Hash digest verification
+MiniPortile can verify the integrity of the downloaded file per SHA256, SHA1
or MD5 hash digest.
+
+```ruby
+ recipe.files << {
+ url: "http://your.host/file.tar.bz2",
+ sha256: "<32 byte hex value>",
+ }
+```
+
+#### PGP signature verification
+MiniPortile can also verify the integrity of the downloaded file per PGP
signature.
+
+```ruby
+ public_key = <<-EOT
+ -----BEGIN PGP PUBLIC KEY BLOCK-----
+ Version: GnuPG v1
+
+ mQENBE7SKu8BCADQo6x4ZQfAcPlJMLmL8zBEBUS6GyKMMMDtrTh3Yaq481HB54oR
+ [...]
+ -----END PGP PUBLIC KEY BLOCK-----
+ EOT
+
+ recipe.files << {
+ url: "http://your.host/file.tar.bz2",
+ gpg: {
+ key: public_key,
+ signature_url: "http://your.host/file.tar.bz2.sig"
+ }
+ }
+```
+
+Please note, that the `gpg` executable is required to verify the signature.
+It is therefore recommended to use the hash verification method instead of
PGP, when used in `extconf.rb` while `gem install`.
### Native and/or Cross Compilation
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Rakefile new/Rakefile
--- old/Rakefile 2016-01-06 20:10:15.000000000 +0100
+++ new/Rakefile 2017-06-05 03:10:16.000000000 +0200
@@ -1,10 +1,11 @@
require "rake/clean"
require 'bundler/gem_tasks'
+require 'concourse'
namespace :test do
desc "Test MiniPortile by running unit tests"
task :unit do
- sh "ruby -w -W2 -I. -Ilib -e \"#{Dir["test/test_*.rb"].map{|f| "require
'#{f}';"}.join}\" -- -v"
+ sh "ruby -w -W2 -I. -Ilib -e \"#{Dir["test/test_*.rb"].map{|f| "require
'#{f}';"}.join}\" -- #{ENV['TESTOPTS']} -v"
end
desc "Test MiniPortile by compiling examples"
@@ -23,3 +24,6 @@
task :test => ["test:unit", "test:examples"]
task :default => [:test]
+
+
+Concourse.new("mini_portile").create_tasks!
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/appveyor.yml new/appveyor.yml
--- old/appveyor.yml 2016-01-06 20:10:15.000000000 +0100
+++ new/appveyor.yml 2017-06-05 03:10:16.000000000 +0200
@@ -7,6 +7,7 @@
- ruby --version
- gem --version
- bundle install
+ - gpg --version
build: off
Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/concourse/mini_portile.yml
new/concourse/mini_portile.yml
--- old/concourse/mini_portile.yml 1970-01-01 01:00:00.000000000 +0100
+++ new/concourse/mini_portile.yml 2017-06-05 03:10:16.000000000 +0200
@@ -0,0 +1,160 @@
+% ruby_version = RUBIES[:mri].last
+
+groups:
+ - name: master
+ jobs:
+ - ruby-<%= ruby_version %>
+ - windows-install-ruby-2.3
+ - ruby-2.3-devkit
+
+ - name: PRs
+ jobs:
+ - pr-pending
+ - ruby-<%= ruby_version %>-pr
+ - pr-success
+
+resource_types:
+- name: pull-request
+ type: docker-image
+ source:
+ repository: jtarchie/pr
+
+resources:
+ - name: ci
+ type: git
+ source:
+ uri: https://github.com/flavorjones/mini_portile/
+ branch: master
+ disable_ci_skip: true # always get the latest pipeline configuration
+
+ - name: nokogiri-ci
+ type: git
+ source:
+ uri: https://github.com/sparklemotion/nokogiri/
+ branch: master
+ disable_ci_skip: true # always get the latest pipeline configuration
+
+ - name: mini_portile
+ type: git
+ source:
+ uri: https://github.com/flavorjones/mini_portile/
+ branch: master
+ ignore_paths:
+ - concourse/**
+
+ - name: mini_portile-pr
+ type: pull-request
+ source:
+ repo: flavorjones/mini_portile
+ access_token: {{github-repo-status-access-token}}
+ ignore_paths:
+ - concourse/**
+
+jobs:
+ #
+ # master
+ #
+ - name: ruby-<%= ruby_version %>
+ public: true
+ plan:
+ - get: ci
+ - get: mini_portile
+ trigger: true
+ - task: rake-test
+ config:
+ platform: linux
+ image_resource:
+ type: docker-image
+ source: {repository: ruby, tag: "<%= ruby_version %>"}
+ inputs:
+ - name: ci
+ - name: mini_portile
+ run:
+ path: ci/concourse/tasks/rake-test/task.sh
+
+ - name: windows-install-ruby-2.3
+ public: true
+ serial_groups: [windows-configuration]
+ plan:
+ - get: nokogiri-ci
+ - get: mini_portile
+ trigger: true
+ - task: setup
+ config:
+ platform: windows
+ inputs:
+ - name: nokogiri-ci
+ path: ci
+ run:
+ path: powershell
+ args: ["-File",
"ci/concourse/tasks/windows-config/install-ruby-and-devkit.ps1"]
+
+ - name: ruby-2.3-devkit
+ public: true
+ plan:
+ - get: ci
+ - get: nokogiri-ci
+ - get: mini_portile
+ trigger: true
+ passed: ["windows-install-ruby-2.3"]
+ - task: rake-test
+ config:
+ platform: windows
+ inputs:
+ - name: ci
+ - name: nokogiri-ci
+ - name: mini_portile
+ run:
+ path: powershell
+ args: ["-File", "ci/concourse/tasks/rake-test/task.ps1"]
+
+ #
+ # PRs
+ #
+ - name: pr-pending
+ public: true
+ plan:
+ - get: ci
+ - get: mini_portile-pr
+ trigger: true
+ version: every
+ - put: mini_portile-pr
+ params: {path: mini_portile-pr, status: pending}
+
+ - name: ruby-<%= ruby_version %>-pr
+ public: true
+ serial_groups: [pr]
+ plan:
+ - get: ci
+ - get: mini_portile-pr
+ trigger: true
+ version: every
+ passed: [pr-pending]
+ - task: rake-test
+ config:
+ platform: linux
+ image_resource:
+ type: docker-image
+ source: {repository: ruby, tag: "<%= ruby_version %>"}
+ inputs:
+ - name: ci
+ - name: mini_portile-pr
+ path: mini_portile
+ run:
+ path: ci/concourse/tasks/rake-test/task.sh
+ on_failure:
+ put: mini_portile-pr
+ params: {path: mini_portile-pr, status: failure}
+
+ - name: pr-success
+ public: true
+ serial_groups: [pr]
+ disable_manual_trigger: true
+ plan:
+ - get: mini_portile-pr
+ trigger: true
+ version: every
+ passed:
+ - ruby-<%= ruby_version %>-pr
+ - put: mini_portile-pr
+ params: {path: mini_portile-pr, status: success}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/concourse/tasks/rake-test/task.ps1
new/concourse/tasks/rake-test/task.ps1
--- old/concourse/tasks/rake-test/task.ps1 1970-01-01 01:00:00.000000000
+0100
+++ new/concourse/tasks/rake-test/task.ps1 2017-06-05 03:10:16.000000000
+0200
@@ -0,0 +1,13 @@
+. "nokogiri-ci\concourse\shared\common.ps1"
+. "c:\var\vcap\packages\windows-ruby-dev-tools\prelude.ps1"
+
+prepend-path $ruby23_bin_path
+$env:RUBYOPT = "-rdevkit"
+
+push-location mini_portile
+
+ stream-cmd "gem" "install bundler"
+ stream-cmd "bundle" "install"
+ stream-cmd "bundle" "exec rake test"
+
+pop-location
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/concourse/tasks/rake-test/task.sh
new/concourse/tasks/rake-test/task.sh
--- old/concourse/tasks/rake-test/task.sh 1970-01-01 01:00:00.000000000
+0100
+++ new/concourse/tasks/rake-test/task.sh 2017-06-05 03:10:16.000000000
+0200
@@ -0,0 +1,13 @@
+#! /usr/bin/env bash
+
+set -e -x -u
+
+apt-get update
+apt-get install -y cmake
+
+pushd mini_portile
+
+ bundle install
+ bundle exec rake test
+
+popd
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/mini_portile2/mini_portile.rb
new/lib/mini_portile2/mini_portile.rb
--- old/lib/mini_portile2/mini_portile.rb 2016-01-06 20:10:15.000000000
+0100
+++ new/lib/mini_portile2/mini_portile.rb 2017-06-05 03:10:16.000000000
+0200
@@ -4,7 +4,7 @@
require 'net/ftp'
require 'fileutils'
require 'tempfile'
-require 'digest/md5'
+require 'digest'
require 'open-uri'
require 'cgi'
require 'rbconfig'
@@ -33,6 +33,10 @@
attr_writer :configure_options
attr_accessor :host, :files, :patch_files, :target, :logger
+ def self.windows?
+ RbConfig::CONFIG['target_os'] =~ /mswin|mingw32/
+ end
+
def initialize(name, version)
@name = name
@version = version
@@ -68,7 +72,7 @@
message "Running git apply with #{file}... "
# By --work-tree=. git-apply uses the current directory as
# the project root and will not search upwards for .git.
- execute('patch', ["git", "--work-tree=.", "apply",
"--whitespace=warn", file], :initial_message => false)
+ execute('patch', ["git", "--git-dir=.", "--work-tree=.", "apply",
"--whitespace=warn", file], :initial_message => false)
}
when which('patch')
lambda { |file|
@@ -95,9 +99,8 @@
def configure
return if configured?
- md5_file = File.join(tmp_path, 'configure.md5')
- digest = Digest::MD5.hexdigest(computed_options.to_s)
- File.open(md5_file, "w") { |f| f.write digest }
+ cache_file = File.join(tmp_path, 'configure.options_cache')
+ File.open(cache_file, "w") { |f| f.write computed_options.to_s }
if RUBY_PLATFORM=~/mingw|mswin/
# Windows doesn't recognize the shebang.
@@ -127,12 +130,12 @@
def configured?
configure = File.join(work_path, 'configure')
makefile = File.join(work_path, 'Makefile')
- md5_file = File.join(tmp_path, 'configure.md5')
+ cache_file = File.join(tmp_path, 'configure.options_cache')
- stored_md5 = File.exist?(md5_file) ? File.read(md5_file) : ""
- current_md5 = Digest::MD5.hexdigest(computed_options.to_s)
+ stored_options = File.exist?(cache_file) ? File.read(cache_file) : ""
+ current_options = computed_options.to_s
- (current_md5 == stored_md5) && newer?(makefile, configure)
+ (current_options == stored_options) && newer?(makefile, configure)
end
def installed?
@@ -247,16 +250,47 @@
end
end
+ KEYRING_NAME = "mini_portile_keyring.gpg"
+
def verify_file(file)
- digest = case
- when exp=file[:sha256] then Digest::SHA256
- when exp=file[:sha1] then Digest::SHA1
- when exp=file[:md5] then Digest::MD5
- end
- if digest
- is = digest.file(file[:local_path]).hexdigest
- unless is == exp.downcase
- raise "Downloaded file '#{file[:local_path]}' has wrong hash:
expected: #{exp} is: #{is}"
+ if file.has_key?(:gpg)
+ gpg = file[:gpg]
+
+ signature_url = gpg[:signature_url] || "#{file[:url]}.asc"
+ signature_file = file[:local_path] + ".asc"
+ # download the signature file
+ download_file(signature_url, signature_file)
+
+ gpg_exe = which('gpg2') || which('gpg') || raise("Neither GPG nor GPG2
is installed")
+
+ # import the key into our own keyring
+ gpg_status = IO.popen([gpg_exe, "--status-fd", "1",
"--no-default-keyring", "--keyring", KEYRING_NAME, "--import"], "w+") do |io|
+ io.write gpg[:key]
+ io.close_write
+ io.read
+ end
+ raise "invalid gpg key provided" unless /\[GNUPG:\] IMPORT_OK \d+
(?<key_id>[0-9a-f]+)/i =~ gpg_status
+
+ # verify the signature against our keyring
+ gpg_status = IO.popen([gpg_exe, "--status-fd", "1",
"--no-default-keyring", "--keyring", KEYRING_NAME, "--verify", signature_file,
file[:local_path]], &:read)
+
+ # remove the key from our keyring
+ IO.popen([gpg_exe, "--batch", "--yes", "--no-default-keyring",
"--keyring", KEYRING_NAME, "--delete-keys", key_id], &:read)
+
+ raise "unable to delete the imported key" unless $?.exitstatus==0
+ raise "signature mismatch" unless gpg_status.match(/^\[GNUPG:\]
VALIDSIG/)
+
+ else
+ digest = case
+ when exp=file[:sha256] then Digest::SHA256
+ when exp=file[:sha1] then Digest::SHA1
+ when exp=file[:md5] then Digest::MD5
+ end
+ if digest
+ is = digest.file(file[:local_path]).hexdigest
+ unless is == exp.downcase
+ raise "Downloaded file '#{file[:local_path]}' has wrong hash:
expected: #{exp} is: #{is}"
+ end
end
end
end
@@ -434,6 +468,7 @@
[proxy_uri, proxy_user, proxy_pass]
end
end
+
begin
OpenURI.open_uri(url, 'rb', params) do |io|
temp_file << io.read
@@ -442,8 +477,15 @@
rescue OpenURI::HTTPRedirect => redirect
raise "Too many redirections for the original URL, halting." if count
<= 0
count = count - 1
- return download_file(redirect.url, full_path, count - 1)
+ return download_file(redirect.url, full_path, count-1)
rescue => e
+ count = count - 1
+ puts "#{count} retrie(s) left for #{filename}"
+ if count > 0
+ sleep 1
+ return download_file_http(url, full_path, count)
+ end
+
output e.message
return false
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/mini_portile2/mini_portile_cmake.rb
new/lib/mini_portile2/mini_portile_cmake.rb
--- old/lib/mini_portile2/mini_portile_cmake.rb 1970-01-01 01:00:00.000000000
+0100
+++ new/lib/mini_portile2/mini_portile_cmake.rb 2017-06-05 03:10:16.000000000
+0200
@@ -0,0 +1,40 @@
+require 'mini_portile2/mini_portile'
+
+class MiniPortileCMake < MiniPortile
+ def configure_prefix
+ "-DCMAKE_INSTALL_PREFIX=#{File.expand_path(port_path)}"
+ end
+
+ def configure_defaults
+ if MiniPortile.windows?
+ ['-G "NMake Makefiles"']
+ else
+ []
+ end
+ end
+
+ def configure
+ return if configured?
+
+ cache_file = File.join(tmp_path, 'configure.options_cache')
+ File.open(cache_file, "w") { |f| f.write computed_options.to_s }
+
+ execute('configure', %w(cmake) + computed_options + ["."])
+ end
+
+ def configured?
+ configure = File.join(work_path, 'configure')
+ makefile = File.join(work_path, 'CMakefile')
+ cache_file = File.join(tmp_path, 'configure.options_cache')
+
+ stored_options = File.exist?(cache_file) ? File.read(cache_file) : ""
+ current_options = computed_options.to_s
+
+ (current_options == stored_options) && newer?(makefile, configure)
+ end
+
+ def make_cmd
+ return "nmake" if MiniPortile.windows?
+ super
+ end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/mini_portile2/version.rb
new/lib/mini_portile2/version.rb
--- old/lib/mini_portile2/version.rb 2016-01-06 20:10:15.000000000 +0100
+++ new/lib/mini_portile2/version.rb 2017-06-05 03:10:16.000000000 +0200
@@ -1,3 +1,3 @@
class MiniPortile
- VERSION = "2.1.0"
+ VERSION = "2.2.0"
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/mini_portile2.rb new/lib/mini_portile2.rb
--- old/lib/mini_portile2.rb 2016-01-06 20:10:15.000000000 +0100
+++ new/lib/mini_portile2.rb 2017-06-05 03:10:16.000000000 +0200
@@ -1,2 +1,3 @@
require "mini_portile2/version"
require "mini_portile2/mini_portile"
+require "mini_portile2/mini_portile_cmake"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata 2016-01-06 20:10:15.000000000 +0100
+++ new/metadata 2017-06-05 03:10:16.000000000 +0200
@@ -1,7 +1,7 @@
--- !ruby/object:Gem::Specification
name: mini_portile2
version: !ruby/object:Gem::Version
- version: 2.1.0
+ version: 2.2.0
platform: ruby
authors:
- Luis Lavena
@@ -10,7 +10,7 @@
autorequire:
bindir: bin
cert_chain: []
-date: 2016-01-06 00:00:00.000000000 Z
+date: 2017-06-05 00:00:00.000000000 Z
dependencies:
- !ruby/object:Gem::Dependency
name: bundler
@@ -32,56 +32,70 @@
requirements:
- - "~>"
- !ruby/object:Gem::Version
- version: '10.0'
+ version: '12.0'
type: :development
prerelease: false
version_requirements: !ruby/object:Gem::Requirement
requirements:
- - "~>"
- !ruby/object:Gem::Version
- version: '10.0'
+ version: '12.0'
- !ruby/object:Gem::Dependency
name: minitest
requirement: !ruby/object:Gem::Requirement
requirements:
- - "~>"
- !ruby/object:Gem::Version
- version: 5.8.0
+ version: '5.8'
type: :development
prerelease: false
version_requirements: !ruby/object:Gem::Requirement
requirements:
- - "~>"
- !ruby/object:Gem::Version
- version: 5.8.0
+ version: '5.8'
- !ruby/object:Gem::Dependency
name: minitest-hooks
requirement: !ruby/object:Gem::Requirement
requirements:
- - "~>"
- !ruby/object:Gem::Version
- version: 1.4.0
+ version: '1.4'
type: :development
prerelease: false
version_requirements: !ruby/object:Gem::Requirement
requirements:
- - "~>"
- !ruby/object:Gem::Version
- version: 1.4.0
+ version: '1.4'
- !ruby/object:Gem::Dependency
name: minitar
requirement: !ruby/object:Gem::Requirement
requirements:
- - "~>"
- !ruby/object:Gem::Version
- version: 0.5.4
+ version: '0.5'
type: :development
prerelease: false
version_requirements: !ruby/object:Gem::Requirement
requirements:
- - "~>"
- !ruby/object:Gem::Version
- version: 0.5.4
+ version: '0.5'
+- !ruby/object:Gem::Dependency
+ name: concourse
+ requirement: !ruby/object:Gem::Requirement
+ requirements:
+ - - "~>"
+ - !ruby/object:Gem::Version
+ version: '0.12'
+ type: :development
+ prerelease: false
+ version_requirements: !ruby/object:Gem::Requirement
+ requirements:
+ - - "~>"
+ - !ruby/object:Gem::Version
+ version: '0.12'
description: Simplistic port-like solution for developers. It provides a
standard
and simplified way to compile against dependency libraries without messing
up your
system.
@@ -90,6 +104,7 @@
extensions: []
extra_rdoc_files: []
files:
+- ".concourse.yml"
- ".gitignore"
- ".travis.yml"
- CHANGELOG.md
@@ -98,15 +113,25 @@
- README.md
- Rakefile
- appveyor.yml
+- concourse/mini_portile.yml
+- concourse/tasks/rake-test/task.ps1
+- concourse/tasks/rake-test/task.sh
- lib/mini_portile2.rb
- lib/mini_portile2/mini_portile.rb
+- lib/mini_portile2/mini_portile_cmake.rb
- lib/mini_portile2/version.rb
- mini_portile2.gemspec
- test/assets/git/config
+- test/assets/gpg-fixtures/data
+- test/assets/gpg-fixtures/data.asc
+- test/assets/gpg-fixtures/data.invalid.asc
- test/assets/patch 1.diff
- test/assets/test mini portile-1.0.0/configure
+- test/assets/test-cmake-1.0/CMakeLists.txt
+- test/assets/test-cmake-1.0/hello.c
- test/assets/test-download-archive.tar.gz
- test/helper.rb
+- test/test_cmake.rb
- test/test_cook.rb
- test/test_digest.rb
- test/test_download.rb
@@ -131,16 +156,22 @@
version: '0'
requirements: []
rubyforge_project:
-rubygems_version: 2.4.8
+rubygems_version: 2.6.10
signing_key:
specification_version: 4
summary: Simplistic port-like solution for developers
test_files:
- test/assets/git/config
+- test/assets/gpg-fixtures/data
+- test/assets/gpg-fixtures/data.asc
+- test/assets/gpg-fixtures/data.invalid.asc
- test/assets/patch 1.diff
- test/assets/test mini portile-1.0.0/configure
+- test/assets/test-cmake-1.0/CMakeLists.txt
+- test/assets/test-cmake-1.0/hello.c
- test/assets/test-download-archive.tar.gz
- test/helper.rb
+- test/test_cmake.rb
- test/test_cook.rb
- test/test_digest.rb
- test/test_download.rb
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/mini_portile2.gemspec new/mini_portile2.gemspec
--- old/mini_portile2.gemspec 2016-01-06 20:10:15.000000000 +0100
+++ new/mini_portile2.gemspec 2017-06-05 03:10:16.000000000 +0200
@@ -16,7 +16,11 @@
spec.homepage = 'http://github.com/flavorjones/mini_portile'
spec.licenses = ['MIT']
- spec.files = `git ls-files -z`.split("\x0")
+ begin
+ spec.files = `git ls-files -z`.split("\x0")
+ rescue Exception => e
+ warn "WARNING: could not set spec.files: #{e.class}: #{e}"
+ end
# omit the `examples` directory from the gem, because it's large and
# not necessary to be packaged in the gem.
@@ -28,10 +32,11 @@
spec.require_paths = ["lib"]
spec.add_development_dependency "bundler", "~> 1.7"
- spec.add_development_dependency "rake", "~> 10.0"
- spec.add_development_dependency "minitest", "~> 5.8.0"
- spec.add_development_dependency "minitest-hooks", "~> 1.4.0"
- spec.add_development_dependency "minitar", "~> 0.5.4"
+ spec.add_development_dependency "rake", "~> 12.0"
+ spec.add_development_dependency "minitest", "~> 5.8"
+ spec.add_development_dependency "minitest-hooks", "~> 1.4"
+ spec.add_development_dependency "minitar", "~> 0.5"
+ spec.add_development_dependency "concourse", "~> 0.12"
spec.required_ruby_version = ">= 1.9.2"
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/test/assets/gpg-fixtures/data
new/test/assets/gpg-fixtures/data
--- old/test/assets/gpg-fixtures/data 1970-01-01 01:00:00.000000000 +0100
+++ new/test/assets/gpg-fixtures/data 2017-06-05 03:10:16.000000000 +0200
@@ -0,0 +1 @@
+test
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/test/assets/gpg-fixtures/data.asc
new/test/assets/gpg-fixtures/data.asc
--- old/test/assets/gpg-fixtures/data.asc 1970-01-01 01:00:00.000000000
+0100
+++ new/test/assets/gpg-fixtures/data.asc 2017-06-05 03:10:16.000000000
+0200
@@ -0,0 +1,9 @@
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1
+
+iJwEAAECAAYFAlcFOD8ACgkQZeg+SWTDcLNIswP/XvVRoJ+eQ2u2v+WjXdBBKBSW
+pzM216aJPRBxPl98xNUUKjqga+tjKmIHJn5T4CIxHqis1toPxtE5tKnc6cVO1aqY
+bCUfkWyt/A3qRHQuniRUWSBKZWdk+j3AopTpd3i/r/s0pDj3bMHJ7bDOTsEskNcM
+KpgFfNM1ieFRQmIWPWg=
+=kbKc
+-----END PGP SIGNATURE-----
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/test/assets/gpg-fixtures/data.invalid.asc
new/test/assets/gpg-fixtures/data.invalid.asc
--- old/test/assets/gpg-fixtures/data.invalid.asc 1970-01-01
01:00:00.000000000 +0100
+++ new/test/assets/gpg-fixtures/data.invalid.asc 2017-06-05
03:10:16.000000000 +0200
@@ -0,0 +1,9 @@
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1
+
+iJwEAQECAAYFAlcFLEgACgkQZeg+SWTDcLPVwgQAg8KTI91Ryx38YplzgWV9tUPj
+o7J7IEzb8faE7m2mgtq8m62DvA4h/PJzmbh1EJJ4VkO+A4O2LVh/bTgnyYXv+kMu
+sEmvK35PnAC8r7pv98VSbMEXyV/rK3+uGhTvnXZYkULvMVYkN/EHIh2bCQJ3R14X
+MY8El95QST8/dR/yBkw=
+=qbod
+-----END PGP SIGNATURE-----
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/test/assets/test-cmake-1.0/CMakeLists.txt
new/test/assets/test-cmake-1.0/CMakeLists.txt
--- old/test/assets/test-cmake-1.0/CMakeLists.txt 1970-01-01
01:00:00.000000000 +0100
+++ new/test/assets/test-cmake-1.0/CMakeLists.txt 2017-06-05
03:10:16.000000000 +0200
@@ -0,0 +1,7 @@
+# CMakeLists files in this project can
+# refer to the root source directory of the project as ${HELLO_SOURCE_DIR} and
+# to the root binary directory of the project as ${HELLO_BINARY_DIR}.
+cmake_minimum_required (VERSION 2.8.7)
+project (HELLO)
+add_executable (hello hello.c)
+install (TARGETS hello DESTINATION bin)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/test/assets/test-cmake-1.0/hello.c
new/test/assets/test-cmake-1.0/hello.c
--- old/test/assets/test-cmake-1.0/hello.c 1970-01-01 01:00:00.000000000
+0100
+++ new/test/assets/test-cmake-1.0/hello.c 2017-06-05 03:10:16.000000000
+0200
@@ -0,0 +1,4 @@
+int main(int argc, char** argv)
+{
+ return 0 ;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/test/helper.rb new/test/helper.rb
--- old/test/helper.rb 2016-01-06 20:10:15.000000000 +0100
+++ new/test/helper.rb 2017-06-05 03:10:16.000000000 +0200
@@ -37,11 +37,11 @@
end
end
- def create_tar(tar_path, assets_path)
+ def create_tar(tar_path, assets_path, directory)
FileUtils.mkdir_p(File.dirname(tar_path))
Zlib::GzipWriter.open(tar_path) do |fdtgz|
Dir.chdir(assets_path) do
- Archive::Tar::Minitar.pack("test mini portile-1.0.0", fdtgz)
+ Archive::Tar::Minitar.pack(directory, fdtgz)
end
end
end
@@ -49,4 +49,12 @@
def work_dir(r=recipe)
"tmp/#{r.host}/ports/#{r.name}/#{r.version}/#{r.name}-#{r.version}"
end
+
+ def with_custom_git_dir(dir)
+ old = ENV['GIT_DIR']
+ ENV['GIT_DIR'] = dir
+ yield
+ ensure
+ ENV['GIT_DIR'] = old
+ end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/test/test_cmake.rb new/test/test_cmake.rb
--- old/test/test_cmake.rb 1970-01-01 01:00:00.000000000 +0100
+++ new/test/test_cmake.rb 2017-06-05 03:10:16.000000000 +0200
@@ -0,0 +1,64 @@
+require File.expand_path('../helper', __FILE__)
+
+class TestCMake < TestCase
+ attr_accessor :assets_path, :tar_path, :recipe
+
+ def before_all
+ super
+ return if MiniPortile.windows?
+
+ @assets_path = File.expand_path("../assets", __FILE__)
+ @tar_path = File.expand_path("../../tmp/test-cmake-1.0.tar.gz", __FILE__)
+
+ # remove any previous test files
+ FileUtils.rm_rf("tmp")
+
+ create_tar(@tar_path, @assets_path, "test-cmake-1.0")
+ start_webrick(File.dirname(@tar_path))
+
+ @recipe = MiniPortileCMake.new("test-cmake", "1.0").tap do |recipe|
+ recipe.files <<
"http://localhost:#{HTTP_PORT}/#{ERB::Util.url_encode(File.basename(@tar_path))}"
+ recipe.patch_files << File.join(@assets_path, "patch 1.diff")
+ recipe.configure_options << "--option=\"path with 'space'\""
+ git_dir = File.join(@assets_path, "git")
+ with_custom_git_dir(git_dir) do
+ recipe.cook
+ end
+ end
+ end
+
+ def after_all
+ super
+ return if MiniPortile.windows?
+
+ stop_webrick
+ # leave test files for inspection
+ end
+
+ def test_cmake_inherits_from_base
+ assert(MiniPortileCMake <= MiniPortile)
+ end
+
+ def test_configure
+ skip if MiniPortile.windows?
+
+ cmakecache = File.join(work_dir, "CMakeCache.txt")
+ assert File.exist?(cmakecache), cmakecache
+
+ assert_includes(IO.read(cmakecache),
"CMAKE_INSTALL_PREFIX:PATH=#{recipe.path}")
+ end
+
+ def test_compile
+ skip if MiniPortile.windows?
+
+ binary = File.join(work_dir, "hello")
+ assert File.exist?(binary), binary
+ end
+
+ def test_install
+ skip if MiniPortile.windows?
+
+ binary = File.join(recipe.path, "bin", "hello")
+ assert File.exist?(binary), binary
+ end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/test/test_cook.rb new/test/test_cook.rb
--- old/test/test_cook.rb 2016-01-06 20:10:15.000000000 +0100
+++ new/test/test_cook.rb 2017-06-05 03:10:16.000000000 +0200
@@ -3,23 +3,14 @@
class TestCook < TestCase
attr_accessor :assets_path, :tar_path, :recipe
- def with_custom_git_dir(dir)
- old = ENV['GIT_DIR']
- ENV['GIT_DIR'] = dir
- yield
- ensure
- ENV['GIT_DIR'] = old
- end
-
def before_all
super
@assets_path = File.expand_path("../assets", __FILE__)
@tar_path = File.expand_path("../../tmp/test mini portile-1.0.0.tar.gz",
__FILE__)
- # remove any previous test files
- FileUtils.rm_rf("tmp")
+ FileUtils.rm_rf("tmp") # remove any previous test files
- create_tar(@tar_path, @assets_path)
+ create_tar(@tar_path, @assets_path, "test mini portile-1.0.0")
start_webrick(File.dirname(@tar_path))
@recipe = MiniPortile.new("test mini portile", "1.0.0").tap do |recipe|
@@ -36,7 +27,7 @@
def after_all
super
stop_webrick
- # leave test files for inspection
+ FileUtils.rm_rf("tmp") # remove test files
end
def test_download
@@ -75,3 +66,50 @@
assert_equal( ["install"].inspect, IO.read(txt).chomp )
end
end
+
+class TestCookWithBrokenGitDir < TestCase
+ #
+ # this is a test for #69
+ # https://github.com/flavorjones/mini_portile/issues/69
+ #
+ attr_accessor :assets_path, :tar_path, :recipe
+
+ def before_all
+ super
+ @assets_path = File.expand_path("../assets", __FILE__)
+ @tar_path = File.expand_path("../../tmp/test-mini-portile-1.0.0.tar.gz",
__FILE__)
+
+ @git_dir = File.join(@assets_path, "git-broken")
+ FileUtils.rm_rf @git_dir
+ FileUtils.mkdir_p @git_dir
+ Dir.chdir(@git_dir) do
+ File.open ".git", "w" do |f|
+ f.write "gitdir: /nonexistent"
+ end
+ end
+
+ create_tar(@tar_path, @assets_path, "test mini portile-1.0.0")
+
+ @recipe = MiniPortile.new("test mini portile", "1.0.0").tap do |recipe|
+ recipe.files << "file://#{@tar_path}"
+ recipe.patch_files << File.join(@assets_path, "patch 1.diff")
+ recipe.configure_options << "--option=\"path with 'space'\""
+ end
+
+ Dir.chdir(@git_dir) do
+ @recipe.cook
+ end
+ end
+
+ def after_all
+ FileUtils.rm_rf @git_dir
+ end
+
+ def test_patch
+ Dir.chdir(@git_dir) do
+ patch1 = File.join(work_dir, "patch 1.txt")
+ assert File.exist?(patch1), patch1
+ assert_match( /^\tchange 1/, IO.read(patch1) )
+ end
+ end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/test/test_digest.rb new/test/test_digest.rb
--- old/test/test_digest.rb 2016-01-06 20:10:15.000000000 +0100
+++ new/test/test_digest.rb 2017-06-05 03:10:16.000000000 +0200
@@ -11,11 +11,12 @@
# remove any previous test files
FileUtils.rm_rf("tmp")
- create_tar(@tar_path, @assets_path)
+ create_tar(@tar_path, @assets_path, "test mini portile-1.0.0")
start_webrick(File.dirname(@tar_path))
end
def after_all
+ super
stop_webrick
# leave test files for inspection
end
@@ -65,5 +66,150 @@
def test_wrong_md5
download_with_wrong_digest(:md5)
end
+
+ def public_key
+ <<-KEY
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+Version: GnuPG v1
+
+mI0EVwUhJQEEAMYxFhgaAdM2Ul5r+XfpqAaI7SOxB14eRjhFjhchy4ylgVxetyLq
+di3zeANXBIHsLBl7quYTlnmhJr/+GQRkCnXWiUp0tJsBVzGM3puK7c534gakEUH6
+AlDtj5p3IeygzSyn8u7KORv+ainXfhwkvTO04mJmxAb2uT8ngKYFdPa1ABEBAAG0
+J1Rlc3QgTWluaXBvcnRpbGUgPHRlc3RAbWluaXBvcnRpbGUub3JnPoi4BBMBAgAi
+BQJXBSElAhsDBgsJCAcDAgYVCAIJCgsEFgIDAQIeAQIXgAAKCRBl6D5JZMNwswAK
+A/90Cdb+PX21weBR2Q6uR06M/alPexuXXyJL8ZcwbQMJ/pBBgcS5/h1+rQkBI/CN
+qpXdDlw2Xys2k0sNwdjIw3hmYRzBrddXlCSW3Sifq/hS+kfPZ1snQmIjCgy1Xky5
+QGCcPUxBUxzmra88LakkDO+euKK3hcrfeFIi611lTum1NLiNBFcFISUBBADoyY6z
+2PwH3RWUbqv0VX1s3/JO3v3xMjCRKPlFwsNwLTBtZoWfR6Ao1ajeCuZKfzNKIQ2I
+rn86Rcqyrq4hTj+7BTWjkIPOBthjiL1YqbEBtX7jcYRkYvdQz/IG2F4zVV6X4AAR
+Twx7qaXNt67ArzbHCe5gLNRUK6e6OArkahMv7QARAQABiJ8EGAECAAkFAlcFISUC
+GwwACgkQZeg+SWTDcLNFiwP/TR33ClqWOz0mpjt0xPEoZ0ORmV6fo4sjjzgQoHH/
+KTdsabJbGp8oLQGW/mx3OxgbsAkyZymb5H5cjaF4HtSd4cxI5t1C9ZS/ytN8pqfR
+e29SBje8DAAJn2l57s2OddXLPQ0DUwCcdNEaqgHwSk/Swxc7K+IpfvjLKHKUZZBP
+4Ko=
+=SVWi
+-----END PGP PUBLIC KEY BLOCK-----
+KEY
+ end
+
+ def test_with_valid_gpg_signature
+ data_file = File.expand_path(File.join(File.dirname(__FILE__), 'assets',
'gpg-fixtures', 'data'))
+
+ @recipe.files << {
+ :url => "file://#{data_file}",
+ :gpg => {
+ :key => public_key,
+ :signature_url => "file://#{data_file}.asc"
+ }
+ }
+ @recipe.download
+ end
+
+ def test_optional_gpg_signature_url
+ data_file = File.expand_path(File.join(File.dirname(__FILE__), 'assets',
'gpg-fixtures', 'data'))
+
+ @recipe.files << {
+ :url => "file://#{data_file}",
+ :gpg => {
+ :key => public_key
+ }
+ }
+ @recipe.download
+ end
+
+ def test_with_invalid_gpg_signature
+ data_file = File.expand_path(File.join(File.dirname(__FILE__), 'assets',
'gpg-fixtures', 'data'))
+
+ @recipe.files << {
+ :url => "file://#{data_file}",
+ :gpg => {
+ :key => public_key,
+ :signature_url => "file://#{data_file}.invalid.asc"
+ }
+ }
+ exception = assert_raises(RuntimeError){
+ @recipe.download
+ }
+ assert_equal("signature mismatch", exception.message)
+ end
+
+ def test_with_invalid_key
+ data_file = File.expand_path(File.join(File.dirname(__FILE__), 'assets',
'gpg-fixtures', 'data'))
+
+ @recipe.files << {
+ :url => "file://#{data_file}",
+ :gpg => {
+ :key => "thisisaninvalidkey",
+ :signature_url => "file://#{data_file}.asc"
+ }
+ }
+ exception = assert_raises(RuntimeError){ @recipe.download }
+ assert_equal("invalid gpg key provided", exception.message)
+ end
+
+ def test_with_different_key_than_one_used_to_sign
+ puts "################"
+
+ key = <<-KEY
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+Version: GnuPG v1
+
+mQENBE7SKu8BCADQo6x4ZQfAcPlJMLmL8zBEBUS6GyKMMMDtrTh3Yaq481HB54oR
+0cpKL05Ff9upjrIzLD5TJUCzYYM9GQOhguDUP8+ZU9JpSz3yO2TvH7WBbUZ8FADf
+hblmmUBLNgOWgLo3W+FYhl3mz1GFS2Fvid6Tfn02L8CBAj7jxbjL1Qj/OA/WmLLc
+m6BMTqI7IBlYW2vyIOIHasISGiAwZfp0ucMeXXvTtt14LGa8qXVcFnJTdwbf03AS
+ljhYrQnKnpl3VpDAoQt8C68YCwjaNJW59hKqWB+XeIJ9CW98+EOAxLAFszSyGanp
+rCqPd0numj9TIddjcRkTA/ZbmCWK+xjpVBGXABEBAAG0IU1heGltIERvdW5pbiA8
+bWRvdW5pbkBtZG91bmluLnJ1PohGBBARAgAGBQJO01Y/AAoJEOzw6QssFyCDVyQA
+n3qwTZlcZgyyzWu9Cs8gJ0CXREaSAJ92QjGLT9DijTcbB+q9OS/nl16Z/IhGBBAR
+AgAGBQJO02JDAAoJEKk3YTmlJMU+P64AnjCKEXFelSVMtgefJk3+vpyt3QX1AKCH
+9M3MbTWPeDUL+MpULlfdyfvjj4heBBARCAAGBQJRCTwgAAoJEFGFCWhsfl6CzF0B
+AJsQ3DJbtGcZ+0VIcM2a06RRQfBvIHqm1A/1WSYmObLGAP90lxWlNjSugvUUlqTk
+YEEgRTGozgixSyMWGJrNwqgMYokBOAQTAQIAIgUCTtIq7wIbAwYLCQgHAwIGFQgC
+CQoLBBYCAwECHgECF4AACgkQUgqZk6HAUvj+iwf/b4FS6zVzJ5T0v1vcQGD4ZzXe
+D5xMC4BJW414wVMU15rfX7aCdtoCYBNiApPxEd7SwiyxWRhRA9bikUq87JEgmnyV
+0iYbHZvCvc1jOkx4WR7E45t1Mi29KBoPaFXA9X5adZkYcOQLDxa2Z8m6LGXnlF6N
+tJkxQ8APrjZsdrbDvo3HxU9muPcq49ydzhgwfLwpUs11LYkwB0An9WRPuv3jporZ
+/XgI6RfPMZ5NIx+FRRCjn6DnfHboY9rNF6NzrOReJRBhXCi6I+KkHHEnMoyg8XET
+9lVkfHTOl81aIZqrAloX3/00TkYWyM2zO9oYpOg6eUFCX/Lw4MJZsTcT5EKVxIkC
+HAQQAQIABgUCVJ1r4wAKCRDrF/Z0x5pAovwnD/9m8aiSDoUo9IbDSx0345a7IsmN
+KlEqtz4AQxbqxXV3yTANBbhWWnsX6e7PLbJfzpNE9aoa72upwTcStpk6vlPea0AV
+ed83FdVsfxwXm/Sf5iySZKy93PexAZfw7KvXu0ETWxi1YZjFNtNsdUIiuJ4upLNo
+h3urG8NC9uIQYgZef9NPTztmj77saerUrdXt3PQmnYp8ti0NWElE3KzgjoC1fIEZ
+Na4LZSbEnzdadtuWDehQs1JFxuX/lZhHuVdKgagaMn35j4xubDgy6S9iqRsgJ2Jo
+U5o/4B+n5h53uAek4eXAEi0MX3k3RxgAf+ofKiri+oG6zIZcoSpUzj+bOUtVSZwt
+3lsOahDNx5Hd+Atx9iZsylqa/l9iowb+lHfzFAx/58jFhBumn69rNpe9JnJa+vCb
+YIsKTiKoJirFSGEgAkcTVXAvo/aD+XiWzc/QP/l+B2X4e5mqR7dF7xLZ5uFbXA0j
+AfWMyBtvy/XwBT1SxROXpmCt7J0C9wX5l+3vmTpo6BH6S78BYM+eN/NNZW6eJwAG
+km0y3hI1um7pwmzsaE9Pi1xCYEhn6lcLrwPaGXUBCeoTDnO47mrBMAFOmSe8uoRf
+6nYd/TPvXV2Zw0YhjvBzlIfkl5MlJ+j4AZy1hn7Mqe1O//bRd0KKLjjhMQ6tjR6Y
+sbUJgKqfgA+W9qxUcLkBDQRO0irvAQgA0LjCc8S6oZzjiap2MjRNhRFA5BYjXZRZ
+BdKF2VP74avt2/RELq8GW0n7JWmKn6vvrXabEGLyfkCngAhTq9tJ/K7LPx/bmlO5
++jboO/1inH2BTtLiHjAXvicXZk3oaZt2Sotx5mMI3yzpFQRVqZXsi0LpUTPJEh3o
+S8IdYRjslQh1A7P5hfCZwtzwb/hKm8upODe/ITUMuXeWfLuQj/uEU6wMzmfMHb+j
+lYMWtb+v98aJa2FODeKPmWCXLa7bliXp1SSeBOEfIgEAmjM6QGlDx5sZhr2Ss2xS
+PRdZ8DqD7oiRVzmstX1YoxEzC0yXfaefC7SgM0nMnaTvYEOYJ9CH3wARAQABiQEf
+BBgBAgAJBQJO0irvAhsMAAoJEFIKmZOhwFL4844H/jo8icCcS6eOWvnen7lg0FcC
+o1fIm4wW3tEmkQdchSHECJDq7pgTloN65pwB5tBoT47cyYNZA9eTfJVgRc74q5ce
+xKOYrMC3KuAqWbwqXhkVs0nkWxnOIidTHSXvBZfDFA4Idwte94Thrzf8Pn8UESud
+TiqrWoCBXk2UyVsl03gJblSJAeJGYPPeo+Yj6m63OWe2+/S2VTgmbPS/RObn0Aeg
+7yuff0n5+ytEt2KL51gOQE2uIxTCawHr12PsllPkbqPk/PagIttfEJqn9b0CrqPC
+3HREePb2aMJ/Ctw/76COwn0mtXeIXLCTvBmznXfaMKllsqbsy2nCJ2P2uJjOntw=
+=4JAR
+-----END PGP PUBLIC KEY BLOCK-----
+KEY
+
+ data_file = File.expand_path(File.join(File.dirname(__FILE__), 'assets',
'gpg-fixtures', 'data'))
+
+ @recipe.files << {
+ :url => "file://#{data_file}",
+ :gpg => {
+ :key => key,
+ :signature_url => "file://#{data_file}.asc"
+ }
+ }
+ exception = assert_raises(RuntimeError){ @recipe.download }
+ assert_equal("signature mismatch", exception.message)
+ end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/test/test_download.rb new/test/test_download.rb
--- old/test/test_download.rb 2016-01-06 20:10:15.000000000 +0100
+++ new/test/test_download.rb 2017-06-05 03:10:16.000000000 +0200
@@ -1,28 +1,28 @@
require File.expand_path('../helper', __FILE__)
-cert_name = [['CN', 'localhost', OpenSSL::ASN1::PRINTABLESTRING]]
-
describe "recipe download" do
include Minitest::Hooks
attr :recipe
- def server_must_receive_connection &block
+ def server_must_receive_connection(connections = 3, &block)
request_count = 0
server = TCPServer.open('localhost', TestCase::HTTP_PORT)
thread = Thread.new do
- conn = server.accept
- request_count += 1
- conn.puts "CONNECTION SUCESSFULLY MADE"
- conn.close
+ connections.times do
+ conn = server.accept
+ request_count += 1
+ conn.puts "CONNECTION SUCESSFULLY MADE" rescue SystemCallError
+ conn.close
+ end
end
block.call
thread.kill
server.close
-
+
request_count.must_be :>, 0
end
@@ -34,21 +34,21 @@
describe "urls" do
it "ftp" do
@recipe.files << "ftp://localhost:#{TestCase::HTTP_PORT}/foo"
- server_must_receive_connection do
+ server_must_receive_connection 1 do
@recipe.download
end
end
it "handles http" do
@recipe.files << "http://localhost:#{TestCase::HTTP_PORT}/foo"
- server_must_receive_connection do
+ server_must_receive_connection 3 do
@recipe.download
end
end
it "handles https" do
@recipe.files << "https://localhost:#{TestCase::HTTP_PORT}/foo"
- server_must_receive_connection do
+ server_must_receive_connection 3 do
@recipe.download
end
end
@@ -67,5 +67,5 @@
@recipe.files << "foo://foo"
proc { @recipe.download }.must_raise ArgumentError
end
- end
+ end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/test/test_proxy.rb new/test/test_proxy.rb
--- old/test/test_proxy.rb 2016-01-06 20:10:15.000000000 +0100
+++ new/test/test_proxy.rb 2017-06-05 03:10:16.000000000 +0200
@@ -10,7 +10,7 @@
s = gs.accept
gs.close
begin
- req = ''
+ req = ''.dup
while (l=s.gets) && !l.chomp.empty?
req << l
end
@@ -25,7 +25,7 @@
else
yield "http://localhost:#{gs.addr[1]}"
end
-
+
# Set timeout for reception of the request
Thread.new do
sleep 1