autobuild 1.8.3 → 1.9.0.b1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/Manifest.txt +16 -7
  3. data/Rakefile +2 -0
  4. data/lib/autobuild/config.rb +21 -6
  5. data/lib/autobuild/configurable.rb +2 -2
  6. data/lib/autobuild/environment.rb +52 -27
  7. data/lib/autobuild/exceptions.rb +48 -22
  8. data/lib/autobuild/import/archive.rb +37 -16
  9. data/lib/autobuild/import/cvs.rb +26 -28
  10. data/lib/autobuild/import/darcs.rb +9 -8
  11. data/lib/autobuild/import/git.rb +324 -217
  12. data/lib/autobuild/import/hg.rb +6 -9
  13. data/lib/autobuild/import/svn.rb +190 -47
  14. data/lib/autobuild/importer.rb +80 -35
  15. data/lib/autobuild/package.rb +16 -35
  16. data/lib/autobuild/packages/autotools.rb +8 -8
  17. data/lib/autobuild/packages/cmake.rb +18 -12
  18. data/lib/autobuild/packages/genom.rb +1 -1
  19. data/lib/autobuild/packages/gnumake.rb +11 -12
  20. data/lib/autobuild/packages/orogen.rb +1 -1
  21. data/lib/autobuild/packages/ruby.rb +9 -5
  22. data/lib/autobuild/reporting.rb +10 -6
  23. data/lib/autobuild/subcommand.rb +110 -50
  24. data/lib/autobuild/test.rb +104 -0
  25. data/lib/autobuild/timestamps.rb +3 -3
  26. data/lib/autobuild/tools.rb +1 -1
  27. data/lib/autobuild/utility.rb +22 -10
  28. data/lib/autobuild/version.rb +1 -1
  29. data/test/data/gitrepo-with-extra-commit-and-tag.tar +0 -0
  30. data/test/data/gitrepo.tar +0 -0
  31. data/test/data/gitrepo/test +0 -0
  32. data/test/data/gitrepo/test2 +0 -0
  33. data/test/data/gitrepo/test3 +0 -0
  34. data/test/data/svnroot.tar +0 -0
  35. data/test/import/test_cvs.rb +51 -0
  36. data/test/import/test_git.rb +364 -0
  37. data/test/import/test_svn.rb +144 -0
  38. data/test/import/test_tar.rb +76 -0
  39. data/test/suite.rb +7 -0
  40. data/test/test_config.rb +1 -5
  41. data/test/test_environment.rb +88 -0
  42. data/test/test_reporting.rb +2 -14
  43. data/test/test_subcommand.rb +7 -22
  44. metadata +17 -14
  45. data/test/test_import_cvs.rb +0 -59
  46. data/test/test_import_svn.rb +0 -56
  47. data/test/test_import_tar.rb +0 -83
  48. data/test/tools.rb +0 -44
@@ -1,59 +0,0 @@
1
- $LOAD_PATH.unshift File.expand_path('..', File.dirname(__FILE__))
2
- $LOAD_PATH << File.expand_path('../lib', File.dirname(__FILE__))
3
- require 'test/unit'
4
- require 'test/tools'
5
- require 'autobuild/exceptions'
6
- require 'autobuild/import/cvs'
7
-
8
-
9
- class TC_CVSImport < Test::Unit::TestCase
10
- include Autobuild
11
- Package = Struct.new :srcdir, :name
12
-
13
- def setup
14
- Autobuild.logdir = "#{TestTools.tempdir}/log"
15
- FileUtils.mkdir_p(Autobuild.logdir)
16
- end
17
-
18
- def teardown
19
- TestTools.clean
20
- end
21
-
22
- def test_cvs
23
- TestTools.untar('cvsroot.tar')
24
- cvsroot = File.join(TestTools.tempdir, 'cvsroot')
25
- pkg_cvs = Package.new File.join(TestTools.tempdir, 'cvs'), 'cvs'
26
-
27
- # Make a checkout
28
- importer = Autobuild.cvs(cvsroot, 'cvs')
29
- importer.import(pkg_cvs)
30
- assert( File.exists?(File.join(pkg_cvs.srcdir, 'test')) )
31
-
32
- # Make an update
33
- importer.import(pkg_cvs)
34
-
35
- # Make an update fail because the repository does not exist anymore
36
- FileUtils.rm_rf cvsroot
37
- assert_raise(Autobuild::SubcommandFailed) { importer.import pkg_cvs }
38
-
39
- # Make a checkout fail because the repository does not exist anymore
40
- FileUtils.rm_rf pkg_cvs.srcdir
41
- assert_raise(Autobuild::SubcommandFailed) { importer.import pkg_cvs }
42
-
43
- # Recreate the repository, and make a checkout fail because the
44
- # WC is not a CVS WC
45
- TestTools.untar('cvsroot.tar')
46
- FileUtils.mkdir pkg_cvs.srcdir
47
- assert_raise(Autobuild::ConfigException) { importer.import pkg_cvs }
48
-
49
- # Create two repositories, and make the update fail because the
50
- # WC is of the wrong source
51
- FileUtils.rm_rf pkg_cvs.srcdir
52
- importer.import(pkg_cvs)
53
- FileUtils.mv cvsroot, "#{cvsroot}.2"
54
- importer = Autobuild.cvs("#{cvsroot}.2", 'cvs')
55
- assert_raise(Autobuild::ConfigException) { importer.import pkg_cvs }
56
- end
57
- end
58
-
59
-
@@ -1,56 +0,0 @@
1
- $LOAD_PATH.unshift File.expand_path('..', File.dirname(__FILE__))
2
- $LOAD_PATH << File.expand_path('../lib', File.dirname(__FILE__))
3
- require 'test/unit'
4
- require 'test/tools'
5
- require 'autobuild/import/svn'
6
-
7
- class TC_SVNImport < Test::Unit::TestCase
8
- include Autobuild
9
- Package = Struct.new :srcdir, :name
10
-
11
- def setup
12
- Autobuild.logdir = "#{TestTools.tempdir}/log"
13
- FileUtils.mkdir_p(Autobuild.logdir)
14
- end
15
-
16
- def teardown
17
- TestTools.clean
18
- end
19
-
20
- def test_svn
21
- TestTools.untar('svnroot.tar')
22
- svnrepo = File.join(TestTools.tempdir, 'svnroot')
23
- svnroot = "file://#{svnrepo}/svn"
24
- pkg_svn = Package.new File.join(TestTools.tempdir, 'svn'), :svn
25
-
26
- # Make a checkout with a splitted URL
27
- importer = Autobuild.svn(svnroot)
28
- importer.import(pkg_svn)
29
- assert( File.exists?(File.join(pkg_svn.srcdir, 'test')) )
30
-
31
- # Make an update
32
- importer.import(pkg_svn)
33
-
34
- # Make an update fail because the repository does not exist
35
- FileUtils.rm_rf svnrepo
36
- assert_raise(SubcommandFailed) { importer.import(pkg_svn) }
37
-
38
- # Make a checkout fail because the repository does not exist
39
- FileUtils.rm_rf pkg_svn.srcdir
40
- assert_raise(SubcommandFailed) { importer.import(pkg_svn) }
41
-
42
- # Recreate the repository and try to update a non-svn directory
43
- TestTools.untar('svnroot.tar')
44
- FileUtils.mkdir pkg_svn.srcdir
45
- assert_raise(ConfigException) { importer.import(pkg_svn) }
46
-
47
- # Try to update a WC which is of a different repository
48
- FileUtils.rmdir pkg_svn.srcdir
49
- importer.import(pkg_svn)
50
- FileUtils.mv svnrepo, "#{svnrepo}.2"
51
- importer = Autobuild.svn("file://#{svnrepo}.2/svn")
52
- assert_raise(ConfigException) { importer.import(pkg_svn) }
53
- end
54
-
55
- end
56
-
@@ -1,83 +0,0 @@
1
- $LOAD_PATH.unshift File.expand_path('..', File.dirname(__FILE__))
2
- $LOAD_PATH << File.expand_path('../lib', File.dirname(__FILE__))
3
- require 'test/unit'
4
- require 'test/tools'
5
- require 'autobuild/import/cvs'
6
- require 'autobuild/import/svn'
7
- require 'autobuild/import/tar'
8
- require 'webrick'
9
-
10
- include Autobuild
11
-
12
- class TC_TarImporter < Test::Unit::TestCase
13
- include WEBrick
14
- Package = Struct.new :srcdir, :name
15
-
16
- def setup
17
- Autobuild.logdir = "#{TestTools.tempdir}/log"
18
- FileUtils.mkdir_p(Autobuild.logdir)
19
-
20
- @datadir = File.join(TestTools.tempdir, 'data')
21
- FileUtils.mkdir_p(@datadir)
22
- @tarfile = File.join(@datadir, 'tarimport.tar.gz')
23
- FileUtils.cp(File.join(TestTools::DATADIR, 'tarimport.tar.gz'), @tarfile)
24
-
25
- @cachedir = File.join(TestTools.tempdir, 'cache')
26
- end
27
-
28
- def teardown
29
- TestTools.clean
30
- end
31
-
32
- def test_tar_mode
33
- assert_equal(TarImporter::Plain, TarImporter.url_to_mode('tarfile.tar'))
34
- assert_equal(TarImporter::Gzip, TarImporter.url_to_mode('tarfile.tar.gz'))
35
- assert_equal(TarImporter::Bzip, TarImporter.url_to_mode('tarfile.tar.bz2'))
36
- end
37
-
38
- def test_tar_valid_url
39
- assert_raise(ConfigException) {
40
- TarImporter.new 'ccc://localhost/files/tarimport.tar.gz', :cachedir => @cachedir
41
- }
42
- end
43
-
44
- def web_server
45
- s = HTTPServer.new :Port => 2000, :DocumentRoot => TestTools.tempdir
46
- s.mount("/files", HTTPServlet::FileHandler, TestTools.tempdir)
47
- webrick = Thread.new { s.start }
48
-
49
- yield
50
-
51
- ensure
52
- s.shutdown
53
- webrick.join
54
- end
55
-
56
- def test_tar_remote
57
- web_server do
58
- # Try to get the file through the http server
59
- pkg = Package.new File.join(TestTools.tempdir, 'tarimport'), 'tarimport'
60
- importer = TarImporter.new 'http://localhost:2000/files/data/tarimport.tar.gz', :cachedir => @cachedir
61
-
62
- importer.checkout(pkg)
63
- assert(File.directory?(pkg.srcdir))
64
- assert(!importer.update_cache)
65
-
66
- sleep 2 # The Time class have a 1-second resolution
67
- FileUtils.touch @tarfile
68
- assert(importer.update_cache)
69
- assert(!importer.update_cache)
70
- end
71
- end
72
-
73
- def test_tar_remote_notfound
74
- web_server do
75
- # Try to get the file through the http server
76
- pkg = Package.new File.join(TestTools.tempdir, 'tarimport'), 'tarimport'
77
- importer = TarImporter.new 'http://localhost:2000/files/data/tarimport-nofile.tar.gz', :cachedir => @cachedir
78
-
79
- assert_raise(Autobuild::Exception) { importer.checkout(pkg) }
80
- end
81
- end
82
- end
83
-
data/test/tools.rb DELETED
@@ -1,44 +0,0 @@
1
- require 'tmpdir'
2
- require 'erb'
3
- require 'fileutils'
4
-
5
- module TestTools
6
- DATADIR = File.join(File.dirname(__FILE__), 'data')
7
-
8
- def self.tempdir
9
- @tmpdir = File.join(Dir::tmpdir, "/autobuild-test-#{Process.uid}")
10
- FileUtils.mkdir_p(@tmpdir, :mode => 0700)
11
- end
12
-
13
- def self.clean
14
- FileUtils.rm_rf tempdir
15
- end
16
-
17
- def self.build_dummy_config(basedir)
18
- global_prefix = File.join(basedir, 'prefix')
19
-
20
- end
21
-
22
- def self.build_config(bind, template)
23
- eval "basedir = '#{self.tempdir}'", bind
24
- ryml = File.open(File.join(DATADIR, "#{template}.ryml")) { |f| f.readlines }.join('')
25
- result = ERB.new(ryml).result(bind)
26
-
27
- yml = File.join(tempdir, "#{template}.yml")
28
- File.open(yml, 'w+') { |f| f.write(result) }
29
-
30
- return yml
31
- end
32
-
33
- def self.untar(file)
34
- file = File.expand_path(file, DATADIR)
35
- dir = self.tempdir
36
- Dir.chdir(dir) do
37
- system("tar xf #{file}")
38
- end
39
-
40
- dir
41
- end
42
- end
43
-
44
-