* Get rid of the substitutes database table (NIX-47). Instead, if we
need any info on substitutable paths, we just call the substituters (such as download-using-manifests.pl) directly. This means that it's no longer necessary for nix-pull to register substitutes or for nix-channel to clear them, which makes those operations much faster (NIX-95). Also, we don't have to worry about keeping nix-pull manifests (in /nix/var/nix/manifests) and the database in sync with each other. The downside is that there is some overhead in calling an external program to get the substitutes info. For instance, "nix-env -qas" takes a bit longer. Abolishing the substitutes table also makes the logic in local-store.cc simpler, as we don't need to store info for invalid paths. On the downside, you cannot do things like "nix-store -qR" on a substitutable but invalid path (but nobody did that anyway). * Never catch interrupts (the Interrupted exception).
This commit is contained in:
		
							parent
							
								
									4695f4edd6
								
							
						
					
					
						commit
						9e975458b4
					
				
					 24 changed files with 357 additions and 469 deletions
				
			
		|  | @ -13,28 +13,6 @@ | |||
| namespace nix { | ||||
| 
 | ||||
| 
 | ||||
| /* A substitute is a program invocation that constructs some store
 | ||||
|    path (typically by fetching it from somewhere, e.g., from the | ||||
|    network). */ | ||||
| struct Substitute | ||||
| {        | ||||
|     /* The derivation that built this store path (empty if none). */ | ||||
|     Path deriver; | ||||
|      | ||||
|     /* Program to be executed to create the store path.  Must be in
 | ||||
|        the output path of `storeExpr'. */ | ||||
|     Path program; | ||||
| 
 | ||||
|     /* Extra arguments to be passed to the program (the first argument
 | ||||
|        is the store path to be substituted). */ | ||||
|     Strings args; | ||||
| 
 | ||||
|     bool operator == (const Substitute & sub) const; | ||||
| }; | ||||
| 
 | ||||
| typedef list<Substitute> Substitutes; | ||||
| 
 | ||||
| 
 | ||||
| typedef std::map<Path, Path> Roots; | ||||
| 
 | ||||
| 
 | ||||
|  | @ -57,13 +35,6 @@ public: | |||
|     /* Checks whether a path is valid. */  | ||||
|     virtual bool isValidPath(const Path & path) = 0; | ||||
| 
 | ||||
|     /* Return the substitutes for the given path. */ | ||||
|     virtual Substitutes querySubstitutes(const Path & path) = 0; | ||||
| 
 | ||||
|     /* More efficient variant if we just want to know if a path has
 | ||||
|        substitutes. */ | ||||
|     virtual bool hasSubstitutes(const Path & path); | ||||
| 
 | ||||
|     /* Queries the hash of a valid path. */  | ||||
|     virtual Hash queryPathHash(const Path & path) = 0; | ||||
| 
 | ||||
|  | @ -81,6 +52,13 @@ public: | |||
|        no deriver has been set. */ | ||||
|     virtual Path queryDeriver(const Path & path) = 0; | ||||
| 
 | ||||
|     /* Query the set of substitutable paths. */ | ||||
|     virtual PathSet querySubstitutablePaths() = 0; | ||||
| 
 | ||||
|     /* More efficient variant if we just want to know if a path has
 | ||||
|        substitutes. */ | ||||
|     virtual bool hasSubstitutes(const Path & path); | ||||
|      | ||||
|     /* Copy the contents of a path to the store and register the
 | ||||
|        validity the resulting path.  The resulting path is returned. | ||||
|        If `fixed' is true, then the output of a fixed-output | ||||
|  | @ -109,10 +87,10 @@ public: | |||
| 
 | ||||
|     /* Ensure that the output paths of the derivation are valid.  If
 | ||||
|        they are already valid, this is a no-op.  Otherwise, validity | ||||
|        can be reached in two ways.  First, if the output paths have | ||||
|        substitutes, then those can be used.  Second, the output paths | ||||
|        can be created by running the builder, after recursively | ||||
|        building any sub-derivations. */ | ||||
|        can be reached in two ways.  First, if the output paths is | ||||
|        substitutable, then build the path that way.  Second, the | ||||
|        output paths can be created by running the builder, after | ||||
|        recursively building any sub-derivations. */ | ||||
|     virtual void buildDerivations(const PathSet & drvPaths) = 0; | ||||
| 
 | ||||
|     /* Ensure that a path is valid.  If it is not currently valid, it
 | ||||
|  | @ -261,6 +239,17 @@ extern boost::shared_ptr<StoreAPI> store; | |||
| boost::shared_ptr<StoreAPI> openStore(bool reserveSpace = true); | ||||
| 
 | ||||
| 
 | ||||
| struct ValidPathInfo  | ||||
| { | ||||
|     Path path; | ||||
|     Path deriver; | ||||
|     Hash hash; | ||||
|     PathSet references; | ||||
| }; | ||||
| 
 | ||||
| ValidPathInfo decodeValidPathInfo(std::istream & str); | ||||
| 
 | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue