From 1351b0df87a0984914769c5dc76489618b3a3fec Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 2 Feb 2017 12:20:28 +0100 Subject: [PATCH] exportReferencesGraph: Only export in JSON format when in structured mode This prevents breaking compatibility with builders that read "closure.*", since they would accidentally pick up the new JSON files. --- src/libstore/build.cc | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/libstore/build.cc b/src/libstore/build.cc index 40927c063..5d6fff4e3 100644 --- a/src/libstore/build.cc +++ b/src/libstore/build.cc @@ -2276,18 +2276,24 @@ void DerivationGoal::doExportReferencesGraph() } } - /* Write closure info to . */ - writeFile(tmpDir + "/" + fileName, - worker.store.makeValidityRegistration(paths, false, false)); + if (!drv->env.count("__json")) { + + /* Write closure info to . */ + writeFile(tmpDir + "/" + fileName, + worker.store.makeValidityRegistration(paths, false, false)); + + } else { + + /* Write a more comprehensive JSON serialisation to + . */ + std::ostringstream str; + { + JSONPlaceholder jsonRoot(str, true); + worker.store.pathInfoToJSON(jsonRoot, paths, false, true); + } + writeFile(tmpDir + "/" + fileName, str.str()); - /* Write a more comprehensive JSON serialisation to - .json. */ - std::ostringstream str; - { - JSONPlaceholder jsonRoot(str, true); - worker.store.pathInfoToJSON(jsonRoot, paths, false, true); } - writeFile(tmpDir + "/" + fileName + ".json", str.str()); } }