Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 5 Aug 2007 02:36:41 GMT
From:      Andrew Turner <andrew@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 124703 for review
Message-ID:  <200708050236.l752afkj015279@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=124703

Change 124703 by andrew@andrew_hermies on 2007/08/05 02:36:37

	Add the get_directories call. It returns an array of directories the backend can update
	Use get_directories from the front end to build the list of directories to display

Affected files ...

.. //depot/projects/soc2007/andrew-update/backend/facund-be.c#21 edit
.. //depot/projects/soc2007/andrew-update/frontend/facund.py#9 edit
.. //depot/projects/soc2007/andrew-update/frontend/facund/computer.py#9 edit

Differences ...

==== //depot/projects/soc2007/andrew-update/backend/facund-be.c#21 (text+ko) ====

@@ -73,6 +73,8 @@
 
 static struct facund_response *facund_call_ping(const char *,
     struct facund_object *);
+static struct facund_response *facund_get_directories(const char *,
+    struct facund_object *);
 static struct facund_response *facund_call_list_updates(const char *,
     struct facund_object *);
 static struct facund_response *facund_call_list_installed(const char *,
@@ -515,6 +517,21 @@
 	return resp;
 }
 
+static struct facund_response *
+facund_get_directories(const char *id, struct facund_object *obj __unused)
+{
+	struct facund_object *dirs, *item;
+	unsigned int pos;
+
+	dirs = facund_object_new_array();
+	for (pos = 0; pos < watched_db_count; pos++) {
+		item = facund_object_new_string();
+		facund_object_set_string(item, watched_db[pos].db_base);
+		facund_object_array_append(dirs, item);
+	}
+	return facund_response_new(id, 0, "No Error", dirs);
+}
+
 /*
  * Takes either a facund array or a facund string and sets base
  * or ports to true if they are contained in the object
@@ -1013,6 +1030,7 @@
 
 	/* Add the callbacks for each call */
 	facund_server_add_call("ping", facund_call_ping);
+	facund_server_add_call("get_directories", facund_get_directories);
 	facund_server_add_call("list_updates", facund_call_list_updates);
 	facund_server_add_call("list_installed", facund_call_list_installed);
 	facund_server_add_call("install_patches", facund_call_install_patches);

==== //depot/projects/soc2007/andrew-update/frontend/facund.py#9 (text+ko) ====

@@ -40,7 +40,6 @@
 if __name__ == "__main__":
 	computerModel = facund.gui.ComputerTreeModel()
 	localComputer = facund.Computer("Local computer", '/tmp/facund')
-	localComputer.addDir('/')
 	computerModel.addComputer(localComputer)
 
 	updateModel = facund.gui.UpdateListModel()

==== //depot/projects/soc2007/andrew-update/frontend/facund/computer.py#9 (text+ko) ====

@@ -160,6 +160,15 @@
 
 			# Start the communication thread
 			self.start()
+
+			# Get a list of directories the server offers
+			call = facund.Call("get_directories", None)
+			self.__connection.doCall(call)
+			call.acquireLock()
+			call.releaseLock()
+			dirs = call.getResponse().getData().getData()
+			for dir in dirs:
+				self.addDir(dir.getData())
 		except socket.error:
 			print "Couldn't connect to " + self.__host
 			del self.__connection



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200708050236.l752afkj015279>