Hello community,
here is the log from the commit of package rubygem-mini_portile2 for
openSUSE:Factory checked in at 2016-04-07 13:27:21
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-mini_portile2 (Old)
and /work/SRC/openSUSE:Factory/.rubygem-mini_portile2.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-mini_portile2"
Changes:
--------
---
/work/SRC/openSUSE:Factory/rubygem-mini_portile2/rubygem-mini_portile2.changes
2015-12-27 01:56:51.000000000 +0100
+++
/work/SRC/openSUSE:Factory/.rubygem-mini_portile2.new/rubygem-mini_portile2.changes
2016-04-07 13:27:23.000000000 +0200
@@ -1,0 +2,18 @@
+Thu Jan 21 05:39:40 UTC 2016 - [email protected]
+
+- updated to version 2.1.0
+ see installed CHANGELOG.md
+
+ ### 2.1.0 / 2016-01-06
+
+ #### Enhancements
+
+ * Add support for `file:` protocol for tarballs
+
+
+ #### Bugfixes
+
+ * Raise exception on unsupported URI protocols
+ * Ignore git whitespace config when patching (Thanks, @e2!) (#67)
+
+-------------------------------------------------------------------
Old:
----
mini_portile2-2.0.0.gem
New:
----
mini_portile2-2.1.0.gem
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ rubygem-mini_portile2.spec ++++++
--- /var/tmp/diff_new_pack.xnjURh/_old 2016-04-07 13:27:24.000000000 +0200
+++ /var/tmp/diff_new_pack.xnjURh/_new 2016-04-07 13:27:24.000000000 +0200
@@ -1,7 +1,7 @@
#
# spec file for package rubygem-mini_portile2
#
-# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2016 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.0.0
+Version: 2.1.0
Release: 0
%define mod_name mini_portile2
%define mod_full_name %{mod_name}-%{version}
++++++ mini_portile2-2.0.0.gem -> mini_portile2-2.1.0.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/.gitignore new/.gitignore
--- old/.gitignore 2015-11-30 06:34:40.000000000 +0100
+++ new/.gitignore 2016-01-06 20:10:15.000000000 +0100
@@ -1,3 +1,5 @@
pkg
tmp
Gemfile.lock
+.bundle
+ports
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/.travis.yml new/.travis.yml
--- old/.travis.yml 2015-11-30 06:34:40.000000000 +0100
+++ new/.travis.yml 2016-01-06 20:10:15.000000000 +0100
@@ -7,5 +7,5 @@
- 2.1
- 2.2
- ruby-head
- - jruby-1.7.22
- - jruby-9.0.1.0
+ - jruby-1.7.23
+ - jruby-9.0.4.0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/CHANGELOG.md new/CHANGELOG.md
--- old/CHANGELOG.md 2015-11-30 06:34:40.000000000 +0100
+++ new/CHANGELOG.md 2016-01-06 20:10:15.000000000 +0100
@@ -1,3 +1,16 @@
+### 2.1.0 / 2016-01-06
+
+#### Enhancements
+
+* Add support for `file:` protocol for tarballs
+
+
+#### Bugfixes
+
+* Raise exception on unsupported URI protocols
+* Ignore git whitespace config when patching (Thanks, @e2!) (#67)
+
+
### 2.0.0 / 2015-11-30
Many thanks to @larskanis, @knu, and @kirikak2, who all contributed
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/LICENSE.txt new/LICENSE.txt
--- old/LICENSE.txt 2015-11-30 06:34:40.000000000 +0100
+++ new/LICENSE.txt 2016-01-06 20:10:15.000000000 +0100
@@ -1,4 +1,4 @@
-Copyright (c) 2011-2015 Luis Lavena and Mike Dalessio
+Copyright (c) 2011-2016 Luis Lavena and Mike Dalessio
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/examples/.gitignore new/examples/.gitignore
--- old/examples/.gitignore 2015-11-30 06:34:40.000000000 +0100
+++ new/examples/.gitignore 1970-01-01 01:00:00.000000000 +0100
@@ -1,2 +0,0 @@
-ports
-tmp
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/examples/Rakefile new/examples/Rakefile
--- old/examples/Rakefile 2015-11-30 06:34:40.000000000 +0100
+++ new/examples/Rakefile 1970-01-01 01:00:00.000000000 +0100
@@ -1,127 +0,0 @@
-require 'rbconfig'
-
-$: << File.expand_path(File.join(File.dirname(__FILE__), "../lib"))
-require "mini_portile2"
-
-recipes = []
-
-def windows?
- RbConfig::CONFIG['target_os'] =~ /mswin|mingw32/
-end
-
-# libiconv
-libiconv = MiniPortile.new "libiconv", "1.14"
-libiconv.files <<
"ftp://ftp.gnu.org/pub/gnu/#{libiconv.name}/#{libiconv.name}-#{libiconv.version}.tar.gz"
-unless windows?
- libiconv.patch_files = Dir["libiconv-patches/*.patch"].map { |dir|
File.expand_path dir }
-end
-
-recipes.push libiconv
-
-# sqlite3
-sqlite3 = MiniPortile.new "sqlite3", "3.8.4.1"
-sqlite3.files << "http://sqlite.org/2014/sqlite-autoconf-3080401.tar.gz"
-
-recipes.push sqlite3
-
-# c-ares
-c_ares = MiniPortile.new "c-ares", "1.7.5"
-c_ares.files <<
"http://distfiles.openknapsack.org/#{c_ares.name}/#{c_ares.name}-#{c_ares.version}.tar.gz"
-
-recipes.push c_ares
-
-# zlib
-class ZlibRecipe < MiniPortile
- def windows?
- !(host =~ /mswin|mingw/).nil?
- end
-
- def configure
- return super unless windows?
-
- Dir.chdir work_path do
- mk = File.read 'win32/Makefile.gcc'
- File.open 'win32/Makefile.gcc', 'wb' do |f|
- f.puts "BINARY_PATH = #{path}/bin"
- f.puts "LIBRARY_PATH = #{path}/lib"
- f.puts "INCLUDE_PATH = #{path}/include"
-
- cross_build? and
- mk.sub!(/^PREFIX\s*=\s*$/, "PREFIX = #{host}-")
-
- f.puts mk
- end
- end
- end
-
- def configure_defaults
- ["--static"]
- end
-
- def configured?
- return super unless windows?
-
- !!(File.read(File.join(work_path, 'win32/Makefile.gcc')) =~ /^BINARY_PATH/)
- end
-
- def compile
- return super unless windows?
-
- execute "compile", "make -f win32/Makefile.gcc"
- end
-
- def install
- return if installed?
- return super unless windows?
-
- execute "install", %Q(#{make_cmd} -f win32/Makefile.gcc install)
- end
-
- def cross_build?
- host != original_host
- end
-end
-
-zlib = ZlibRecipe.new "zlib", "1.2.8"
-zlib.files << {
- url: "http://zlib.net/#{zlib.name}-#{zlib.version}.tar.gz",
- md5: "44d667c142d7cda120332623eab69f40",
-}
-
-
-recipes.push zlib
-
-namespace :ports do
- directory "ports"
-
- recipes.each do |recipe|
- desc "Install port #{recipe.name} #{recipe.version}"
- task recipe.name => ["ports"] do |t|
- checkpoint =
"ports/.#{recipe.name}-#{recipe.version}-#{recipe.host}.installed"
-
- unless File.exist?(checkpoint)
- recipe.cook
- touch checkpoint
- end
-
- recipe.activate
- end
-
- task :all => recipe.name
- end
-
- desc "Install all ports and display installation location"
- task :all do
- recipes.each do |recipe|
- puts "Artifacts of '#{recipe.name}' in '#{recipe.path}'"
- end
- puts "LDFLAGS: " << ENV['LDFLAGS'].inspect
- end
-end
-
-desc "Adjust all recipes host for cross-compilation"
-task :cross do
- recipes.each do |recipe|
- recipe.host = "i686-w64-mingw32"
- end
-end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/examples/libiconv-patches/1-avoid-gets-error.patch
new/examples/libiconv-patches/1-avoid-gets-error.patch
--- old/examples/libiconv-patches/1-avoid-gets-error.patch 2015-11-30
06:34:40.000000000 +0100
+++ new/examples/libiconv-patches/1-avoid-gets-error.patch 1970-01-01
01:00:00.000000000 +0100
@@ -1,16 +0,0 @@
-This file tests the 'patch' functionality, as well as working around a
-libiconv compilation issue with glibc >= 2.16.
-
---- a/srclib/stdio.in.h 2015-08-23 13:59:57.395880263 -0400
-+++ b/srclib/stdio.in.h 2015-08-23 14:00:00.047880153 -0400
-@@ -695,8 +695,10 @@
- /* It is very rare that the developer ever has full control of stdin,
- so any use of gets warrants an unconditional warning. Assume it is
- always declared, since it is required by C89. */
-+#if defined(__GLIBC__) && !defined(__UCLIBC__) && !__GLIBC_PREREQ(2, 16)
- _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
- #endif
-+#endif
-
-
- #if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@
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 2015-11-30 06:34:40.000000000
+0100
+++ new/lib/mini_portile2/mini_portile.rb 2016-01-06 20:10:15.000000000
+0100
@@ -68,7 +68,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", file],
:initial_message => false)
+ execute('patch', ["git", "--work-tree=.", "apply",
"--whitespace=warn", file], :initial_message => false)
}
when which('patch')
lambda { |file|
@@ -393,18 +393,20 @@
def download_file(url, full_path, count = 3)
return if File.exist?(full_path)
uri = URI.parse(url)
- begin
- case uri.scheme.downcase
- when /ftp/
- download_file_ftp(uri, full_path)
- when /http|https/
- download_file_http(url, full_path, count)
- end
- rescue Exception => e
- File.unlink full_path if File.exist?(full_path)
- output "ERROR: #{e.message}"
- raise "Failed to complete download task"
+
+ case uri.scheme.downcase
+ when /ftp/
+ download_file_ftp(uri, full_path)
+ when /http|https/
+ download_file_http(url, full_path, count)
+ when /file/
+ download_file_file(uri, full_path)
+ else
+ raise ArgumentError.new("Unsupported protocol for #{url}")
end
+ rescue Exception => e
+ File.unlink full_path if File.exist?(full_path)
+ raise e
end
def download_file_http(url, full_path, count = 3)
@@ -448,6 +450,11 @@
end
end
+ def download_file_file(uri, full_path)
+ FileUtils.mkdir_p File.dirname(full_path)
+ FileUtils.cp uri.path, full_path
+ end
+
def download_file_ftp(uri, full_path)
filename = File.basename(uri.path)
with_tempfile(filename, full_path) do |temp_file|
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 2015-11-30 06:34:40.000000000 +0100
+++ new/lib/mini_portile2/version.rb 2016-01-06 20:10:15.000000000 +0100
@@ -1,3 +1,3 @@
class MiniPortile
- VERSION = "2.0.0"
+ VERSION = "2.1.0"
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata 2015-11-30 06:34:40.000000000 +0100
+++ new/metadata 2016-01-06 20:10:15.000000000 +0100
@@ -1,7 +1,7 @@
--- !ruby/object:Gem::Specification
name: mini_portile2
version: !ruby/object:Gem::Version
- version: 2.0.0
+ version: 2.1.0
platform: ruby
authors:
- Luis Lavena
@@ -10,7 +10,7 @@
autorequire:
bindir: bin
cert_chain: []
-date: 2015-11-30 00:00:00.000000000 Z
+date: 2016-01-06 00:00:00.000000000 Z
dependencies:
- !ruby/object:Gem::Dependency
name: bundler
@@ -41,19 +41,33 @@
- !ruby/object:Gem::Version
version: '10.0'
- !ruby/object:Gem::Dependency
- name: test-unit
+ name: minitest
requirement: !ruby/object:Gem::Requirement
requirements:
- - "~>"
- !ruby/object:Gem::Version
- version: '3.0'
+ version: 5.8.0
type: :development
prerelease: false
version_requirements: !ruby/object:Gem::Requirement
requirements:
- - "~>"
- !ruby/object:Gem::Version
- version: '3.0'
+ version: 5.8.0
+- !ruby/object:Gem::Dependency
+ name: minitest-hooks
+ requirement: !ruby/object:Gem::Requirement
+ requirements:
+ - - "~>"
+ - !ruby/object:Gem::Version
+ version: 1.4.0
+ type: :development
+ prerelease: false
+ version_requirements: !ruby/object:Gem::Requirement
+ requirements:
+ - - "~>"
+ - !ruby/object:Gem::Version
+ version: 1.4.0
- !ruby/object:Gem::Dependency
name: minitar
requirement: !ruby/object:Gem::Requirement
@@ -84,18 +98,18 @@
- README.md
- Rakefile
- appveyor.yml
-- examples/.gitignore
-- examples/Rakefile
-- examples/libiconv-patches/1-avoid-gets-error.patch
- lib/mini_portile2.rb
- lib/mini_portile2/mini_portile.rb
- lib/mini_portile2/version.rb
- mini_portile2.gemspec
+- test/assets/git/config
- test/assets/patch 1.diff
- test/assets/test mini portile-1.0.0/configure
+- test/assets/test-download-archive.tar.gz
- test/helper.rb
- test/test_cook.rb
- test/test_digest.rb
+- test/test_download.rb
- test/test_proxy.rb
homepage: http://github.com/flavorjones/mini_portile
licenses:
@@ -122,12 +136,12 @@
specification_version: 4
summary: Simplistic port-like solution for developers
test_files:
-- examples/.gitignore
-- examples/Rakefile
-- examples/libiconv-patches/1-avoid-gets-error.patch
+- test/assets/git/config
- test/assets/patch 1.diff
- test/assets/test mini portile-1.0.0/configure
+- test/assets/test-download-archive.tar.gz
- test/helper.rb
- test/test_cook.rb
- test/test_digest.rb
+- test/test_download.rb
- test/test_proxy.rb
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/mini_portile2.gemspec new/mini_portile2.gemspec
--- old/mini_portile2.gemspec 2015-11-30 06:34:40.000000000 +0100
+++ new/mini_portile2.gemspec 2016-01-06 20:10:15.000000000 +0100
@@ -17,13 +17,20 @@
spec.licenses = ['MIT']
spec.files = `git ls-files -z`.split("\x0")
+
+ # omit the `examples` directory from the gem, because it's large and
+ # not necessary to be packaged in the gem.
+ example_files = spec.files.grep(%r{^examples/})
+ spec.files -= example_files
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features|examples)/})
spec.require_paths = ["lib"]
spec.add_development_dependency "bundler", "~> 1.7"
spec.add_development_dependency "rake", "~> 10.0"
- spec.add_development_dependency "test-unit", "~> 3.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.required_ruby_version = ">= 1.9.2"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/test/assets/git/config new/test/assets/git/config
--- old/test/assets/git/config 1970-01-01 01:00:00.000000000 +0100
+++ new/test/assets/git/config 2016-01-06 20:10:15.000000000 +0100
@@ -0,0 +1,4 @@
+[core]
+ whitespace=tab-in-indent,-indent-with-non-tab
+[apply]
+ whitespace=fix
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/test/assets/patch 1.diff new/test/assets/patch 1.diff
--- old/test/assets/patch 1.diff 2015-11-30 06:34:40.000000000 +0100
+++ new/test/assets/patch 1.diff 2016-01-06 20:10:15.000000000 +0100
@@ -4,4 +4,4 @@
--- /dev/null
+++ "b/patch 1.txt"
@@ -0,0 +1 @@
-+change 1
++ change 1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/test/assets/test-download-archive.tar.gz
new/test/assets/test-download-archive.tar.gz
--- old/test/assets/test-download-archive.tar.gz 1970-01-01
01:00:00.000000000 +0100
+++ new/test/assets/test-download-archive.tar.gz 2016-01-06
20:10:15.000000000 +0100
@@ -0,0 +1 @@
+TEST FILE
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/test/helper.rb new/test/helper.rb
--- old/test/helper.rb 2015-11-30 06:34:40.000000000 +0100
+++ new/test/helper.rb 2016-01-06 20:10:15.000000000 +0100
@@ -1,4 +1,7 @@
-require 'test/unit'
+require 'minitest/autorun'
+require 'minitest/unit'
+require 'minitest/spec'
+require 'minitest/hooks/test'
require 'webrick'
require 'fileutils'
require 'zlib'
@@ -7,43 +10,43 @@
require 'erb'
require 'mini_portile2'
-class TestCase < Test::Unit::TestCase
- class << self
- HTTP_PORT = 23523
-
- attr_accessor :webrick
-
- def start_webrick(path)
- @webrick = WEBrick::HTTPServer.new(:Port => HTTP_PORT, :DocumentRoot =>
path).tap do |w|
- Thread.new do
- w.start
- end
- until w.status==:Running
- sleep 0.1
- end
+class TestCase < Minitest::Test
+ include Minitest::Hooks
+
+ HTTP_PORT = 23523
+
+ attr_accessor :webrick
+
+ def start_webrick(path)
+ @webrick = WEBrick::HTTPServer.new(:Port => HTTP_PORT, :DocumentRoot =>
path).tap do |w|
+ Thread.new do
+ w.start
+ end
+ until w.status==:Running
+ sleep 0.1
end
end
+ end
- def stop_webrick
- if w=@webrick
- w.shutdown
- until w.status==:Stop
- sleep 0.1
- end
+ def stop_webrick
+ if w=@webrick
+ w.shutdown
+ until w.status==:Stop
+ sleep 0.1
end
end
+ end
- def create_tar(tar_path, assets_path)
- 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)
- end
+ def create_tar(tar_path, assets_path)
+ 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)
end
end
+ end
- def work_dir(r=recipe)
- "tmp/#{r.host}/ports/#{r.name}/#{r.version}/#{r.name}-#{r.version}"
- end
+ def work_dir(r=recipe)
+ "tmp/#{r.host}/ports/#{r.name}/#{r.version}/#{r.name}-#{r.version}"
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 2015-11-30 06:34:40.000000000 +0100
+++ new/test/test_cook.rb 2016-01-06 20:10:15.000000000 +0100
@@ -1,33 +1,42 @@
require File.expand_path('../helper', __FILE__)
class TestCook < TestCase
- class << self
- attr_accessor :assets_path
- attr_accessor :tar_path
- attr_accessor :recipe
-
- def startup
- @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")
-
- create_tar(@tar_path, @assets_path)
- start_webrick(File.dirname(@tar_path))
-
- @recipe = MiniPortile.new("test mini portile", "1.0.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'\""
+ 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")
+
+ create_tar(@tar_path, @assets_path)
+ start_webrick(File.dirname(@tar_path))
+
+ @recipe = MiniPortile.new("test mini portile", "1.0.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 shutdown
- stop_webrick
- # leave test files for inspection
- end
+ def after_all
+ super
+ stop_webrick
+ # leave test files for inspection
end
def test_download
@@ -36,32 +45,32 @@
end
def test_untar
- configure = File.join(self.class.work_dir, "configure")
+ configure = File.join(work_dir, "configure")
assert File.exist?(configure), configure
assert_match( /^#!\/bin\/sh/, IO.read(configure) )
end
def test_patch
- patch1 = File.join(self.class.work_dir, "patch 1.txt")
+ patch1 = File.join(work_dir, "patch 1.txt")
assert File.exist?(patch1), patch1
- assert_match( /^change 1/, IO.read(patch1) )
+ assert_match( /^\tchange 1/, IO.read(patch1) )
end
def test_configure
- txt = File.join(self.class.work_dir, "configure.txt")
+ txt = File.join(work_dir, "configure.txt")
assert File.exist?(txt), txt
- opts = self.class.recipe.configure_options +
["--prefix=#{self.class.recipe.path}"]
+ opts = recipe.configure_options + ["--prefix=#{recipe.path}"]
assert_equal( opts.inspect, IO.read(txt).chomp )
end
def test_compile
- txt = File.join(self.class.work_dir, "compile.txt")
+ txt = File.join(work_dir, "compile.txt")
assert File.exist?(txt), txt
assert_equal( ["all"].inspect, IO.read(txt).chomp )
end
def test_install
- txt = File.join(self.class.work_dir, "install.txt")
+ txt = File.join(work_dir, "install.txt")
assert File.exist?(txt), txt
assert_equal( ["install"].inspect, IO.read(txt).chomp )
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 2015-11-30 06:34:40.000000000 +0100
+++ new/test/test_digest.rb 2016-01-06 20:10:15.000000000 +0100
@@ -1,49 +1,45 @@
require File.expand_path('../helper', __FILE__)
class TestDigest < TestCase
- class << self
- attr_accessor :assets_path
- attr_accessor :tar_path
- attr_accessor :recipe
-
- def startup
- @assets_path = File.expand_path("../assets", __FILE__)
- @tar_path = File.expand_path("../../tmp/test-digest-1.0.0.tar.gz",
__FILE__)
-
- # remove any previous test files
- FileUtils.rm_rf("tmp")
-
- create_tar(@tar_path, @assets_path)
- start_webrick(File.dirname(@tar_path))
- end
-
- def shutdown
- stop_webrick
- # leave test files for inspection
- end
+ attr :assets_path, :tar_path, :recipe
+
+ def before_all
+ super
+ @assets_path = File.expand_path("../assets", __FILE__)
+ @tar_path = File.expand_path("../../tmp/test-digest-1.0.0.tar.gz",
__FILE__)
+
+ # remove any previous test files
+ FileUtils.rm_rf("tmp")
+
+ create_tar(@tar_path, @assets_path)
+ start_webrick(File.dirname(@tar_path))
+ end
+
+ def after_all
+ stop_webrick
+ # leave test files for inspection
end
def setup
- # remove any download files
+ super
FileUtils.rm_rf("ports/archives")
-
@recipe = MiniPortile.new("test-digest", "1.0.0")
end
def download_with_digest(key, klass)
@recipe.files << {
- :url =>
"http://localhost:#{self.class.webrick.config[:Port]}/#{ERB::Util.url_encode(File.basename(self.class.tar_path))}",
- key => klass.file(self.class.tar_path).hexdigest,
+ :url =>
"http://localhost:#{webrick.config[:Port]}/#{ERB::Util.url_encode(File.basename(tar_path))}",
+ key => klass.file(tar_path).hexdigest,
}
@recipe.download
end
def download_with_wrong_digest(key)
@recipe.files << {
- :url =>
"http://localhost:#{self.class.webrick.config[:Port]}/#{ERB::Util.url_encode(File.basename(self.class.tar_path))}",
+ :url =>
"http://localhost:#{webrick.config[:Port]}/#{ERB::Util.url_encode(File.basename(tar_path))}",
key => "0011223344556677",
}
- assert_raise(RuntimeError){ @recipe.download }
+ assert_raises(RuntimeError){ @recipe.download }
end
def test_sha256
@@ -70,3 +66,4 @@
download_with_wrong_digest(:md5)
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 1970-01-01 01:00:00.000000000 +0100
+++ new/test/test_download.rb 2016-01-06 20:10:15.000000000 +0100
@@ -0,0 +1,71 @@
+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
+ 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
+ end
+
+ block.call
+
+ thread.kill
+ server.close
+
+ request_count.must_be :>, 0
+ end
+
+ before do
+ @request_count = 0
+ @recipe = MiniPortile.new("test-download", "1.1.1")
+ end
+
+ describe "urls" do
+ it "ftp" do
+ @recipe.files << "ftp://localhost:#{TestCase::HTTP_PORT}/foo"
+ server_must_receive_connection do
+ @recipe.download
+ end
+ end
+
+ it "handles http" do
+ @recipe.files << "http://localhost:#{TestCase::HTTP_PORT}/foo"
+ server_must_receive_connection do
+ @recipe.download
+ end
+ end
+
+ it "handles https" do
+ @recipe.files << "https://localhost:#{TestCase::HTTP_PORT}/foo"
+ server_must_receive_connection do
+ @recipe.download
+ end
+ end
+
+ it "file" do
+ dest = "ports/archives/test-download-archive.tar.gz"
+ FileUtils.rm_f dest
+ path = File.expand_path(File.join(File.dirname(__FILE__), "assets",
"test-download-archive.tar.gz"))
+ @recipe.files << "file://#{path}"
+ @recipe.download
+ assert File.exist?(dest)
+ Digest::MD5.file(dest).hexdigest.must_equal
"5deffb997041bbb5f11bdcafdbb47975"
+ end
+
+ it "other" do
+ @recipe.files << "foo://foo"
+ proc { @recipe.download }.must_raise ArgumentError
+ end
+ end
+end