lib/autoproj/autobuild.rb in autoproj-1.7.3.b1 vs lib/autoproj/autobuild.rb in autoproj-1.7.3

- old
+ new

@@ -28,9 +28,51 @@ module Autobuild class Package # The Autoproj::PackageManifest object that describes this package attr_accessor :description + # The set of tags for this package. This is an union of the tags + # contained in +description+ and the ones explicitely added with + # #add_tag + def tags + result = (@added_tags || Set.new) + if description + result |= description.tags.to_set + end + result + end + # Tags explicitely added with #add_tag + attr_reader :added_tags + # Add a tag to the package. Use this if you don't want the tag to be + # shared with everyone that uses the package (i.e. cannot go in + # manifest.xml) + def add_tag(tag) + @added_tags ||= Set.new + @added_tags << tag + end + + # True if this package is tagged with the given tag string + def has_tag?(tag) + tags.include?(tag.to_s) + end + + # Asks autoproj to remove the given file in the package's installation + # prefix + def remove_obsolete_installed_file(*path) + post_import do + path = File.join(prefix, *path) + if File.exists?(path) + Autoproj.progress " removing obsolete file #{path}", :bold + FileUtils.rm_f path + end + end + end + + # Ask autoproj to run the given block after this package has been + # imported + def post_import(&block) + Autoproj.post_import(self, &block) + end def autoproj_name # :nodoc: srcdir.gsub /^#{Regexp.quote(Autoproj.root_dir)}\//, '' end