autoproj 1.6.0.rc5 → 1.6.0.rc6

Sign up to get free protection for your applications and to get access to all the features.
data/bin/autoproj CHANGED
@@ -13,7 +13,6 @@ require 'autoproj/cmdline'
13
13
  include Autoproj
14
14
 
15
15
  InputError = Autoproj::InputError
16
- selected_packages = Autoproj::CmdLine.parse_arguments(ARGV.dup)
17
16
 
18
17
  def color(*args)
19
18
  Autoproj.console.color(*args)
@@ -28,11 +27,13 @@ def report(debug)
28
27
  rescue ConfigError => e
29
28
  STDERR.puts
30
29
  STDERR.puts color(e.message, :red, :bold)
31
- root_dir = /^#{Regexp.quote(Autoproj.root_dir)}(?!\/\.gems)/
32
- e.backtrace.find_all { |path| path =~ root_dir }.
33
- each do |path|
34
- STDERR.puts color(" in #{path}", :red, :bold)
35
- end
30
+ if Autoproj.in_autoproj_installation?(Dir.pwd)
31
+ root_dir = /^#{Regexp.quote(Autoproj.root_dir)}(?!\/\.gems)/
32
+ e.backtrace.find_all { |path| path =~ root_dir }.
33
+ each do |path|
34
+ STDERR.puts color(" in #{path}", :red, :bold)
35
+ end
36
+ end
36
37
  if debug then raise
37
38
  else exit 1
38
39
  end
@@ -48,6 +49,27 @@ Autoproj::OSDependencies.autodetect_ruby
48
49
 
49
50
  # Find the autoproj root dir
50
51
  report(Autobuild.debug) do
52
+ selected_packages =
53
+ begin Autoproj::CmdLine.parse_arguments(ARGV.dup)
54
+ rescue Exception => e
55
+ if Autoproj::CmdLine.bootstrap? && !Autoproj.in_autoproj_installation?(Dir.pwd)
56
+ STDERR.puts <<EOTEXT
57
+
58
+
59
+ #{color('autoproj bootstrap failed', :red, :bold)}
60
+ To retry, first source the env.sh script with
61
+ source #{Dir.pwd}/env.sh
62
+ and then re-run autoproj bootstrap with
63
+ autoproj bootstrap <vcs_type> <vcs_url> <vcs_options>
64
+
65
+ where
66
+ 'vcs_type' is git, svn, darcs, cvs
67
+ 'vcs_url' is the vcs-specific URL to the repository, and
68
+ 'vcs_options' are optional values that can be given to the chosen VCS
69
+ EOTEXT
70
+ end
71
+ raise
72
+ end
51
73
 
52
74
  # Expand directories in the selected_packages set, before we chdir to the
53
75
  # autoproj root
@@ -83,6 +105,30 @@ report(Autobuild.debug) do
83
105
  if Autoproj.verbose || Autoproj::CmdLine.display_configuration?
84
106
  Autoproj::CmdLine.display_sources(manifest)
85
107
  end
108
+
109
+ if Autoproj::CmdLine.bootstrap?
110
+ STDERR.puts <<EOTEXT
111
+
112
+
113
+ #{color('autoproj bootstrap successfully finished', :green, :bold)}
114
+
115
+ #{color('To further use autoproj and the installed software', :bold)}, you
116
+ must add the following line at the bottom of your .bashrc:
117
+ source #{Dir.pwd}/env.sh
118
+
119
+ WARNING: autoproj will not work until your restart all
120
+ your consoles, or run the following in them:
121
+ $ source #{Dir.pwd}/env.sh
122
+
123
+ #{color('To import and build the packages', :bold)}, you can now run
124
+ autoproj update
125
+ autoproj build
126
+
127
+ The resulting software is installed in
128
+ #{Dir.pwd}/install
129
+
130
+ EOTEXT
131
+ end
86
132
 
87
133
  if Autoproj::CmdLine.only_config?
88
134
  exit(0)
@@ -565,9 +565,18 @@ module Autoproj
565
565
  puts
566
566
  end
567
567
 
568
- if automatic_osdeps_mode == ASK && (os_def || !gems.empty?)
568
+ if automatic_osdeps_mode == ASK
569
569
  if !os_def
570
- print "Should I install the RubyGems packages ? [yes] "
570
+ if gems.empty?
571
+ # Nothing we can do, but the users required "ASK".
572
+ # So, at least, let him press enter
573
+ print "There are external packages, but I can't install them on this OS. Press ENTER to continue"
574
+ STDOUT.flush
575
+ STDIN.readline
576
+ do_osdeps = false
577
+ else
578
+ print "Should I install the RubyGems packages ? [yes] "
579
+ end
571
580
  else
572
581
  print "Should I install these packages ? [yes] "
573
582
  end
@@ -641,7 +650,7 @@ module Autoproj
641
650
  end
642
651
 
643
652
  cmdline = [Autobuild.tool('gem'), 'install']
644
- if Autobuild::OSDependencies.gem_with_prerelease
653
+ if Autoproj::OSDependencies.gem_with_prerelease
645
654
  cmdline << "--prerelease"
646
655
  end
647
656
  cmdline.concat(gems)
@@ -660,50 +669,16 @@ end
660
669
 
661
670
  DEFS = <<EODEFS
662
671
  ---
663
- svn:
664
- arch: subversion
665
- gentoo: dev-util/subversion
666
- debian,ubuntu: subversion
667
- autobuild: gem
668
- zlib:
669
- debian,ubuntu: zlib1g-dev
670
- libxml2:
671
- arch: libxml2
672
- gentoo: dev-libs/libxml2
673
- debian,ubuntu: libxml2-dev
674
672
  none: ignore
675
- autotools:
676
- arch: automake autoconf
677
- gentoo:
678
- - sys-devel/automake:1.9
679
- - sys-devel/autoconf
680
- debian,ubuntu:
681
- - automake1.9
682
- - autoconf
683
- autoproj: gem
684
- archive:
685
- arch:
686
- - tar
687
- - unzip
688
- gentoo:
689
- - app-arch/tar
690
- - app-arch/unzip
691
- debian,ubuntu:
692
- - tar
693
- - unzip
694
- lsb_release:
695
- arch:
696
- gentoo: sys-apps/lsb-release
697
- debian,ubuntu: lsb-release
698
673
  ruby18:
699
- gentoo:
700
- - dev-lang/ruby:1.8
701
674
  debian,ubuntu:
702
675
  - ruby1.8-dev
703
676
  - ruby1.8
704
677
  - rubygems1.8
705
678
  - ri1.8
706
679
  - libopenssl-ruby1.8
680
+ gentoo:
681
+ - dev-lang/ruby:1.8
707
682
  ruby19:
708
683
  debian:
709
684
  squeeze,sid:
@@ -714,96 +689,135 @@ ruby19:
714
689
  - ruby1.9.1
715
690
  - ruby1.9.1-dev
716
691
  - rubygems1.9.1
717
- arch:
718
- - ruby
719
- gentoo:
720
- - dev-lang/ruby:1.9
721
692
  ubuntu:
722
693
  - ruby1.9.1
723
694
  - ruby1.9.1-dev
724
695
  - rubygems1.9.1
725
696
  - ri1.9.1
726
697
  - libopenssl-ruby1.9.1
698
+ gentoo:
699
+ - dev-lang/ruby:1.9
700
+ arch:
701
+ - ruby
702
+ rdoc: gem
703
+ build-essential:
704
+ debian,ubuntu: build-essential
705
+ gentoo:
706
+ arch:
707
+ libxml2:
708
+ debian,ubuntu: libxml2-dev
709
+ gentoo: dev-libs/libxml2
710
+ arch: libxml2
711
+ libxslt:
712
+ debian,ubuntu: libxslt1-dev
713
+ gentoo: dev-libs/libxslt
714
+ arch: libxslt
715
+ zlib:
716
+ debian,ubuntu: zlib1g-dev
717
+ autobuild: gem
718
+ autoproj: gem
727
719
  git:
728
- arch: git
729
- gentoo: dev-vcs/git
730
720
  debian,ubuntu: git-core
721
+ gentoo: dev-vcs/git
722
+ arch: git
723
+ svn:
724
+ debian,ubuntu: subversion
725
+ gentoo: dev-util/subversion
726
+ arch: subversion
731
727
  cmake:
732
- arch: cmake
733
- gentoo: dev-util/cmake
734
728
  debian,ubuntu: cmake
735
- build-essential:
729
+ gentoo: dev-util/cmake
730
+ arch: cmake
731
+ autotools:
732
+ debian,ubuntu:
733
+ - automake1.9
734
+ - autoconf
735
+ gentoo:
736
+ - sys-devel/automake:1.9
737
+ - sys-devel/autoconf
738
+ arch: automake autoconf
739
+ lsb_release:
740
+ debian,ubuntu: lsb-release
741
+ gentoo: sys-apps/lsb-release
736
742
  arch:
743
+ archive:
744
+ debian,ubuntu:
745
+ - tar
746
+ - unzip
737
747
  gentoo:
738
- debian,ubuntu: build-essential
739
- libxslt:
740
- arch: libxslt
741
- gentoo: dev-libs/libxslt
742
- debian,ubuntu: libxslt1-dev
743
- rdoc: gem
748
+ - app-arch/tar
749
+ - app-arch/unzip
750
+ arch:
751
+ - tar
752
+ - unzip
744
753
 
745
754
  EODEFS
746
755
 
747
- operating_system = Autoproj::OSDependencies.operating_system
748
- if !operating_system
749
- puts <<-EOT
750
-
751
- autoproj is usually able to handle the installation of operating system packages
752
- himself. However, it does not know about your operating system, and will
753
- therefore have to let you install the packages yourself.
756
+ if ENV['AUTOPROJ_AUTOMATIC_OSDEPS']
757
+ automatic_osdeps = ENV['AUTOPROJ_AUTOMATIC_OSDEPS']
758
+ else
759
+ operating_system = Autoproj::OSDependencies.operating_system
760
+ if !operating_system
761
+ puts <<-EOT
754
762
 
755
- It can still install the RubyGems packages that are required by the built
756
- packages.
763
+ autoproj is usually able to handle the installation of operating system packages
764
+ himself. However, it does not know about your operating system, and will
765
+ therefore have to let you install the packages yourself.
757
766
 
758
- If you answer 'no' to the following question, autoproj will always go on,
759
- assuming that all the required dependencies are already installed. If you answer
760
- 'yes', it will make sure that the RubyGems are installed himself, but it will
761
- assume that you took care of the other packages. If you answer 'wait', it will
762
- not install anything but will wait for you to press ENTER each time some
763
- external software is needed. Finally, if you answer 'ask', it will ask you each
764
- time what it should do when there is something to install
767
+ It can still install the RubyGems packages that are required by the built
768
+ packages.
765
769
 
766
- EOT
770
+ If you answer 'no' to the following question, autoproj will always go on,
771
+ assuming that all the required dependencies are already installed. If you answer
772
+ 'yes', it will make sure that the RubyGems are installed himself, but it will
773
+ assume that you took care of the other packages. If you answer 'wait', it will
774
+ not install anything but will wait for you to press ENTER each time some
775
+ external software is needed. Finally, if you answer 'ask', it will ask you each
776
+ time what it should do when there is something to install
767
777
 
768
- print "How should autoproj install RubyGems packages automatically (yes, no, wait or ask) ? [yes] "
769
- STDOUT.flush
770
- else
771
- # Before doing *anything*, we have to ask the user if he wants us to install
772
- # the osdeps ...
773
- puts <<-EOT
774
-
775
- autoproj is able to handle the installation of operating system packages
776
- himself. This functionality will use 'sudo' to gain root access each time
777
- it is needed.
778
-
779
- If you answer 'no' to the following question, autoproj will go on, assuming that
780
- all the required dependencies are already installed. If you answer 'yes', it
781
- will make sure that they are installed himself. If you answer 'wait', it will
782
- not install anything but wait for you to press ENTER each time some external
783
- software is needed. Finally, if you answer 'ask', it will ask you what it
784
- should do each time there is something to install.
785
-
786
- EOT
787
- print "Should autoproj install OS packages automatically (yes, no, wait or ask) ? [yes] "
788
- STDOUT.flush
789
- end
778
+ EOT
790
779
 
791
- automatic_osdeps = nil
792
- while automatic_osdeps.nil?
793
- answer = STDIN.readline.chomp
794
- if answer == ''
795
- automatic_osdeps = true
796
- elsif answer == "no"
797
- automatic_osdeps = false
798
- elsif answer == 'ask'
799
- automatic_osdeps = :ask
800
- elsif answer == 'yes'
801
- automatic_osdeps = true
780
+ print "How should autoproj install RubyGems packages automatically (yes, no, wait or ask) ? [yes] "
781
+ STDOUT.flush
802
782
  else
803
- print "invalid answer. Please answer with 'yes', 'no' or 'ask' "
783
+ # Before doing *anything*, we have to ask the user if he wants us to install
784
+ # the osdeps ...
785
+ puts <<-EOT
786
+
787
+ autoproj is able to handle the installation of operating system packages
788
+ himself. This functionality will use 'sudo' to gain root access each time
789
+ it is needed.
790
+
791
+ If you answer 'no' to the following question, autoproj will go on, assuming that
792
+ all the required dependencies are already installed. If you answer 'yes', it
793
+ will make sure that they are installed himself. If you answer 'wait', it will
794
+ not install anything but wait for you to press ENTER each time some external
795
+ software is needed. Finally, if you answer 'ask', it will ask you what it
796
+ should do each time there is something to install.
797
+
798
+ EOT
799
+ print "Should autoproj install OS packages automatically (yes, no, wait or ask) ? [yes] "
804
800
  STDOUT.flush
805
801
  end
802
+
803
+ automatic_osdeps = nil
804
+ while automatic_osdeps.nil?
805
+ answer = STDIN.readline.chomp
806
+ if answer == ''
807
+ automatic_osdeps = true
808
+ elsif answer == "no"
809
+ automatic_osdeps = false
810
+ elsif answer == 'ask'
811
+ automatic_osdeps = :ask
812
+ elsif answer == 'yes'
813
+ automatic_osdeps = true
814
+ else
815
+ print "invalid answer. Please answer with 'yes', 'no' or 'ask' "
816
+ STDOUT.flush
817
+ end
818
+ end
806
819
  end
820
+
807
821
  Autoproj.config['automatic_osdeps'] =
808
822
  automatic_osdeps
809
823
 
@@ -823,32 +837,35 @@ rescue Autoproj::ConfigError => e
823
837
  end
824
838
 
825
839
  # Now try to find out the name of the gem binary
826
- PACKAGES = %w{rdoc libxml2 libxslt zlib build-essential lsb_release}
827
- USER_PACKAGES = %w{autoproj}
840
+ PACKAGES = %w{rdoc autobuild libxml2 libxslt zlib build-essential lsb_release}
828
841
 
829
842
  ENV['RUBYOPT'] = "-rubygems"
830
843
  require 'rubygems'
831
844
 
832
- packages = PACKAGES + USER_PACKAGES
833
-
845
+ osdeps_management = Autoproj::OSDependencies.new(YAML.load(DEFS))
846
+ STDERR.puts "autoproj: installing autoproj and its dependencies (this can take a long time)"
847
+ # First install the dependencies of autoproj, as we don't want them to be
848
+ # affected by the prerelease flag
834
849
  begin
835
- osdeps_management = Autoproj::OSDependencies.new(YAML.load(DEFS))
836
- STDERR.puts "autoproj: installing autoproj and its dependencies (this can take a long time)"
837
- osdeps_management.install(packages)
850
+ osdeps_management.install(PACKAGES)
838
851
  rescue Autoproj::ConfigError => e
839
852
  STDERR.puts "failed: #{e.message}"
840
853
  exit(1)
841
854
  end
842
855
 
856
+ # If the user specifies "dev" on the command line, install the prerelease
857
+ # version of autoproj
843
858
  if ARGV.first == "dev"
844
859
  Autoproj::OSDependencies.gem_with_prerelease = true
860
+ ARGV.shift
845
861
  end
846
-
847
- ENV['AUTOPROJ_AUTOMATIC_OSDEPS'] = automatic_osdeps.to_s
848
- if !system('autoproj', 'bootstrap', *ARGV)
849
- STDERR.puts "ERROR: failed to run autoproj bootstrap #{ARGV.join(", ")}"
850
- exit 1
862
+ begin
863
+ osdeps_management.install('autoproj')
864
+ rescue Autoproj::ConfigError => e
865
+ STDERR.puts "failed: #{e.message}"
866
+ exit(1)
851
867
  end
868
+ Autoproj::OSDependencies.gem_with_prerelease = false
852
869
 
853
870
  File.open('env.sh', 'w') do |io|
854
871
  io.write <<-EOSHELL
@@ -858,15 +875,9 @@ export PATH=$GEM_HOME/bin:$PATH
858
875
  EOSHELL
859
876
  end
860
877
 
861
- STDERR.puts <<EOTEXT
862
-
863
-
864
- add the following line at the bottom of your .bashrc:
865
- source #{Dir.pwd}/env.sh
866
-
867
- WARNING: autoproj will not work until your restart all
868
- your consoles, or run the following in them:
869
- $ source #{Dir.pwd}/env.sh
870
-
871
- EOTEXT
878
+ ENV['AUTOPROJ_AUTOMATIC_OSDEPS'] = automatic_osdeps.to_s
879
+ if !system('autoproj', 'bootstrap', *ARGV)
880
+ STDERR.puts "ERROR: failed to run autoproj bootstrap #{ARGV.join(", ")}"
881
+ exit 1
882
+ end
872
883
 
@@ -496,6 +496,7 @@ OS dependencies through autoproj.
496
496
  end
497
497
 
498
498
  def self.manifest; Autoproj.manifest end
499
+ def self.bootstrap?; !!@bootstrap end
499
500
  def self.only_status?; !!@only_status end
500
501
  def self.check?; !!@check end
501
502
  def self.manifest_update?; !!@manifest_update end
@@ -665,8 +666,18 @@ where 'mode' is one of:
665
666
  end
666
667
 
667
668
  def self.handle_mode(mode, remaining_args)
669
+ case mode
670
+ when "update-sets"
671
+ Autoproj.warn("update-sets is deprecated. Use update-config instead")
672
+ mode = "update-config"
673
+ when "list-sets"
674
+ Autoproj.warn("list-sets is deprecated. Use list-config instead")
675
+ mode = "list-config"
676
+ end
677
+
668
678
  case mode
669
679
  when "bootstrap"
680
+ @bootstrap = true
670
681
  bootstrap(*remaining_args)
671
682
  remaining_args.clear
672
683
 
@@ -674,6 +685,7 @@ where 'mode' is one of:
674
685
  Autobuild.do_build = false
675
686
  Autobuild.do_update = false
676
687
  @update_os_dependencies = false
688
+ @only_config = true
677
689
 
678
690
  when "switch-config"
679
691
  # We must switch to the root dir first, as it is required by the
@@ -731,13 +743,7 @@ where 'mode' is one of:
731
743
  Autobuild.do_update = true
732
744
  @update_os_dependencies = false
733
745
  Autobuild.do_build = false
734
- when "update-sets" # provided for backward compatibility
735
- Autoproj.warn("update-sets is deprecated. Use update-config instead")
736
- @only_config = true
737
- Autobuild.do_update = true
738
- @update_os_dependencies = false
739
- Autobuild.do_build = false
740
- when "list", "list-sets"
746
+ when "list-config"
741
747
  @only_config = true
742
748
  @display_configuration = true
743
749
  Autobuild.do_update = false
@@ -960,11 +966,14 @@ manifest_source:
960
966
  end
961
967
  Autobuild.logdir = File.join('build', 'log')
962
968
 
963
- # Check if we are being called from another GEM_HOME. If it is the case,
964
- # assume that we are bootstrapping from another installation directory and
965
- # start by copying the .gems directory
966
- needed_gem_home = Autoproj.gem_home
967
- if ENV['GEM_HOME'] && ENV['GEM_HOME'] =~ /\.gems\/?$/ && ENV['GEM_HOME'] != needed_gem_home
969
+ # Check if GEM_HOME is set. If it is the case, assume that we are
970
+ # bootstrapping from another installation directory and start by
971
+ # copying the .gems directory
972
+ #
973
+ # We don't use Autoproj.gem_home there as we might not be in an
974
+ # autoproj directory at all
975
+ if ENV['GEM_HOME'] && Autoproj.in_autoproj_installation?(ENV['GEM_HOME']) &&
976
+ ENV['GEM_HOME'] != ENV['AUTOPROJ_GEM_HOME']
968
977
  Autoproj.progress "autoproj: reusing bootstrap from #{File.dirname(ENV['GEM_HOME'])}"
969
978
  FileUtils.cp_r ENV['GEM_HOME'], ".gems"
970
979
  ENV['GEM_HOME'] = File.join(Dir.pwd, ".gems")
@@ -1005,22 +1014,11 @@ manifest_source:
1005
1014
  # Finally, generate an env.sh script
1006
1015
  File.open('env.sh', 'w') do |io|
1007
1016
  io.write <<-EOSHELL
1008
- export RUBYOPT=-rubygems
1009
- export GEM_HOME=#{Autoproj.gem_home}
1010
- export PATH=$GEM_HOME/bin:$PATH
1017
+ export RUBYOPT=-rubygems
1018
+ export GEM_HOME=#{Autoproj.gem_home}
1019
+ export PATH=$GEM_HOME/bin:$PATH
1011
1020
  EOSHELL
1012
1021
  end
1013
-
1014
- Autoproj.progress <<EOTEXT
1015
-
1016
- add the following line at the bottom of your .bashrc:
1017
- source #{Dir.pwd}/env.sh
1018
-
1019
- WARNING: autoproj will not work until your restart all
1020
- your consoles, or run the following in them:
1021
- $ source #{Dir.pwd}/env.sh
1022
-
1023
- EOTEXT
1024
1022
  end
1025
1023
 
1026
1024
  def self.missing_dependencies(pkg)
@@ -1,12 +1,19 @@
1
1
  module Autoproj
2
2
  class UserError < RuntimeError; end
3
3
 
4
+ # Returns true if +path+ is part of an autoproj installation
5
+ def self.in_autoproj_installation?(path)
6
+ root_dir(File.expand_path(path))
7
+ true
8
+ rescue UserError
9
+ false
10
+ end
11
+
4
12
  # Returns the root directory of the current autoproj installation.
5
13
  #
6
14
  # If the current directory is not in an autoproj installation,
7
15
  # raises UserError.
8
- def self.root_dir
9
- dir = Dir.pwd
16
+ def self.root_dir(dir = Dir.pwd)
10
17
  while dir != "/" && !File.directory?(File.join(dir, "autoproj"))
11
18
  dir = File.dirname(dir)
12
19
  end
@@ -1,3 +1,3 @@
1
1
  module Autoproj
2
- VERSION = "1.6.0.rc5"
2
+ VERSION = "1.6.0.rc6"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autoproj
3
3
  version: !ruby/object:Gem::Version
4
- hash: 977940586
4
+ hash: 977940587
5
5
  prerelease: true
6
6
  segments:
7
7
  - 1
8
8
  - 6
9
9
  - 0
10
- - rc5
11
- version: 1.6.0.rc5
10
+ - rc6
11
+ version: 1.6.0.rc6
12
12
  platform: ruby
13
13
  authors:
14
14
  - Sylvain Joyeux