From 1853020a5fe66012522f5a00fdbe55da606f105f Mon Sep 17 00:00:00 2001
From: Brian Warner <warner@lothar.com>
Date: Tue, 16 Sep 2008 18:37:02 -0700
Subject: [PATCH] #249: add 'test-desert-island', to assert that a
 tahoe-deps.tar.gz -enabled build does not download anything

---
 Makefile            | 12 ++++++++++++
 misc/check-build.py | 22 ++++++++++++++++++++++
 2 files changed, 34 insertions(+)
 create mode 100644 misc/check-build.py

diff --git a/Makefile b/Makefile
index 8f605ed6..d262b5e7 100644
--- a/Makefile
+++ b/Makefile
@@ -245,6 +245,18 @@ clean:
 find-trailing-spaces:
 	$(PYTHON) misc/find-trailing-spaces.py -r src
 
+# The test-desert-island target grabs the tahoe-deps tarball, unpacks it,
+# does a build, then asserts that the build did not try to download anything
+# as it ran. Invoke this on a new tree, or after a 'clean', to make sure the
+# support/lib/ directory is gone.
+
+test-desert-island:
+	wget http://allmydata.org/source/tahoe/tarballs/tahoe-deps.tar.gz
+	tar xf tahoe-deps.tar.gz
+	$(MAKE) 2>&1 | tee make.out
+	$(PYTHON) misc/check-build.py make.out no-downloads
+
+
 # TARBALL GENERATION
 .PHONY: tarballs upload-tarballs
 tarballs:
diff --git a/misc/check-build.py b/misc/check-build.py
new file mode 100644
index 00000000..1e6e9c54
--- /dev/null
+++ b/misc/check-build.py
@@ -0,0 +1,22 @@
+#! /usr/bin/env python
+
+# This helper script is used with the 'test-desert-island' Makefile target.
+
+import sys
+
+good = True
+build_out = sys.argv[1]
+mode = sys.argv[2]
+
+for line in open(build_out, "r"):
+    if mode == "no-downloads" and "downloading" in line.lower():
+        print line,
+        good = False
+if good:
+    if mode == "no-downloads":
+        print "Good: build did not try to download any files"
+    sys.exit(0)
+else:
+    if mode == "no-downloads":
+        print "Failed: build tried to download files"
+    sys.exit(1)
-- 
2.45.2