aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/dependency.rb
diff options
context:
space:
mode:
authorJack Nagel2013-09-27 23:23:22 -0500
committerJack Nagel2013-09-27 23:36:57 -0500
commita2c949bfb754d228b490d7a0cb21cf95d8513aea (patch)
tree0e5146866c08ed4b844d5d4d59a4f629e77f8808 /Library/Homebrew/dependency.rb
parent29d204c697ff2a554a4767657884d72a85ff9ff5 (diff)
downloadbrew-a2c949bfb754d228b490d7a0cb21cf95d8513aea.tar.bz2
Allow Dependency objects to be marshaled
When an exception is raised in the build process, it is marshaled and sent to the main process over a pipe. The marshaled exception has a reference to the formula, so the formula and all objects it references are marshaled as well. Previously this did not include dependencies, as they were stored only on the class and not referenced by an instance variable. However, now they are stored on SoftwareSpec instances, to which the formula *does* have a direct reference, so they must be marshalable.
Diffstat (limited to 'Library/Homebrew/dependency.rb')
-rw-r--r--Library/Homebrew/dependency.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/Library/Homebrew/dependency.rb b/Library/Homebrew/dependency.rb
index ba5a8ea30..d218adb69 100644
--- a/Library/Homebrew/dependency.rb
+++ b/Library/Homebrew/dependency.rb
@@ -63,6 +63,15 @@ class Dependency
"#<#{self.class}: #{name.inspect} #{tags.inspect}>"
end
+ # Define marshaling semantics because we cannot serialize @env_proc
+ def _dump(*)
+ Marshal.dump([name, tags])
+ end
+
+ def self._load(marshaled)
+ new(*Marshal.load(marshaled))
+ end
+
class << self
# Expand the dependencies of dependent recursively, optionally yielding
# [dependent, dep] pairs to allow callers to apply arbitrary filters to