From 00aa75d1e8b8b1880f415b3901ba5bb57466da80 Mon Sep 17 00:00:00 2001
From: robk-tahoe <robk-tahoe@allmydata.com>
Date: Wed, 24 Sep 2008 18:42:14 -0700
Subject: [PATCH] fuse/impl_c: move mac tahoefuse impl out into contrib/fuse

For a variety of reasons, high amongst them the fact that many people
interested in fuse support for tahoe seem to have missed its existence,
the existing fuse implementation for tahoe, previously 'mac/tahoefuse.py'
has been renamed and moved.

It was suggested that, even though the mac build depends upon it, that
the mac/tahoefuse implementation be moved into contrib/fuse along with
the other fuse implementations.  The fact that it's not as extensively
covered by unit tests as mainline tahoe was given as corroboration.

In a bid to try and stem the confusion inherent in having tahoe_fuse,
tfuse and tahoefuse jumbled together (not necessarily helped by
referring to them as impl_a, b and c respectively) I'm hereby renaming
tahoefuse as 'blackmatch'  (black match is, per wikipedia "a type of
crude fuse" hey, I'm a punny guy)  Maybe one day it'll be promoted to
be 'quickmatch' instead...

Anyway, this patch moves mac/tahoefuse.py out to contrib/fuse/impl_c/
as blackmatch.py, and makes appropriate changes to the mac build process
to transclude blackmatch therein.  this leaves the extant fuse.py and
fuseparts business in mac/ as-is and doesn't attempt to address such
issues in contrib/fuse/impl_c.

it is left as an exercise to the reader (or the reader of a message
to follow) as to how to deal with the 'fuse' python module on the mac.

as of this time, blackmatch should work on both mac and linux, and
passes the four extant tests in runtests.  (fwiw neither impl_a nor
impl_b have I managed to get working on the mac yet)

since blackmatch supports a read-write and caching fuse interface to
tahoe, some write tests obviously need to be added to runtests.
---
 Makefile                                              | 2 +-
 mac/tahoefuse.py => contrib/fuse/impl_c/blackmatch.py | 0
 contrib/fuse/runtests.py                              | 7 +++++++
 mac/Makefile                                          | 1 +
 4 files changed, 9 insertions(+), 1 deletion(-)
 rename mac/tahoefuse.py => contrib/fuse/impl_c/blackmatch.py (100%)

diff --git a/Makefile b/Makefile
index 09a98ad8..029cdd32 100644
--- a/Makefile
+++ b/Makefile
@@ -396,7 +396,7 @@ mac-dist:
 	VERSION=$(VER) $(MAKE) -C mac diskimage
 
 mac-upload:
-	VERSION=$(VER) $(MAKE) -C mac upload UPLOAD_DEST=$(UPLOAD_DEST)
+	VERSION=$(VER) $(MAKE) -C mac upload
 
 mac-cleanup:
 	VERSION=$(VER) $(MAKE) -C mac cleanup
diff --git a/mac/tahoefuse.py b/contrib/fuse/impl_c/blackmatch.py
similarity index 100%
rename from mac/tahoefuse.py
rename to contrib/fuse/impl_c/blackmatch.py
diff --git a/contrib/fuse/runtests.py b/contrib/fuse/runtests.py
index c54f22e0..11482db8 100644
--- a/contrib/fuse/runtests.py
+++ b/contrib/fuse/runtests.py
@@ -49,6 +49,8 @@ sys.path.append(os.path.join(FuseDir, 'impl_a'))
 import tahoe_fuse as impl_a
 sys.path.append(os.path.join(FuseDir, 'impl_b'))
 import pyfuse.tahoe as impl_b
+sys.path.append(os.path.join(FuseDir, 'impl_c'))
+import blackmatch as impl_c
 
 ### config info about each impl, including which make sense to run
 implementations = {
@@ -60,6 +62,11 @@ implementations = {
                    mount_args=['--basedir', '%(nodedir)s', '%(mountpath)s', ],
                    mount_wait=False,
                    tests=['read', ]),
+    'impl_c': dict(module=impl_c,
+                   mount_args=['--cache-timeout', '0', '--root-uri', '%(root-uri)s',
+                               '--node-directory', '%(nodedir)s', '%(mountpath)s', ],
+                   mount_wait=True,
+                   tests=['read', 'write', ]),
     }
 
 #if sys.platform == 'darwin':
diff --git a/mac/Makefile b/mac/Makefile
index 695e312b..c15da210 100644
--- a/mac/Makefile
+++ b/mac/Makefile
@@ -7,6 +7,7 @@ dist: build diskimage upload cleanup
 
 build:
 	rsync -av ` sw_vers -productVersion | sed -e 's/^\(10\.[0-9]*\)\..*$$/\1/' `/ ./
+	ln -sf ../contrib/fuse/impl_c/blackmatch.py tahoefuse.py
 	python setup.py py2app --no-chdir
 
 diskimage:
-- 
2.45.2