autoproj 1.7.14.rc4 → 1.7.14.rc5

Sign up to get free protection for your applications and to get access to all the features.
data/bin/autoproj CHANGED
@@ -183,8 +183,22 @@ EOTEXT
183
183
 
184
184
  if Autoproj::CmdLine.only_status?
185
185
  all_enabled_packages = Autoproj::CmdLine.import_packages(selected_packages)
186
- Autoproj::CmdLine.status(all_enabled_packages)
187
- exit(0)
186
+ result = Autoproj::CmdLine.status(all_enabled_packages)
187
+ if Autoproj::CmdLine.status_exit_code?
188
+ code = 0
189
+ if result.uncommitted
190
+ code |= 1
191
+ end
192
+ if result.local
193
+ code |= 2
194
+ end
195
+ if result.remote
196
+ code |= 4
197
+ end
198
+ exit(code)
199
+ else
200
+ exit(0)
201
+ end
188
202
  elsif Autoproj::CmdLine.check?
189
203
  all_enabled_packages = Autoproj::CmdLine.import_packages(selected_packages)
190
204
  Autoproj::CmdLine.check(all_enabled_packages)
@@ -616,7 +616,7 @@ fi
616
616
  #
617
617
  # Raises ConfigError if an error exists in the osdeps files, and returns
618
618
  # empty sets if the package can't be found
619
- def partition_packages(package_set, package_osdeps = Hash.new)
619
+ def partition_packages(package_set)
620
620
  package_set = package_set.
621
621
  map { |name| OSDependencies.aliases[name] || name }.
622
622
  to_set
@@ -1003,7 +1003,7 @@ So, what do you want ? (all, ruby, os or none)
1003
1003
  packages -= installed_packages
1004
1004
  return if packages.empty?
1005
1005
 
1006
- osdeps, gems = partition_packages(packages, package_osdeps)
1006
+ osdeps, gems = partition_packages(packages)
1007
1007
  if handled_os
1008
1008
  os_names, _ = OSDependencies.operating_system
1009
1009
  os_packages = resolve_os_dependencies(osdeps)
@@ -745,11 +745,15 @@ module Autoproj
745
745
  else true
746
746
  end
747
747
  end
748
+ def self.status_exit_code?
749
+ @status_exit_code
750
+ end
748
751
  def self.list_newest?; @list_newest end
749
752
  def self.parse_arguments(args, with_mode = true)
750
753
  @only_status = false
751
754
  @only_local = false
752
755
  @show_osdeps = false
756
+ @status_exit_code = false
753
757
  @revshow_osdeps = false
754
758
  @osdeps_filter_uptodate = true
755
759
  @osdeps_forced_mode = nil
@@ -906,6 +910,9 @@ where 'mode' is one of:
906
910
  opts.on("--local", "for status, do not access the network") do
907
911
  @only_local = true
908
912
  end
913
+ opts.on('--exit-code', 'in status mode, exit with a code that reflects the status of the installation (see documentation for details)') do
914
+ @status_exit_code = true
915
+ end
909
916
  opts.on('--randomize-layout', 'in build and full-build, generate a random layout') do
910
917
  @randomize_layout = true
911
918
  Autoproj.change_option('randomize_layout', true)
@@ -1103,8 +1110,10 @@ where 'mode' is one of:
1103
1110
  nil
1104
1111
  end
1105
1112
 
1113
+ StatusResult = Struct.new :uncommitted, :local, :remote
1106
1114
  def self.display_status(packages)
1107
1115
  last_was_in_sync = false
1116
+ result = StatusResult.new
1108
1117
 
1109
1118
  packages.each do |pkg|
1110
1119
  lines = []
@@ -1125,6 +1134,7 @@ where 'mode' is one of:
1125
1134
  status = pkg.importer.status(pkg,@only_local)
1126
1135
  if status.uncommitted_code
1127
1136
  lines << Autoproj.color(" contains uncommitted modifications", :red)
1137
+ result.uncommitted = true
1128
1138
  end
1129
1139
 
1130
1140
  case status.status
@@ -1141,16 +1151,20 @@ where 'mode' is one of:
1141
1151
  lines << Autoproj.color(" local and remote are in sync", :green)
1142
1152
  end
1143
1153
  when Autobuild::Importer::Status::ADVANCED
1154
+ result.local = true
1144
1155
  lines << Autoproj.color(" local contains #{status.local_commits.size} commit that remote does not have:", :magenta)
1145
1156
  status.local_commits.each do |line|
1146
1157
  lines << Autoproj.color(" #{line}", :magenta)
1147
1158
  end
1148
1159
  when Autobuild::Importer::Status::SIMPLE_UPDATE
1160
+ result.remote = true
1149
1161
  lines << Autoproj.color(" remote contains #{status.remote_commits.size} commit that local does not have:", :magenta)
1150
1162
  status.remote_commits.each do |line|
1151
1163
  lines << Autoproj.color(" #{line}", :magenta)
1152
1164
  end
1153
1165
  when Autobuild::Importer::Status::NEEDS_MERGE
1166
+ result.local = true
1167
+ result.remote = true
1154
1168
  lines << Autoproj.color(" local and remote have diverged with respectively #{status.local_commits.size} and #{status.remote_commits.size} commits each", :magenta)
1155
1169
  lines << " -- local commits --"
1156
1170
  status.local_commits.each do |line|
@@ -1180,6 +1194,7 @@ where 'mode' is one of:
1180
1194
  if last_was_in_sync
1181
1195
  Autoproj.progress(": local and remote are in sync", :green)
1182
1196
  end
1197
+ return result
1183
1198
  end
1184
1199
 
1185
1200
  def self.status(packages)
@@ -1557,7 +1572,7 @@ export PATH=$GEM_HOME/bin:$PATH
1557
1572
 
1558
1573
  ospkg_to_pkg.each do |pkg_osdep, pkgs|
1559
1574
  osdeps, gems = Autoproj.osdeps.
1560
- partition_packages([pkg_osdep], ospkg_to_pkg)
1575
+ partition_packages([pkg_osdep])
1561
1576
 
1562
1577
  gems.each do |gem_name|
1563
1578
  mapping[gem_name.join(" ")][1] = true
@@ -1620,7 +1635,7 @@ export PATH=$GEM_HOME/bin:$PATH
1620
1635
  end
1621
1636
 
1622
1637
  osdeps, gems = Autoproj.osdeps.
1623
- partition_packages(pkg_osdeps, ospkg_to_pkg)
1638
+ partition_packages(pkg_osdeps)
1624
1639
 
1625
1640
  puts " #{pkg_name}:"
1626
1641
  if !gems.empty?
@@ -1687,7 +1687,7 @@ module Autoproj
1687
1687
  # a proper error message.
1688
1688
  if !available_as_source
1689
1689
  begin
1690
- osdeps, gems = Autoproj.osdeps.partition_packages([name].to_set, name => [self.name])
1690
+ osdeps, gems = Autoproj.osdeps.partition_packages([name].to_set)
1691
1691
  Autoproj.osdeps.resolve_os_dependencies(osdeps)
1692
1692
  rescue Autoproj::ConfigError => e
1693
1693
  if osdeps_availability != Autoproj::OSDependencies::NO_PACKAGE && !Autoproj.osdeps.installs_os_packages?
@@ -517,7 +517,7 @@ fi
517
517
  #
518
518
  # Raises ConfigError if an error exists in the osdeps files, and returns
519
519
  # empty sets if the package can't be found
520
- def partition_packages(package_set, package_osdeps = Hash.new)
520
+ def partition_packages(package_set)
521
521
  package_set = package_set.
522
522
  map { |name| OSDependencies.aliases[name] || name }.
523
523
  to_set
@@ -904,7 +904,7 @@ So, what do you want ? (all, ruby, os or none)
904
904
  packages -= installed_packages
905
905
  return if packages.empty?
906
906
 
907
- osdeps, gems = partition_packages(packages, package_osdeps)
907
+ osdeps, gems = partition_packages(packages)
908
908
  if handled_os
909
909
  os_names, _ = OSDependencies.operating_system
910
910
  os_packages = resolve_os_dependencies(osdeps)
@@ -1,3 +1,3 @@
1
1
  module Autoproj
2
- VERSION = "1.7.14.rc4"
2
+ VERSION = "1.7.14.rc5"
3
3
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autoproj
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15424061
4
+ hash: 15424063
5
5
  prerelease: 7
6
6
  segments:
7
7
  - 1
8
8
  - 7
9
9
  - 14
10
10
  - rc
11
- - 4
12
- version: 1.7.14.rc4
11
+ - 5
12
+ version: 1.7.14.rc5
13
13
  platform: ruby
14
14
  authors:
15
15
  - Sylvain Joyeux