lib/autoproj/autobuild.rb in autoproj-1.5.4 vs lib/autoproj/autobuild.rb in autoproj-1.5.5

- old
+ new

@@ -310,9 +310,44 @@ package_common(:orogen, options) do |pkg| yield(pkg) if block_given? end end +# Declare that the packages declared in the block should not be built in the +# given operating system. OS descriptions are space-separated strings containing +# OS name and version. +# +# An error will occur if the user tries to build it on one of those +# architectures +def not_on(*architectures) + architectures = architectures.map do |name| + if name.respond_to?(:to_str) + [name] + else name + end + end + + os = OSDependencies.operating_system + matching_archs = architectures.find_all { |arch| arch[0] == os[0] } + STDERR.puts matching_archs.inspect + if matching_archs.empty? + return yield + elsif matching_archs.all? { |arch| arch[1] && !os[1].include?(arch[1].downcase) } + return yield + end + + # Simply get the current list of packages, yield the block, and exclude all + # packages that have been added + current_packages = Autobuild::Package.each(true).map(&:last).map(&:name).to_set + yield + new_packages = Autobuild::Package.each(true).map(&:last).map(&:name).to_set - + current_packages + + new_packages.each do |pkg_name| + Autoproj.manifest.add_exclusion(pkg_name, "#{pkg_name} is disabled on this operating system") + end +end + # Defines an import-only package, i.e. a package that is simply checked out but # not built in any way def source_package(options) package_common(options) do |pkg| pkg.srcdir = pkg.name