feat(tvix): Add a no-op stream buffer for discarding build logs
In some cases we don't have anywhere for the build logs to go. Until we understand those cases fully and can get rid of them, this null sink implementation can be used. Change-Id: Ib93c43caf268e2c01c43d59737a829e8c43d223e Reviewed-on: https://cl.tvl.fyi/c/depot/+/1792 Tested-by: BuildkiteCI Reviewed-by: kanepyork <rikingcoding@gmail.com> Reviewed-by: glittershark <grfn@gws.fyi>
This commit is contained in:
		
							parent
							
								
									dfc351b463
								
							
						
					
					
						commit
						883de9b8d7
					
				
					 2 changed files with 19 additions and 0 deletions
				
			
		
							
								
								
									
										13
									
								
								third_party/nix/src/libstore/store-api.cc
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										13
									
								
								third_party/nix/src/libstore/store-api.cc
									
										
									
									
										vendored
									
									
								
							| 
						 | 
					@ -1,6 +1,8 @@
 | 
				
			||||||
#include "libstore/store-api.hh"
 | 
					#include "libstore/store-api.hh"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <future>
 | 
					#include <future>
 | 
				
			||||||
 | 
					#include <ostream>
 | 
				
			||||||
 | 
					#include <streambuf>
 | 
				
			||||||
#include <utility>
 | 
					#include <utility>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <absl/status/status.h>
 | 
					#include <absl/status/status.h>
 | 
				
			||||||
| 
						 | 
					@ -23,6 +25,17 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace nix {
 | 
					namespace nix {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace {
 | 
				
			||||||
 | 
					class NullStream : public std::streambuf {
 | 
				
			||||||
 | 
					 public:
 | 
				
			||||||
 | 
					  int overflow(int c) override { return c; }
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static NullStream NULL_STREAM{};
 | 
				
			||||||
 | 
					}  // namespace
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					std::ostream DiscardLogsSink() { return std::ostream(&NULL_STREAM); }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
std::optional<BuildMode> BuildModeFrom(nix::proto::BuildMode mode) {
 | 
					std::optional<BuildMode> BuildModeFrom(nix::proto::BuildMode mode) {
 | 
				
			||||||
  switch (mode) {
 | 
					  switch (mode) {
 | 
				
			||||||
    case nix::proto::BuildMode::Normal:
 | 
					    case nix::proto::BuildMode::Normal:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										6
									
								
								third_party/nix/src/libstore/store-api.hh
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								third_party/nix/src/libstore/store-api.hh
									
										
									
									
										vendored
									
									
								
							| 
						 | 
					@ -19,6 +19,12 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace nix {
 | 
					namespace nix {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Create a no-op stream buffer used to discard build output in cases
 | 
				
			||||||
 | 
					// where we don't have a build log sink to thread through.
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// TODO(tazjin): Get rid of this and do *something* with those logs.
 | 
				
			||||||
 | 
					std::ostream DiscardLogsSink();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
MakeError(SubstError, Error);
 | 
					MakeError(SubstError, Error);
 | 
				
			||||||
MakeError(BuildError, Error); /* denotes a permanent build failure */
 | 
					MakeError(BuildError, Error); /* denotes a permanent build failure */
 | 
				
			||||||
MakeError(InvalidPath, Error);
 | 
					MakeError(InvalidPath, Error);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue